---
title: "Install DataPocket on Vue.js"
description: "Add DataPocket web analytics with revenue attribution to Vue.js. Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically."
url: "https://datapocket.vo1d.studio/docs/vue"
lang: "en"
updated: "2026-11-13"
---

# Install DataPocket on Vue.js

Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page.

## Steps

1. Vite / Vue CLI: paste into index.html <head>:

```html
<script
  defer
  data-site-id="YOUR_SITE_ID"
  data-domain="YOUR_DOMAIN"
  src="https://datapocket.vo1d.studio/js/script.js"
></script>
```

2. Hash-mode router (createWebHashHistory)? Use the hash build:

```html
<script
  defer
  data-site-id="YOUR_SITE_ID"
  data-domain="YOUR_DOMAIN"
  src="https://datapocket.vo1d.studio/js/script.hash.js"
></script>
```

3. Nuxt: add it to nuxt.config.ts:

```ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [{ src: "https://datapocket.vo1d.studio/js/script.js", defer: true, "data-site-id": "YOUR_SITE_ID", "data-domain": "YOUR_DOMAIN" }],
    },
  },
});
```

## Revenue attribution

1. Using another payment provider? Send payments from your backend (create an API key in Settings):

```bash
curl -X POST https://datapocket.vo1d.studio/api/v1/payments \
  -H "Authorization: Bearer dpk_…" \
  -H "Content-Type: application/json" \
  -d '{"amount": 29.99, "currency": "USD", "transaction_id": "order_123", "visitor_id": "<dp_vid cookie>"}'
```

## Verify

1. Deploy or publish, then open your site in a normal browser window (ad blockers off).
2. In the browser's Network tab, look for a POST to `/api/event` (or `/dp/api/event` when proxied) that returns `{"ok":true}`.
3. The DataPocket Install page for this site switches to "Receiving data" within a few seconds.

## Related guides

- [Next.js](https://datapocket.vo1d.studio/docs/nextjs): App Router or Pages Router. Client-side navigations are tracked automatically.
- [Astro](https://datapocket.vo1d.studio/docs/astro): Static or server-rendered. Navigations with <ClientRouter /> (view transitions) are tracked automatically.
- [React Router](https://datapocket.vo1d.studio/docs/react-router): Framework mode (Remix) and library mode. pushState navigations are tracked automatically.
- [JavaScript apps](https://datapocket.vo1d.studio/docs/npm): React, Vue, Svelte or Angular: the script tag with typed calls, plus server-side payments and goals over HTTP.
- [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots)
