Install DataPocket on Vue.js

Updated

Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. Sign in and these snippets fill in your site ID and domain. Until then, swap YOUR_SITE_ID and YOUR_DOMAIN with the values from your Install page.

  1. 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. 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. 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. 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>"}'

Related guides

Install DataPocket on Vue.js · DataPocket