# Visits don't pay the bills. See which channels do. Most analytics stop at pageviews, so you're left guessing where sales come from. DataPocket matches each payment from Stripe, Shopify, WooCommerce or your own API to the visitor who made it, so every source, page, campaign and country shows the money it brought in. Free for every website, with every feature. No card, no trial, no paid tier. - [Install guides](https://datapocket.vo1d.studio/docs) - [Comparisons](https://datapocket.vo1d.studio/compare) - [Guides](https://datapocket.vo1d.studio/guides) - [Reference](https://datapocket.vo1d.studio/reference) - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) - [Create a free account](https://datapocket.vo1d.studio/signup) ## How it works Three steps, and most sites are done in a few minutes. 1. **Add one script tag.** Under 5 KB gzipped, loads with defer. Single-page apps are tracked without extra code. 2. **Connect your payments.** Each sale is matched to the visitor who made it, so revenue lands on the channel that brought them. 3. **See what makes money.** Every source, page and campaign gets revenue per visitor, so you know where to spend the next hour. ## See the money behind every visit ### Web analytics Visitors, revenue, conversion rate, bounce rate and session time for any period, with sources, pages, countries and devices underneath. Click anything to filter the whole dashboard by it. ### Revenue attribution Sort any breakdown by revenue instead of visits, and the referrers, pages and campaigns that bring paying customers rise to the top. ### Goals, funnels and journeys Count sign-ups and clicks, see where a funnel loses people, and follow each customer from their first visit to the payment: how long it took and what they spent. ### Live visitors Who's on your site right now, where they are, where they came from and what they're doing, on a globe that updates every few seconds. ## Also included, at no extra cost ### See when AI assistants read your site ChatGPT, Claude and Perplexity fetch your pages when someone asks about you. A few lines of server code show which pages they read, split into AI answers, search indexing and model training. How to set it up: [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) ### An SEO score from your own traffic A daily audit of the pages people actually visit, weighted by their traffic: indexing, titles and descriptions, sitemap and robots.txt, Lighthouse, and Core Web Vitals measured in your visitors' browsers. Plus every visit to a missing page and the link that led there. ### An analyst that reads your data Every six hours it checks that tracking and payments are sound, explains what changed and why, tests which segments really convert differently, and forecasts the month. Each finding shows its reasoning. It runs on our servers, with no outside AI. ### Ask your AI assistant about your numbers A read-only MCP server connects Claude, ChatGPT, Claude Code, Cursor and VS Code to your analytics. Sign in with OAuth and tick the websites it may read, or paste a read-only key, then ask things like "which campaigns brought paying customers last month?" ### Ad blockers can't hide visitors Serve the script from your own domain with a two-route proxy. Copy-paste setups for Next.js, Astro, Express, FastAPI, Flask, Django, Laravel, PHP, NGINX, Caddy and WordPress. ### Uptime, alerts and exports Your home page is checked every 5 minutes, with an email when it goes down and when it's back. Set alerts like "no downloads in 24 hours" or "revenue under $500 this week", note launches on the chart, and download any table as CSV. ### Goals without code Track sign-ups and clicks with an HTML attribute (data-dp-goal), scroll milestones with data-dp-scroll, or a one-line JavaScript call. Up to 10 properties per goal. ### An API for your data Send payments and server-side goals from your backend, with idempotent requests and automatic currency conversion. Plain JSON over HTTPS, so it works from Node, Bun, Deno, edge runtimes or any other language. ### Your numbers, not ours No ad tracking, no resale, no cross-site profiles. IP addresses are used to find the visitor's city and are never stored. The cookieless script sets no cookies at all. ## Works with your stack Step-by-step guides with your site's details filled in. If you can add a script tag, DataPocket works. - [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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [FastAPI](https://datapocket.vo1d.studio/docs/fastapi): Async proxy with httpx. - [Flask](https://datapocket.vo1d.studio/docs/flask): Proxy with requests. - [Django](https://datapocket.vo1d.studio/docs/django): Two views and two URL patterns. - [Laravel](https://datapocket.vo1d.studio/docs/laravel): Routes with the Http client, excluded from CSRF. - [PHP](https://datapocket.vo1d.studio/docs/php): One file, no framework, no rewrites. - [NGINX](https://datapocket.vo1d.studio/docs/nginx): Two location blocks in your server config. - [Caddy](https://datapocket.vo1d.studio/docs/caddy): A single handle block. Caddy sets X-Forwarded-For for you. - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Framer](https://datapocket.vo1d.studio/docs/framer): Site Settings → General → Custom Code. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [WordPress](https://datapocket.vo1d.studio/docs/wordpress): Official plugin: tracking, built-in proxy, WooCommerce revenue. - [Shopify](https://datapocket.vo1d.studio/docs/shopify): Theme snippet for the storefront, plus a custom pixel for checkout and verified order revenue. - [Ghost](https://datapocket.vo1d.studio/docs/ghost): Settings → Code injection → Site header. - [Kajabi](https://datapocket.vo1d.studio/docs/kajabi): Theme Settings → Header code. - [Podia](https://datapocket.vo1d.studio/docs/podia): Site → Settings → Advanced → Custom HTML head code. - [Lovable](https://datapocket.vo1d.studio/docs/lovable): Paste one prompt. Also works with Bolt, v0 and Replit. ## How it compares The numbers each tool publishes, side by side, checked in November 2026. | | DataPocket | Google Analytics 4 | Plausible | DataFast | |---|---|---|---|---| | Price | Free | Free (Analytics 360 is paid) | From $9/month, 30-day trial | From $9/month, 14-day trial | | Monthly traffic at that price | 5M events per site (fair use) | Free at any traffic level | 10k pageviews | 10k events | | Websites | Unlimited | Many per account | 1 on Starter, 10 on Business | 1 on Starter, 30 on Growth | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | If you send ecommerce events yourself | Revenue goals on Business ($19/month) | Built in: Stripe, LemonSqueezy, Polar, Shopify, API | | Data history | 5 years | 2 months by default, 14 at most (explorations) | Not stated on the pricing page | 3 years on Starter, 5+ on Growth | | Open source, self-hostable | No | No | Yes | No | When each one is the better pick: - **Google Analytics 4** when you buy Google Ads and want audiences, conversion import and BigQuery export in one place, and you have time to set up ecommerce events. - **Plausible** when you want open-source code you can audit or host yourself, EU hosting and a tiny script, and revenue per channel isn't the main question. - **DataFast** when you want direct LemonSqueezy or Polar connections, or you prefer a paid service whose business model you can see. - **DataPocket** when you want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## Free. All of it. There's one plan and it costs nothing: unlimited websites, revenue attribution, public dashboards, the API and five years of history. Paying for analytics today? See what the same traffic costs on [Fathom](https://datapocket.vo1d.studio/compare/fathom) or [Umami Cloud](https://datapocket.vo1d.studio/compare/umami). - Websites: Unlimited - Events: 5 million per site, per month (fair use) - Data retention: 5 years - Revenue integrations: Stripe, Shopify, WooCommerce, Payment API - Over the fair-use limit: Your dashboard keeps working. Events above the limit aren't recorded until the next month. - Credit card: Never asked for ## Questions ### Is it really free? Yes. There is one plan, it costs nothing and it includes every feature: unlimited websites, revenue attribution, goals, funnels, journeys, the analyst, public dashboards, the API and five years of history. No trial, no card. The only limit is fair use: 5 million events per site per month. ### What's the catch? DataPocket is a young, independent service. There is no uptime guarantee and no support contract, and the code is not open source, so you can't self-host it. If you need any of those today, a paid or open-source tool is the safer choice. ### How does revenue get attributed? When someone pays, DataPocket looks up the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Stripe Checkout and Payment Links work without code: add ?session_id={CHECKOUT_SESSION_ID} to your success URL. Otherwise, pass the dp_vid cookie to your payment metadata or to the Payment API. ### Which payment providers work? Stripe connects with a restricted API key, Shopify with a custom app token, and WooCommerce through the WordPress plugin. Anything else, including Paddle, LemonSqueezy, Polar, Gumroad or your own billing, works through the Payment API with one request per payment. ### Do I need a cookie banner? The standard script sets first-party cookies to recognize returning visitors, which gives the most accurate long-term attribution. Depending on where you and your visitors are, that may need consent. The cookieless script sets no cookies and counts visitors with a daily-rotating hash instead. ### Will it slow my site down? No. The script is under 5 KB gzipped, loads with defer and sends small requests that never block the page. ### What about ad blockers? Many block third-party analytics domains. Serve the script from your own domain with a two-route proxy (there are copy-paste guides for Next.js, Astro, Express, Django, Laravel, NGINX, Caddy, WordPress and more) and those visits are counted again. ### Can I see when ChatGPT or Claude read my site? Yes. AI assistants fetch your pages from their servers when someone asks about you, and they don't run JavaScript, so a few lines of server code report them: snippets for Next.js, Express, Astro, Cloudflare Workers or a plain HTTP call. The dashboard then splits them into AI answers, search indexing and model training. ### Is my data sent to an AI? No. The analyst that explains changes and forecasts the month is statistics code that runs on DataPocket's own servers. Nothing is sent to OpenAI, Anthropic or any other AI provider. ### Who can see my data? Only people you invite to the site, as members or viewers. Dashboards are private until you switch on public sharing. IP addresses are used to look up the visitor's city and are never stored. ### Can I import my Google Analytics history? Not yet. Run DataPocket next to your current tool for a while; it doesn't conflict with Google Analytics, Plausible or any other script. ### What counts as an event? Each pageview, goal, outbound link click and identify call. Payments and AI crawler requests don't count; crawler requests have their own limit of 1 million per site per month. --- # Install guides DataPocket works anywhere you can add a script tag. Guides marked "ad-block proof" proxy the script through your own domain. ## Code - [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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [FastAPI](https://datapocket.vo1d.studio/docs/fastapi): Async proxy with httpx. - [Flask](https://datapocket.vo1d.studio/docs/flask): Proxy with requests. - [Django](https://datapocket.vo1d.studio/docs/django): Two views and two URL patterns. - [Laravel](https://datapocket.vo1d.studio/docs/laravel): Routes with the Http client, excluded from CSRF. - [PHP](https://datapocket.vo1d.studio/docs/php): One file, no framework, no rewrites. - [NGINX](https://datapocket.vo1d.studio/docs/nginx): Two location blocks in your server config. - [Caddy](https://datapocket.vo1d.studio/docs/caddy): A single handle block. Caddy sets X-Forwarded-For for you. ## No-code - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Framer](https://datapocket.vo1d.studio/docs/framer): Site Settings → General → Custom Code. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [WordPress](https://datapocket.vo1d.studio/docs/wordpress): Official plugin: tracking, built-in proxy, WooCommerce revenue. - [Shopify](https://datapocket.vo1d.studio/docs/shopify): Theme snippet for the storefront, plus a custom pixel for checkout and verified order revenue. - [Ghost](https://datapocket.vo1d.studio/docs/ghost): Settings → Code injection → Site header. - [Kajabi](https://datapocket.vo1d.studio/docs/kajabi): Theme Settings → Header code. - [Podia](https://datapocket.vo1d.studio/docs/podia): Site → Settings → Advanced → Custom HTML head code. - [Lovable](https://datapocket.vo1d.studio/docs/lovable): Paste one prompt. Also works with Bolt, v0 and Replit. ## Comparisons All of them: https://datapocket.vo1d.studio/compare - [DataPocket vs Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics): DataPocket and Google Analytics 4 compared: price, traffic limits, revenue by channel, data history, and when each one is the better pick. - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible): DataPocket and Plausible compared: price, traffic limits, revenue by channel, self-hosting, and when each one is the better pick. - [DataPocket vs DataFast](https://datapocket.vo1d.studio/compare/datafast): DataPocket and DataFast compared: price, traffic limits, revenue integrations, data history, and when each one is the better pick. - [DataPocket vs Fathom Analytics](https://datapocket.vo1d.studio/compare/fathom): DataPocket vs Fathom Analytics: Fathom starts at $15/month for 100k pageviews; DataPocket is free, with Stripe revenue by channel. Prices and when each wins. - [DataPocket vs Simple Analytics](https://datapocket.vo1d.studio/compare/simple-analytics): DataPocket vs Simple Analytics: EU-hosted Simple Analytics is $20/month at 100k pageviews; DataPocket is free, with revenue by channel. When each one wins. - [DataPocket vs Umami](https://datapocket.vo1d.studio/compare/umami): DataPocket vs Umami: open-source Umami is free to self-host; DataPocket is free and hosted, with Stripe, Shopify and WooCommerce revenue by channel built in. ## Guides All of them: https://datapocket.vo1d.studio/guides - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source): Connect your payments to your analytics so every channel, referrer, campaign and page shows the revenue it brought, not just visits. Free with DataPocket. - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution): See which channels, referrers and campaigns bring Stripe customers. Works with Stripe Checkout and Payment Links without code, or with Checkout Session metadata. - [How to see traffic from ChatGPT, Perplexity and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic): Measure the visitors ChatGPT, Perplexity, Claude, Gemini and Copilot send you, the revenue they bring, and which pages the assistants read to answer questions. - [SEO score, Core Web Vitals and missing pages, from your own traffic](https://datapocket.vo1d.studio/guides/seo-audit): A daily SEO audit of the pages your visitors actually open, weighted by their traffic, with real-user Core Web Vitals, 404s and where they come from, crawler coverage and Lighthouse scores. ## Reference All of them: https://datapocket.vo1d.studio/reference - [Tracking script reference](https://datapocket.vo1d.studio/reference/tracking-script): Every attribute of the DataPocket script, the window.datapocket() API and its limits, what leaves the browser, cookieless mode, and pinned versions with Subresource Integrity. - [First-party proxy: what to forward](https://datapocket.vo1d.studio/reference/first-party-proxy): What a proxy serving DataPocket from your own domain must forward (the event, User-Agent and the visitor's IP), what it must not (cookies), and how DataPocket reads the visitor's IP. - [REST API: payments and goals](https://datapocket.vo1d.studio/reference/rest-api): The DataPocket Payment API and server-side goals: authentication, every field, idempotency, currencies, how payments find their visitor, responses and errors. - [Read API: stats, visitors, funnels and insights](https://datapocket.vo1d.studio/reference/read-api): Read your DataPocket analytics over HTTPS with an API key: sites, overview, time series, breakdowns, goals, funnels, visitors, journeys, bots, realtime, annotations and the latest insights report. Parameters, limits and errors. - [MCP server: your analytics in Claude, Cursor and other AI assistants](https://datapocket.vo1d.studio/reference/mcp): Connect claude.ai, Claude Desktop, Claude Code, Cursor or any MCP client to DataPocket: sign in with OAuth or use a read-only API key. Setup, the 17 read-only tools, units, limits and how visitor-supplied text is handled. ## More - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots): see when ChatGPT, Claude and Perplexity fetch your pages, plus search and training crawlers. One server-side call. - [All guides in one file](https://datapocket.vo1d.studio/llms-full.txt) for AI assistants. --- # DataPocket compared with other analytics tools Side-by-side comparisons with the analytics tools people most often weigh against DataPocket. Every competitor fact comes from the vendor's own pricing and documentation pages, and each page says when the other tool is the better pick. - [DataPocket vs Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics): DataPocket and Google Analytics 4 compared: price, traffic limits, revenue by channel, data history, and when each one is the better pick. - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible): DataPocket and Plausible compared: price, traffic limits, revenue by channel, self-hosting, and when each one is the better pick. - [DataPocket vs DataFast](https://datapocket.vo1d.studio/compare/datafast): DataPocket and DataFast compared: price, traffic limits, revenue integrations, data history, and when each one is the better pick. - [DataPocket vs Fathom Analytics](https://datapocket.vo1d.studio/compare/fathom): DataPocket vs Fathom Analytics: Fathom starts at $15/month for 100k pageviews; DataPocket is free, with Stripe revenue by channel. Prices and when each wins. - [DataPocket vs Simple Analytics](https://datapocket.vo1d.studio/compare/simple-analytics): DataPocket vs Simple Analytics: EU-hosted Simple Analytics is $20/month at 100k pageviews; DataPocket is free, with revenue by channel. When each one wins. - [DataPocket vs Umami](https://datapocket.vo1d.studio/compare/umami): DataPocket vs Umami: open-source Umami is free to self-host; DataPocket is free and hosted, with Stripe, Shopify and WooCommerce revenue by channel built in. ## More - [Guides](https://datapocket.vo1d.studio/guides) - [Reference](https://datapocket.vo1d.studio/reference) - [Install guides](https://datapocket.vo1d.studio/docs) --- # Guides: revenue attribution, AI traffic and SEO Step-by-step answers to the questions DataPocket was built for: which traffic sources make money, how to attribute Stripe payments, how much traffic AI assistants send, and what's holding your pages back in search. - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source): Connect your payments to your analytics so every channel, referrer, campaign and page shows the revenue it brought, not just visits. Free with DataPocket. - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution): See which channels, referrers and campaigns bring Stripe customers. Works with Stripe Checkout and Payment Links without code, or with Checkout Session metadata. - [How to see traffic from ChatGPT, Perplexity and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic): Measure the visitors ChatGPT, Perplexity, Claude, Gemini and Copilot send you, the revenue they bring, and which pages the assistants read to answer questions. - [SEO score, Core Web Vitals and missing pages, from your own traffic](https://datapocket.vo1d.studio/guides/seo-audit): A daily SEO audit of the pages your visitors actually open, weighted by their traffic, with real-user Core Web Vitals, 404s and where they come from, crawler coverage and Lighthouse scores. ## More - [Comparisons](https://datapocket.vo1d.studio/compare) - [Reference](https://datapocket.vo1d.studio/reference) - [Install guides](https://datapocket.vo1d.studio/docs) --- # Reference: tracking script, APIs and MCP server The exact rules, read from DataPocket's code: every script attribute, what a first-party proxy must forward, the payment, goal and stats endpoints, and the MCP server that gives AI assistants read-only access to your analytics. - [Tracking script reference](https://datapocket.vo1d.studio/reference/tracking-script): Every attribute of the DataPocket script, the window.datapocket() API and its limits, what leaves the browser, cookieless mode, and pinned versions with Subresource Integrity. - [First-party proxy: what to forward](https://datapocket.vo1d.studio/reference/first-party-proxy): What a proxy serving DataPocket from your own domain must forward (the event, User-Agent and the visitor's IP), what it must not (cookies), and how DataPocket reads the visitor's IP. - [REST API: payments and goals](https://datapocket.vo1d.studio/reference/rest-api): The DataPocket Payment API and server-side goals: authentication, every field, idempotency, currencies, how payments find their visitor, responses and errors. - [Read API: stats, visitors, funnels and insights](https://datapocket.vo1d.studio/reference/read-api): Read your DataPocket analytics over HTTPS with an API key: sites, overview, time series, breakdowns, goals, funnels, visitors, journeys, bots, realtime, annotations and the latest insights report. Parameters, limits and errors. - [MCP server: your analytics in Claude, Cursor and other AI assistants](https://datapocket.vo1d.studio/reference/mcp): Connect claude.ai, Claude Desktop, Claude Code, Cursor or any MCP client to DataPocket: sign in with OAuth or use a read-only API key. Setup, the 17 read-only tools, units, limits and how visitor-supplied text is handled. ## More - [Comparisons](https://datapocket.vo1d.studio/compare) - [Guides](https://datapocket.vo1d.studio/guides) - [Install guides](https://datapocket.vo1d.studio/docs) --- # DataPocket vs Google Analytics 4 Both are free. Google Analytics 4 is the better pick if you buy Google Ads and want audiences, conversion import and BigQuery export. DataPocket is the better pick if you want revenue next to every channel, page and campaign without ecommerce events: connect Stripe, Shopify or WooCommerce and each sale is credited to the channel that brought the buyer. On this page: - How do DataPocket and Google Analytics 4 compare? - When is Google Analytics 4 the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from Google Analytics 4 to DataPocket? ## How do DataPocket and Google Analytics 4 compare? | | DataPocket | Google Analytics 4 | |---|---|---| | Price | Free | Free (Analytics 360 is paid) | | Monthly traffic at that price | 5M events per site (fair use) | Free at any traffic level | | Websites | Unlimited | Many per account | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | If you send ecommerce events yourself | | Data history | 5 years | 2 months by default, 14 at most (explorations) | | Open source, self-hostable | No | No | From each vendor's own pricing and documentation pages, checked November 2026. Prices change, so check [Google Analytics 4's pricing](https://marketingplatform.google.com/about/analytics/) before deciding. ## When is Google Analytics 4 the better pick? Pick Google Analytics 4 if you buy Google Ads and want audiences, conversion import and BigQuery export in one place, and you have time to set up ecommerce events. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from Google Analytics 4 to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to Google Analytics 4's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove Google Analytics 4's script. DataPocket can't import history from Google Analytics 4 yet, so your DataPocket reports start on the day you install the script. ## Questions ### Is DataPocket a replacement for Google Analytics 4? For most small sites and SaaS products, yes: visitors, sources, pages, goals, funnels and revenue by channel are all there. It doesn't replace GA4's Google Ads integration (audiences, conversion import) or BigQuery export. ### Can I import my Google Analytics history? Not yet. Run DataPocket next to GA4 for a while; the two scripts don't conflict. ### Does DataPocket keep data longer than GA4? DataPocket keeps 5 years of history. GA4 keeps event data for exploration reports for 2 months by default and 14 at most. Some privacy-first tools keep even less on their free plans: [Simple Analytics keeps one month](https://datapocket.vo1d.studio/compare/simple-analytics). ### Does Google Analytics 4 show AI crawlers like GPTBot? No. GA4 is a JavaScript tag and crawlers don't run scripts. DataPocket counts them when your server reports them with one call: see [tracking GPTBot, ClaudeBot and PerplexityBot](https://datapocket.vo1d.studio/docs/ai-bots). ## Related - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # DataPocket vs Plausible Plausible is the better pick if you want open-source analytics you can audit or host yourself, EU hosting and a tiny script. DataPocket is the better pick if revenue per channel is the main question: it's free, with Stripe, Shopify and WooCommerce revenue built in. DataPocket is closed source and can't be self-hosted. On this page: - How do DataPocket and Plausible compare? - When is Plausible the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from Plausible to DataPocket? ## How do DataPocket and Plausible compare? | | DataPocket | Plausible | |---|---|---| | Price | Free | From $9/month, 30-day trial | | Monthly traffic at that price | 5M events per site (fair use) | 10k pageviews | | Websites | Unlimited | 1 on Starter, 10 on Business | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | Revenue goals on Business ($19/month) | | Data history | 5 years | Not stated on the pricing page | | Open source, self-hostable | No | Yes | From each vendor's own pricing and documentation pages, checked November 2026. Prices change, so check [Plausible's pricing](https://plausible.io/#pricing) before deciding. ## When is Plausible the better pick? Pick Plausible if you want open-source code you can audit or host yourself, EU hosting and a tiny script, and revenue per channel isn't the main question. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from Plausible to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to Plausible's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove Plausible's script. DataPocket can't import history from Plausible yet, so your DataPocket reports start on the day you install the script. ## Questions ### Is DataPocket open source like Plausible? No. DataPocket is closed source and can't be self-hosted. If you need to audit the code or run it on your own servers, Plausible is the better choice, and [Umami is open source under the MIT license](https://datapocket.vo1d.studio/compare/umami) too. ### Do both work without cookies? Plausible is cookieless. DataPocket's standard script sets first-party cookies for more accurate long-term attribution, and a cookieless script is available that counts visitors with a daily-rotating hash instead. ### Which one is cheaper? DataPocket is free, with every feature, for unlimited websites (fair use of 5 million events per site per month). Plausible starts at $9 a month for 10k pageviews, with revenue goals on the $19 Business plan. ## Related - [DataPocket vs Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics) - [DataPocket vs DataFast](https://datapocket.vo1d.studio/compare/datafast) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # DataPocket vs DataFast Both put revenue next to each traffic source. DataFast is the better pick if you want direct LemonSqueezy or Polar connections, or a paid service whose business model you can see. DataPocket is free, with Stripe, Shopify and WooCommerce built in and LemonSqueezy or Polar through its Payment API, but it is a young service with no uptime guarantee. On this page: - How do DataPocket and DataFast compare? - When is DataFast the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from DataFast to DataPocket? ## How do DataPocket and DataFast compare? | | DataPocket | DataFast | |---|---|---| | Price | Free | From $9/month, 14-day trial | | Monthly traffic at that price | 5M events per site (fair use) | 10k events | | Websites | Unlimited | 1 on Starter, 30 on Growth | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | Built in: Stripe, LemonSqueezy, Polar, Shopify, API | | Data history | 5 years | 3 years on Starter, 5+ on Growth | | Open source, self-hostable | No | No | From each vendor's own pricing and documentation pages, checked November 2026. Prices change, so check [DataFast's pricing](https://datafa.st/#pricing) before deciding. ## When is DataFast the better pick? Pick DataFast if you want direct LemonSqueezy or Polar connections, or you prefer a paid service whose business model you can see. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from DataFast to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to DataFast's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove DataFast's script. DataPocket can't import history from DataFast yet, so your DataPocket reports start on the day you install the script. ## Questions ### Can DataPocket track LemonSqueezy or Polar revenue? Yes, through the Payment API: send one request per payment with the buyer's `dp_vid` cookie. There is no direct LemonSqueezy or Polar connection yet. ### How is DataPocket free? There is one plan and it costs nothing. The honest trade-off: it's a young, independent service with no uptime guarantee and no support contract. ## Related - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # DataPocket vs Fathom Analytics Pick Fathom if you want a paid service that covers 50 sites on one plan and you're happy to send purchase values from your own code. Pick DataPocket if you want revenue by channel without paying: it's free, and Stripe, Shopify and WooCommerce payments are matched to the visitor who paid. Fathom starts at $15 a month for 100k pageviews and has no free plan. On this page: - How do DataPocket and Fathom Analytics compare? - What does the same traffic cost on Fathom Analytics and DataPocket? - When is Fathom Analytics the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from Fathom Analytics to DataPocket? ## How do DataPocket and Fathom Analytics compare? | | DataPocket | Fathom Analytics | |---|---|---| | Price | Free | From $15/month, 7-day trial (card required), no free plan | | Monthly traffic at that price | 5M events per site (fair use) | 100k pageviews, shared across your sites | | Websites | Unlimited | 50 on every plan | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | Event values you send from your own code; no payment-provider connection in the docs | | Data history | 5 years | Full history while subscribed | | Open source, self-hostable | No | No for the hosted product; Fathom Lite, an older open-source version, can be self-hosted | From each vendor's own pricing and documentation pages, checked November 23, 2026. Prices change, so check [Fathom Analytics's pricing](https://usefathom.com/pricing) before deciding. ## What does the same traffic cost on Fathom Analytics and DataPocket? | | Fathom Analytics | DataPocket | |---|---|---| | Up to 100k pageviews a month, 1 site | $15/month ($180 a year billed monthly; yearly billing gives 2 months free) | Free | | Up to 100k pageviews a month across 10 sites | $15/month ($180 a year billed monthly; yearly billing gives 2 months free) | Free | | More than 100k pageviews a month | A higher tier: see Fathom's pricing page | Free up to 5M events per site (fair use) | Fathom prices by pageviews shared across sites; DataPocket counts events (pageviews plus custom events) per site. Sources, checked November 23, 2026: [Fathom pricing](https://usefathom.com/pricing), [Fathom ecommerce conversions](https://usefathom.com/docs/events/ecommerce-conversions), [Fathom Lite](https://usefathom.com/lite). ## When is Fathom Analytics the better pick? Pick Fathom Analytics if you run many small sites and want them all under one paid plan, or you prefer a paid service with an EU data isolation setup, and you are happy to send purchase values from your own code. - You run lots of small sites. Every Fathom plan includes 50 of them under one bill. - You would rather pay for analytics than use a free service, and you want the EU data isolation setup Fathom describes. - You only need goal values (in cents, sent with `fathom.trackEvent`) rather than payments matched to visitors. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from Fathom Analytics to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to Fathom Analytics's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove Fathom Analytics's script. DataPocket can't import history from Fathom Analytics yet, so your DataPocket reports start on the day you install the script. ## Questions ### Is there a free Fathom Analytics plan? No. Fathom's pricing page says there is no free plan; it starts at $15 a month for 100k pageviews after a 7-day trial that asks for a card. DataPocket is free for every website, and [Simple Analytics has a free plan for hobby sites](https://datapocket.vo1d.studio/compare/simple-analytics) with one month of history. ### Can Fathom show revenue by traffic source? Fathom events can carry a value in cents, which your own code sends with `fathom.trackEvent`. Its docs don't describe a Stripe or Shopify connection. DataPocket connects to Stripe, Shopify and WooCommerce and credits each sale to the channel of the buyer's first visit, and [DataFast connects Stripe, LemonSqueezy and Polar](https://datapocket.vo1d.studio/compare/datafast) for a monthly fee. ### Can I self-host Fathom? Not the current product. Fathom Lite, an older open-source version, can be self-hosted. DataPocket can't be self-hosted either; if you need that, look at [Umami](https://datapocket.vo1d.studio/compare/umami) or [Plausible](https://datapocket.vo1d.studio/compare/plausible). ## Related - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [DataPocket vs Simple Analytics](https://datapocket.vo1d.studio/compare/simple-analytics) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # DataPocket vs Simple Analytics Pick Simple Analytics if your data must be stored in the EU or you need an enterprise contract. Pick DataPocket if you want 5 years of history and revenue next to every channel for free: Simple Analytics' free plan keeps one month of data, and paid plans start at $20 a month for 100k pageviews. On this page: - How do DataPocket and Simple Analytics compare? - What does the same traffic cost on Simple Analytics and DataPocket? - When is Simple Analytics the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from Simple Analytics to DataPocket? ## How do DataPocket and Simple Analytics compare? | | DataPocket | Simple Analytics | |---|---|---| | Price | Free | Free for hobby sites; paid from $20/month at 100k pageviews, 14-day trial without a card | | Monthly traffic at that price | 5M events per site (fair use) | Free plan: unlimited pageviews; paid plans priced by volume | | Websites | Unlimited | 5 on Free; not stated for paid plans | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | No revenue report on the pricing page; events can carry metadata | | Data history | 5 years | 1 month on Free; longer on paid plans (length not stated) | | Open source, self-hostable | No | Not offered on the pricing page | From each vendor's own pricing and documentation pages, checked November 23, 2026. Prices change, so check [Simple Analytics's pricing](https://www.simpleanalytics.com/pricing) before deciding. ## What does the same traffic cost on Simple Analytics and DataPocket? | | Simple Analytics | DataPocket | |---|---|---| | Hobby site, only the last month of data | Free (1 month history, 5 sites) | Free (5 years history, unlimited sites) | | 100k pageviews a month with full history | $20/month, or $200/year billed annually | Free | | Each extra user | +$20/month | Free (invite your team) | Simple Analytics' paid price scales with pageviews (the pricing slider runs from 100k to 2.5M); annual billing gives 2 months free. Sources, checked November 23, 2026: [Simple Analytics pricing](https://www.simpleanalytics.com/pricing), [Simple Analytics metadata docs](https://docs.simpleanalytics.com/metadata). ## When is Simple Analytics the better pick? Pick Simple Analytics if you need data stored in the EU, a hobby site where one month of history is enough, or an enterprise contract with custom terms. - Data residency matters. Simple Analytics stores website data in the EU, with its primary infrastructure in the Netherlands. - A hobby site where the last month is all you look at. The free plan has unlimited pageviews and 5 websites. - You need a contract. Simple Analytics sells an Enterprise plan with custom pricing. DataPocket has no support contract or uptime guarantee. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from Simple Analytics to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to Simple Analytics's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove Simple Analytics's script. DataPocket can't import history from Simple Analytics yet, so your DataPocket reports start on the day you install the script. ## Questions ### How long does Simple Analytics keep data on the free plan? One month: its pricing page says the free plan keeps the latest month in your dashboard. DataPocket keeps 5 years on its free plan, which is its only plan. ### Does Simple Analytics track revenue? Its pricing page doesn't list a revenue report. Events can carry metadata, which you can filter goals by. DataPocket matches Stripe, Shopify and WooCommerce payments to visitors and shows revenue per channel, page and campaign. ### Where is the data stored? Simple Analytics stores website data in the EU, with its primary infrastructure in the Netherlands. If EU storage is a hard requirement, that's a reason to pick it. [Fathom, a paid tool covering 50 sites per plan](https://datapocket.vo1d.studio/compare/fathom), describes an EU data isolation setup too. ## Related - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [DataPocket vs Fathom Analytics](https://datapocket.vo1d.studio/compare/fathom) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # DataPocket vs Umami Pick Umami if you want MIT-licensed code you can self-host for free, or you already send purchase events from your site's code. Pick DataPocket if you want payments connected without code: Stripe, Shopify and WooCommerce sales are credited to the channel that brought the buyer, with 5 years of history and unlimited sites for free. Umami Cloud is free for 1 site and 100k events, then $20 a month. On this page: - How do DataPocket and Umami compare? - What does the same traffic cost on Umami and DataPocket? - When is Umami the better pick? - When is DataPocket the better pick? - How does DataPocket attribute revenue? - How do you switch from Umami to DataPocket? ## How do DataPocket and Umami compare? | | DataPocket | Umami | |---|---|---| | Price | Free | Free Hobby plan; Pro $20/month; self-hosting free | | Monthly traffic at that price | 5M events per site (fair use) | 100k events on Hobby, 1M on Pro | | Websites | Unlimited | 1 on Hobby, 20 on Pro, unlimited on Business ($200/month) | | Revenue by channel | Built in: Stripe, Shopify, WooCommerce, API | Revenue report on every plan, from events you send with a revenue and currency | | Data history | 5 years | 6 months on Hobby, 2 years on Pro, 5 years on Business | | Open source, self-hostable | No | Yes, MIT license | From each vendor's own pricing and documentation pages, checked November 23, 2026. Prices change, so check [Umami's pricing](https://umami.is/pricing) before deciding. ## What does the same traffic cost on Umami and DataPocket? | | Umami | DataPocket | |---|---|---| | Up to 100k events a month, 1 site | Hobby, free (6 months history) | Free (5 years history) | | Up to 1M events a month, up to 20 sites | Pro, $20/month (2 years history) | Free | | More than 20 sites, or 5 years of history | Business, $200/month | Free (fair use of 5M events per site) | Both count events. Umami Cloud's plans differ by events, websites and how long data is kept. Sources, checked November 23, 2026: [Umami pricing](https://umami.is/pricing), [Umami revenue docs](https://docs.umami.is/docs/revenue). ## When is Umami the better pick? Pick Umami if you want open-source code under the MIT license, or to self-host on your own servers for free, and you already send purchase events from your site's code. - You want the code. Umami is open source under the MIT license, and self-hosting it is free. - Your data must stay on your own servers. Self-hosted Umami runs on your infrastructure. DataPocket can't be self-hosted. - You already fire purchase events in the browser. Umami's Revenue report reads `revenue` and `currency` from those events on every plan, including the free one. ## When is DataPocket the better pick? You want revenue next to every channel, page and campaign without paying for it, and you're fine with a young service that has no uptime guarantee. ## How does DataPocket attribute revenue? When someone pays, DataPocket finds the visitor who paid and credits the sale to the channel, campaign and landing page of their first visit. Every breakdown in the dashboard (channels, referrers, pages, campaigns, countries) can then be sorted by revenue instead of visits. - Stripe: a restricted API key, plus `?session_id={CHECKOUT_SESSION_ID}` on your Checkout or Payment Link success URL. No code. - Shopify: a custom app token and a customer-events pixel. Orders are verified against Shopify before they count. - WooCommerce: the WordPress plugin sends paid orders and syncs refunds. - Anything else (Paddle, LemonSqueezy, Polar, Gumroad, your own billing): one request per payment to the Payment API. ## How do you switch from Umami to DataPocket? 1. Create a free account and add your site, then paste the one-line script tag next to Umami's: the [install guides](https://datapocket.vo1d.studio/docs) cover 25 platforms. The two scripts don't conflict. 2. Connect payments in Settings → Revenue (Stripe, Shopify, WooCommerce) or send them with the [Payment API](https://datapocket.vo1d.studio/reference/rest-api), so each sale is credited to the channel that brought the buyer. 3. Recreate your goals with `window.datapocket(name, props)` in the browser or `POST /api/v1/goals` from your server. 4. Run both for a few weeks and compare the numbers. When you're happy, remove Umami's script. DataPocket can't import history from Umami yet, so your DataPocket reports start on the day you install the script. ## Questions ### Is Umami free? Self-hosted Umami is free and open source under the MIT license. Umami Cloud has a free Hobby plan for 1 website, 100k events a month and 6 months of data; Pro is $20 a month for 1M events and 20 websites. For comparison, [Fathom has no free plan](https://datapocket.vo1d.studio/compare/fathom). ### Can Umami track Stripe revenue? Umami's Revenue report reads `revenue` and `currency` properties from events you send, on every plan. Its docs describe sending them from the browser, not a Stripe connection. DataPocket connects a restricted Stripe key and attributes Checkout and Payment Link sales without code: see [Stripe revenue attribution](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution). ### Can I self-host DataPocket like Umami? No. DataPocket is closed source and hosted only. If running it on your own servers is a requirement, Umami is the better pick. ## Related - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [All comparisons](https://datapocket.vo1d.studio/compare) --- # How to see which traffic sources make money Connect your payment provider to your analytics so each sale is matched to its visitor. The sale is then credited to the channel, campaign and landing page of that visitor's first visit, and every traffic report can be sorted by revenue. DataPocket does this for free with Stripe, Shopify, WooCommerce or any provider through its Payment API. What this guide answers: - Why aren't visits enough? - How do you set it up? - Which visit gets the credit for a sale? - What about payments sent from your backend? ## Why aren't visits enough? A source that sends a thousand visitors and no buyers is worth less than one that sends fifty visitors and five sales. Visit counts hide that. Revenue per channel and revenue per visitor show it straight away, so you know where the next hour of marketing should go. Many analytics tools stop at visits or put revenue behind a higher plan. See how DataPocket compares with [Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics), [Plausible](https://datapocket.vo1d.studio/compare/plausible) and [DataFast](https://datapocket.vo1d.studio/compare/datafast) on revenue by channel. Paying per pageview today? [Fathom starts at $15 a month](https://datapocket.vo1d.studio/compare/fathom) and [Simple Analytics at $20](https://datapocket.vo1d.studio/compare/simple-analytics) for 100k pageviews, before any revenue report. > **Already paying for analytics?** Each comparison puts the vendor's published prices and limits next to DataPocket's, and says when the other tool is the better pick. [See every comparison](https://datapocket.vo1d.studio/compare) ## How do you set it up? 1. Add the tracking script to your site: one script tag, under 5 KB gzipped, loaded with `defer`. Pick your platform in the [install guides](https://datapocket.vo1d.studio/docs). 2. Connect your payments in Settings → Revenue: Stripe, Shopify or WooCommerce, or send payments from your backend with the Payment API. 3. Open any breakdown (channels, referrers, pages, campaigns, countries) and sort it by revenue. ## Which visit gets the credit for a sale? DataPocket credits each sale to the buyer's first visit: the channel, source, campaign and landing page that first brought them. That's the question most small teams want answered (what finds us customers?), and it stays stable when a buyer returns later by typing your address. ![Diagram of first-visit attribution: a buyer arrives from a newsletter on /pricing, returns as Direct, then pays, and the sale is credited to the newsletter](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source/first-visit-revenue-attribution-flow.svg) Customer journeys show the whole path for each buyer: every visit, how long it took and what they spent. ## What about payments sent from your backend? Read the `dp_vid` cookie when the buyer checks out and send it with the payment: ```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": ""}' ``` Requests are idempotent on `transaction_id`, and other currencies are converted automatically. ## Questions ### Do I need to change my checkout? Not with Stripe Checkout or Payment Links: add `?session_id={CHECKOUT_SESSION_ID}` to the success URL and connect a restricted key. Shopify and WooCommerce don't need checkout changes either. Other providers need one API call per payment. ### Are refunds subtracted? Yes. Stripe, Shopify and WooCommerce refunds sync automatically and refunded payments don't count as revenue. ### What about subscription renewals? Stripe renewals inherit the visitor of the customer's first payment, so recurring revenue stays on the channel that found the customer. You can choose whether renewals count in the totals. ## Related - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution) - [How to see traffic from ChatGPT, Perplexity and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic) - [DataPocket vs Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics) - [All guides](https://datapocket.vo1d.studio/guides) --- # Track Stripe revenue by traffic source Connect a restricted Stripe key to DataPocket, then either add `?session_id={CHECKOUT_SESSION_ID}` to your Checkout or Payment Link success URL (no code) or pass the visitor's `dp_vid` cookie in the Checkout Session metadata. Each payment is then matched to the visitor who paid and credited to the channel, campaign and landing page of their first visit. What this guide answers: - Step 1: how do you connect Stripe? - Step 2a: how do you attribute payments without code? - Step 2b: how do you attribute payments with Checkout Session metadata? - How are renewals and refunds handled? ## Step 1: how do you connect Stripe? In Stripe → Developers → API keys, create a restricted key with Read on Checkout Sessions, Invoices, Charges and Customers, and Write on Webhook Endpoints (so DataPocket can register its webhook for you). Paste it in DataPocket under Settings → Revenue → Stripe. > **No DataPocket account yet?** Stripe revenue attribution is part of the free plan: unlimited sites, 5 years of history, no card. [Create a free account](https://datapocket.vo1d.studio/signup) ## Step 2a: how do you attribute payments without code? Set the success URL of your Checkout Session or Payment Link to include the session ID: ``` https://yoursite.com/thanks?session_id={CHECKOUT_SESSION_ID} ``` ![Two ways to match a Stripe payment to a visitor: a session_id in the Checkout or Payment Link success URL, or the dp_vid cookie in Checkout Session metadata](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution/stripe-checkout-session-attribution-paths.svg) When the buyer lands on that page, the tracking script reports the session ID, DataPocket fetches the session from Stripe with your key, and the sale is linked to that visitor. ## Step 2b: how do you attribute payments with Checkout Session metadata? If you create Checkout Sessions on your server, pass the DataPocket cookies as metadata. This also works when the buyer never reaches your success page: ```js const session = await stripe.checkout.sessions.create({ // …your line_items, mode, success_url… metadata: { datapocket_visitor_id: req.cookies.dp_vid, datapocket_session_id: req.cookies.dp_sid, }, }); ``` Python and PHP versions are in each framework's [install guide](https://datapocket.vo1d.studio/docs). ## How are renewals and refunds handled? - Subscription renewals (`invoice.paid`) inherit the visitor of the customer's first payment, so recurring revenue stays on the channel that found them. - Refunds (`charge.refunded`) mark the payment refunded, and it stops counting as revenue. Comparing tools for Stripe revenue? [DataPocket vs DataFast](https://datapocket.vo1d.studio/compare/datafast) and [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) show which ones connect to Stripe and what they charge for it. [Google Analytics 4 needs ecommerce events you send yourself](https://datapocket.vo1d.studio/compare/google-analytics), and [Umami reads revenue from events too](https://datapocket.vo1d.studio/compare/umami). ## Questions ### Does it work with Stripe Payment Links? Yes. Add `?session_id={CHECKOUT_SESSION_ID}` to the Payment Link's confirmation page URL. ### Can DataPocket change anything in my Stripe account? The restricted key can only read Checkout Sessions, Invoices, Charges and Customers, and create the webhook endpoint DataPocket uses. It can't create charges or refunds. ## Related - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [DataPocket vs DataFast](https://datapocket.vo1d.studio/compare/datafast) - [Install DataPocket on Next.js](https://datapocket.vo1d.studio/docs/nextjs) - [All guides](https://datapocket.vo1d.studio/guides) --- # How to see traffic from ChatGPT, Perplexity and other AI assistants Measure two things. Visitors who click a link in an AI answer arrive with a referrer such as chatgpt.com or perplexity.ai (or `utm_source=chatgpt.com`); DataPocket groups them into an AI channel, with their revenue. The assistants' own page fetches don't run JavaScript, so a few lines of server code report them, split into AI answers, search indexing and model training. What this guide answers: - How do you measure visitors sent by AI answers? - Which pages do AI assistants read? - How do you get recommended by AI assistants more often? ## How do you measure visitors sent by AI answers? When someone clicks a link in an assistant's answer, their browser sends a referrer, and ChatGPT also adds `utm_source=chatgpt.com` to many links. DataPocket recognizes these and puts the visit in the AI channel, next to organic search, social and the rest: - ChatGPT (chatgpt.com, chat.openai.com) - Perplexity (perplexity.ai) - Claude (claude.ai) - Gemini (gemini.google.com) - Copilot (copilot.microsoft.com) - DeepSeek, Grok, Meta AI, Mistral, Kimi, Poe, Phind and You.com ![AI referral visits with a chatgpt.com or perplexity.ai referrer land in the AI channel, while AI crawler page fetches are reported from your server](https://datapocket.vo1d.studio/guides/chatgpt-traffic/ai-referral-visits-vs-ai-crawler-fetches.svg) In Google Analytics 4 these visits arrive as ordinary referrals or as Direct, with no AI channel of their own: [DataPocket vs Google Analytics 4](https://datapocket.vo1d.studio/compare/google-analytics) covers the other differences. No setup beyond the normal script tag. With payments connected, the AI channel shows the revenue those visitors bring, so you can see whether being recommended turns into customers. > **See which pages ChatGPT reads before it answers** Assistants fetch your pages from their servers without running JavaScript. One server call per bot request shows GPTBot, ChatGPT-User, ClaudeBot and PerplexityBot by page. [Set up AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) ## Which pages do AI assistants read? Before an assistant answers a question about you, it often fetches your pages. Those requests come from the assistant's servers, don't run JavaScript and never show up in a script-based analytics tool. Report them from your server with one call per bot request: snippets for Next.js, Express, Astro, Cloudflare Workers and plain HTTP are in [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots). The dashboard splits them into AI answers (fetched to answer someone right now), search and answer-engine indexing, and model training, with the pages each one read. Only the user agent, path and status code are stored. ## How do you get recommended by AI assistants more often? - Answer the question in the first two sentences of the page. That's the part assistants quote. - Allow AI crawlers in robots.txt and publish an `/llms.txt` summary. - Write comparison and how-to pages for the questions your customers actually ask. - Watch which pages the assistants fetch and which ones send visitors, then write more like them. ## Questions ### Why doesn't my analytics show ChatGPT traffic? Some tools file it under Referral or Direct. Some AI apps also send no referrer at all, and those visits look like Direct in every analytics tool. DataPocket gives AI assistants their own channel, by referrer domain and by `utm_source`. ### Can I see answers that mention my site without a click? No analytics tool can. You can see the assistant fetching your pages (with the server snippet) and the visitors who click through. ## Related - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) - [How to see which traffic sources make money](https://datapocket.vo1d.studio/guides/revenue-by-traffic-source) - [DataPocket vs Plausible](https://datapocket.vo1d.studio/compare/plausible) - [All guides](https://datapocket.vo1d.studio/guides) --- # SEO score, Core Web Vitals and missing pages, from your own traffic DataPocket audits your most-visited pages daily and scores them out of 100 for indexing, content and performance. Problems on busy pages count for more than problems on pages nobody opens. The tracking script also measures Core Web Vitals in visitors' browsers and reports missing pages, so the score reflects what real visitors and crawlers run into. What this guide answers: - What does the audit check? - How are Core Web Vitals measured from real visitors? - How are missing pages and broken links found? ## What does the audit check? Once a day DataPocket fetches up to 25 of your most visited pages from its own server, with the user agent `DataPocketSEO`, and checks what a search engine sees: - Indexing: HTTP status, redirects, `noindex` in meta tags and the X-Robots-Tag header, robots.txt rules for Googlebot, canonical URLs, sitemap coverage, and whether http:// redirects to https://. - Content: title and meta description (missing, duplicated, too long), H1 headings, mobile viewport, language, social previews (Open Graph), image alt text, structured data, and pages whose HTML has almost no text. - Performance: Core Web Vitals from your visitors, Lighthouse lab scores from Google PageSpeed Insights for the three most visited pages, server response time and HTML size. Each problem takes points off its category, weighted 70% by the share of visits on the pages it affects and 30% by how many pages it affects. The overall score is 40% indexing, 35% content and 25% performance. ![Diagram of the DataPocket SEO score: indexing, content and performance checks on your most visited pages combine into one score out of 100, weighted by traffic](https://datapocket.vo1d.studio/guides/seo-audit/traffic-weighted-seo-score-inputs.svg) ## How are Core Web Vitals measured from real visitors? The tracking script measures Largest Contentful Paint, Interaction to Next Paint, Cumulative Layout Shift, First Contentful Paint and Time to First Byte on every page load and sends them once, when the visitor leaves the page. They're stored separately from pageviews and shown at the 75th percentile, the way Google judges them: LCP under 2.5 s, INP under 200 ms and CLS under 0.1 are good. Nothing to install. To turn it off, add `data-disable-vitals="true"` to the script tag. ## How are missing pages and broken links found? Browsers tell the script the HTTP status of the page they loaded, so visits to 404 pages are counted with where they came from: a link on one of your own pages, another site, or a typed or bookmarked URL. Single-page apps that render a not-found view without a 404 status can mark it: ```html ``` With [bot reporting](https://datapocket.vo1d.studio/docs/ai-bots) set up, the SEO page also shows which pages Googlebot and AI crawlers fetched in the last 30 days, and which missing pages crawlers keep asking for. ## Questions ### Does the audit put load on my site? No: about 30 requests a day (pages, robots.txt and the sitemap), three at a time. Requests come from DataPocket's server with the user agent DataPocketSEO. ### Why does my score differ from Lighthouse? Lighthouse tests one page in a lab. DataPocket's score covers the pages people actually visit, weights them by traffic, and uses your visitors' measured speed when there's enough of it. ### Do I need a Google account? No. PageSpeed Insights is called by DataPocket's server; nothing to connect. ## Related - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) - [How to see traffic from ChatGPT, Perplexity and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic) - [Install guides](https://datapocket.vo1d.studio/docs) - [All guides](https://datapocket.vo1d.studio/guides) --- # Tracking script reference Load `script.js` with `data-site-id` and `data-domain`; everything else is optional. Call `window.datapocket(name, props)` for goals: names and property keys are lowercase `[a-z0-9_-]`, at most 10 properties, values cut to 255 characters. For a script that never changes, load a pinned version such as `script@1.0.2.js` with its published `integrity` hash. ## Script files | File | Use it when | |---|---| | `script.js` | The default. A first-party cookie (`dp_vid`) recognizes returning visitors for a year, which gives the most accurate attribution. | | `script.hash.js` | Your app routes with the URL hash (`/#/settings`): hash changes count as pageviews and the hash is part of the path. | | `script.cookieless.js` | You can't set cookies. See [cookieless mode](#cookieless-mode) for what you give up. | | `script@1.0.2.js` (and `script.hash@…`, `script.cookieless@…`) | You want a file that never changes, to pin with Subresource Integrity. See [pinned versions](#pinned-versions). | All of them are served from `https://datapocket.vo1d.studio/js/`, or from your own domain through a [first-party proxy](https://datapocket.vo1d.studio/reference/first-party-proxy). ## Bot traffic DataPocket drops automated traffic before it reaches your numbers and counts what it dropped, so the Bots card shows "Filtered bot traffic" with the reason for each hit: | Reason | What it catches | |---|---| | Crawlers and tools | Known bot user agents, and headless or automated browsers (Puppeteer, Playwright, Selenium, `navigator.webdriver`). | | Data centers | Visitors whose network is a cloud or hosting provider (AWS, Google Cloud, Azure, Hetzner, OVH, DigitalOcean…). iCloud Private Relay, Cloudflare WARP and corporate security gateways such as Zscaler are never treated as data centers. | | Scripts | Requests sent straight to DataPocket without the headers every browser adds (`Sec-Fetch-*` and `Accept-Language`). | | Bursts | One address and browser starting many new visitors for your site within minutes, a bot that clears its cookies on every page. | | Prerendering | Pages the browser loaded in advance but never showed. From script 1.0.2 a prerendered page counts when it's shown. | If your visitors reach your site through a VPN that runs on a cloud provider, turn off the data-center filter under Settings → Tracking. Crawlers that never run the script, such as GPTBot, ClaudeBot and PerplexityBot, are counted separately when your server reports them: see [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots). ## Attributes | Attribute | What it does | |---|---| | `data-site-id` | Required. Your site's public id, from its Install page. | | `data-domain` | Required. Your domain without `www.`. Cookies are set on it, so subdomains share one visitor. | | `data-allowed-hostnames` | Other domains you own, comma-separated. Links to them carry the visitor along, so a journey across domains stays one visitor (not in cookieless mode). | | `data-exclude` | Paths where nothing is sent, comma-separated. See [excluding pages](#excluding-pages). | | `data-query-params` | Query parameters to send besides the defaults, comma-separated (`page,plan`), or `*` for all of them. See [what leaves the browser](#what-leaves-the-browser). | | `data-api` | Send events to this URL instead of next to the script. Useful when your proxy serves the script and the event endpoint from different paths. | | `data-disable-vitals="true"` | Don't measure Core Web Vitals. | | `data-disable-payments="true"` | Don't read checkout return parameters (`session_id`, `checkout_id`, `order_id`) from the URL. | | `data-debug="true"` | Log every event to the console, and track inside iframes (skipped otherwise). | | `data-allow-localhost="true"` | Track on localhost and `*.local` (skipped otherwise). | | `data-allow-file-protocol="true"` | Track pages opened from `file://`. | To stop tracking your own visits in one browser, run `localStorage.setItem("dp_ignore", "true")` in its console. ## JavaScript API ```js window.datapocket(name, properties) window.datapocket("signup", { plan: "pro", source: "onboarding" }) ``` - `name`: the goal. It's lowercased, spaces become `_`, characters other than `a-z 0-9 _ - :` are removed and it's cut to 64 characters. `payment` and `identify` are reserved (below). - `properties`: optional. Keys are lowercased and must match `[a-z0-9_-]{1,64}`; at most 10; values are turned into strings and cut to 255 characters. - An invalid key or an 11th property drops the whole call, with a warning in the console and nothing sent. - `window.datapocket.version` is the script's version. `window.datapocket.visitorId` is set in cookieless mode once the first event has been answered. Goals without JavaScript: `data-dp-goal="signup"` on any element counts a click, with `data-dp-goal-="value"` attributes as properties; `data-dp-scroll="pricing_seen"` counts when the element scrolls into view (`data-dp-scroll-threshold`, 0 to 1, default 0.5; `data-dp-scroll-delay` in milliseconds). ## Calling it before the script loads The script loads with `defer`, so an inline script or your app's entry may run first. Define this queue before your first call; the script sends everything queued as soon as it runs: ```html ``` ## Identify and payment - `datapocket("identify", { user_id: "u_123", name: "Ada", email: "ada@example.com" })` links the visitor to your user, so payments your server reports by email or customer id find their visitor. `user_id` is required; `name`, `email` and `image` are optional. Not available in cookieless mode. - `datapocket("payment", { transaction_id: "order_123" })` links this visitor to the payment your server reports to the [Payment API](https://datapocket.vo1d.studio/reference/rest-api) with the same `transaction_id`, in either order, within a day. Only the id is sent: no email, no amount. Anyone could send a call for an id they guess, so it's used only when one visitor alone sent it; passing `visitor_id` from your server is more reliable. (Older versions took an `email`; it's now ignored with a console warning.) ## What leaves the browser Each event carries the page URL, the referrer, the screen size, the browser's language and time zone, and the visitor and session ids. Query strings often carry secrets (password-reset and magic-link tokens, signed URLs), so the script trims what it sends: - Page URL: only `utm_*`, `ref`, `source`, `via` and ad click ids (`gclid`, `gbraid`, `wbraid`, `fbclid`, `msclkid`, `ttclid`, `twclid`, `li_fat_id`) are kept from the query. Add others with `data-query-params="page,plan"`, or send the whole query with `data-query-params="*"`. The hash is sent only for hash routes (`#/path`), without its own query. - Referrer and outbound links: origin and path only. - The server applies its own filter too: parameters named like secrets (`token`, `code`, `key`, `signature`, `password`, `redirect`, pre-signed `X-Amz-*` and `X-Goog-*`…) are never stored, even with `*`. - Cookies set by `script.js`: `dp_vid` (visitor, 1 year), `dp_vfs` (first visit, 1 year), `dp_vsn` (visit count, 1 year), `dp_sid` (session, 30 minutes, renewed on activity). First-party, `SameSite=Lax`, readable by your own code so you can pass `dp_vid` to your checkout. ## Excluding pages `data-exclude` takes a comma-separated list, checked before every event, so single-page app navigation is covered: | Pattern | Matches | Doesn't match | |---|---|---| | `/account` | `/account` only | `/account/billing`, `/accounts` | | `/account/*` | `/account/billing`, `/account/a/b` | `/account`, `/accounts` | | `/account*` | `/account`, `/account/billing`, `/accounts` | `/my/account` | Your dashboard's excluded paths (Settings → Tracking) use the same syntax and are applied on the server, so they also cover events sent by older copies of your page. ## Cookieless mode `script.cookieless.js` sets no cookies. The server derives the visitor id from a hash of the IP address, the user agent and a salt that changes every day, and keeps the session id in the tab's `sessionStorage`. What that costs: - A returning visitor is a new visitor every day, so multi-day attribution (the visit that found a customer last week) is weaker. - Each tab is its own session. - No `identify`, and no carrying visitors across your domains. - There is no `dp_vid` cookie to pass to the Payment API. Use `window.datapocket.visitorId` instead (set once the first event has been answered), or link the payment from the browser with `datapocket("payment", { transaction_id })`. ## Pinned versions `script.js` is updated in place. Each release is also published as a file that never changes, `/js/script@.js`, so you can pin it with Subresource Integrity. The browser then refuses to run the file if a single byte differs. Every release and its hash: [https://datapocket.vo1d.studio/js/sri.json](https://datapocket.vo1d.studio/js/sri.json). ```html ``` | File | integrity | |---|---| | `script@1.0.2.js` | `sha384-MsNyCZ/DPx8RAIgpvlbt3Xu5P4nLTNb3fkJL3M1m11GcXaefXQiun6R/11wdkd+N` | | `script.hash@1.0.2.js` | `sha384-klopDNmlO9zk9bfLkbcNq5leZVlLH85RuKf0xxb5e7WvAp+ikX3OV/yX0PRJcWqr` | | `script.cookieless@1.0.2.js` | `sha384-BCzLRGOeV+R7R7fespWD7sa9bfwS8W/5U2kwcXSwixWs1DGd444i9Img/ls4YXOQ` | A pinned file doesn't get fixes; check `sri.json` for newer versions now and then. Behind a first-party proxy, use the same file name through your proxy (`/dp/js/script@1.0.2.js`): the hash stays the same. ## Questions ### Can I use the script with a Content Security Policy? Yes. Allow the script's origin (or your own, when proxied) in `script-src` and the event endpoint in `connect-src`. With a pinned version you can also require its `integrity` hash. ### Is there an npm package? Not on the npm registry yet. Use the script tag, and the [REST API](https://datapocket.vo1d.studio/reference/rest-api) from your server. ## Related - [First-party proxy: what to forward](https://datapocket.vo1d.studio/reference/first-party-proxy) - [REST API: payments and goals](https://datapocket.vo1d.studio/reference/rest-api) - [Install guides](https://datapocket.vo1d.studio/docs) - [All reference](https://datapocket.vo1d.studio/reference) --- # First-party proxy: what to forward Forward the request body, the User-Agent and the visitor's IP in `X-Forwarded-For`, and nothing else: never the browser's `Cookie` header. DataPocket reads the visitor's IP from the right-most public address in the `X-Forwarded-For` your proxy sends, so a proxy that leaves it out makes every visitor appear to be at your server's location. ## What to forward | | Forward? | Why | |---|---|---| | Request body | Yes | The event itself (JSON, sent as `text/plain`). | | `User-Agent` | Yes | Browser, OS, device and bot filtering. | | `X-Forwarded-For` | Yes: the visitor's IP | City-level location. The IP is never stored. | | `Cookie` | No | Your visitors' cookies: auth sessions, other vendors' ids. DataPocket never reads them, and drops the header on `/api/event` if it arrives. | | `Authorization` | No | Same reason. | | `Accept-Language` and others | Not needed | The language comes from the event body. | A rewrite (`next.config.js` rewrites, a catch-all `proxy_pass` or `reverse_proxy` without header rules) forwards the browser's request as it is, cookies included, because the script's request is same-origin. Every guide's snippet forwards only the headers above: [Next.js](https://datapocket.vo1d.studio/docs/nextjs), [Express](https://datapocket.vo1d.studio/docs/express), [NGINX](https://datapocket.vo1d.studio/docs/nginx), [Caddy](https://datapocket.vo1d.studio/docs/caddy) and the others in the [install guides](https://datapocket.vo1d.studio/docs). ## How DataPocket reads the visitor's IP 1. The connecting address is the one Cloudflare reports (`CF-Connecting-IP`), trusted only on requests that really came through Cloudflare's network. For a proxied event that's your proxy server. 2. If the request carries `X-Forwarded-For`, the visitor is the right-most public address in it that isn't the connecting address. Private and invalid addresses are skipped. 3. Requests from Cloudflare Workers that didn't forward an IP get no location at all, rather than the Worker's own (which geolocates to Portland, Oregon). So the proxy must put the visitor's address in `X-Forwarded-For`. If your proxy itself sits behind a CDN or load balancer, read the visitor's IP from what that layer reports (for example `CF-Connecting-IP`, or your platform's `X-Forwarded-For`), not from the socket. ## Spoofed addresses Bot filtering works with a proxy too. Requests that arrive straight from a browser without `Sec-Fetch-*` and `Accept-Language` headers are treated as scripts, but proxied requests are judged by the visitor's address in `X-Forwarded-For`, so a proxy running on a cloud server is fine as long as it forwards that header. Anyone can send `X-Forwarded-For`. A claimed address changes only the location of the events that request sends, and the sender controls those events entirely anyway. Rate limits apply per connecting address as well as per claimed visitor (200 events per second per proxy, bursts to 4,000), so rotating claimed addresses doesn't get around them. Excluding an IP address in your settings matches the claimed address, so it's for your own office or test devices, not a security control. ## Check it works 1. Open your site with the browser's Network tab, find the POST to `/dp/api/event` and check it answers `{"ok":true}`. 2. On your Install page, the site switches to "Receiving data" within a few seconds. 3. In the live view, your own visit should show your city, not your server's. ## Questions ### Why does every visitor show the same city? The proxy isn't forwarding the visitor's IP, so DataPocket sees your server. Set `X-Forwarded-For` to the visitor's address, read from your platform's own header if the proxy is behind a CDN. ### Does the script work without a proxy? Yes. The proxy only gets past ad blockers that block third-party analytics domains. ## Related - [Tracking script reference](https://datapocket.vo1d.studio/reference/tracking-script) - [Install DataPocket on Next.js](https://datapocket.vo1d.studio/docs/nextjs) - [Install DataPocket on NGINX](https://datapocket.vo1d.studio/docs/nginx) - [All reference](https://datapocket.vo1d.studio/reference) --- # REST API: payments and goals Send payments with `POST /api/v1/payments` and goals with `POST /api/v1/goals`, authenticated with a site API key as `Authorization: Bearer dpk_…`. A payment needs `amount`, `currency` and `transaction_id`, which is the idempotency key: sending the same id again updates that payment instead of adding one. `visitor_id` is optional but is what attributes the sale. ## Authentication Create a key in your site's Settings → API keys. Site keys (`dpk_…`) belong to one site. Account tokens (`dpt_…`) need `site_id` (your site's public id) in the body or query. Writing needs a key with the write scope. ```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": ""}' ``` ## POST /api/v1/payments | Field | Required | Notes | |---|---|---| | `amount` | Yes | Number in major units (`29.99`, or `500` for 500 JPY), 0 to 1,000,000,000. `0` records a trial. | | `currency` | Yes | Three-letter ISO 4217 code, any case. | | `transaction_id` | Yes | 1 to 255 characters, unique per site. The idempotency key (below). | | `visitor_id` | No | The buyer's `dp_vid` cookie (or `window.datapocket.visitorId` in cookieless mode). 8 to 64 characters of `A-Z a-z 0-9 _ -`. | | `session_id` | No | The `dp_sid` cookie, to credit the session as well. | | `customer_id` | No | Your id for the customer. Later payments with the same id inherit the visitor of their first payment. | | `email`, `name` | No | The buyer. An email also matches a visitor you linked with `identify`. | | `renewal` | No | `true` for a subscription renewal. | | `refunded` | No | `true` marks the payment refunded; it stops counting as revenue. | | `timestamp` | No | ISO 8601 with offset (`2026-11-13T09:30:00Z`). Defaults to now. | | `site_id` | With account tokens | Your site's public id. | Response: `{"status": "success", "data": {"transaction_id": "order_123", "attributed": true}}`. `attributed` says whether a visitor was found. Remove a payment with `DELETE /api/v1/payments?transaction_id=order_123`. ## Idempotency - `transaction_id` identifies the payment within your site, for as long as the payment exists: there is no expiry window. - Sending the same id again updates the stored payment (amount, `refunded`, `renewal`, customer fields) instead of adding a second one, so retries are safe. The purchase date stays the first one unless you mark a refund. - The first visitor to be attributed stays: a later request with a different `visitor_id` doesn't move the sale. The one exception is a credit that came from a browser `datapocket("payment")` call, which your server's `visitor_id` replaces. ## Currencies Amounts are converted to your site's currency with the European Central Bank's reference rates for the payment's date, and the original amount and currency are kept as well. ECB publishes rates for about 30 major currencies; a payment in a currency it doesn't cover is kept with its original amount but left out of revenue until a rate is available, so send those in your site's currency. Zero-decimal currencies (JPY, KRW, CLP, VND…) are handled: send the amount as you'd show it. ## How a payment finds its visitor 1. `visitor_id` in the request. 2. An earlier payment with the same `customer_id`. 3. `datapocket("payment", { transaction_id })` called in the buyer's browser with the same `transaction_id`, up to a day before the request or an hour after. Browser calls can't be verified, so this counts only when a single visitor sent it for that transaction: if a second, different visitor sends one within the window, the credit is withdrawn and the payment stays unattributed. A `visitor_id` your server sends later replaces a credit that came from a browser call. 4. An `identify` call with the same `email`. Without any of these the payment still counts in your revenue, as unattributed. `visitor_id` from your server is the reliable way; the browser call is a fallback for checkouts where your server can't read the buyer's cookie. ## POST /api/v1/goals Records a goal for a visitor from your server: a conversion that completes in a webhook, or on a page where the script is excluded. The goal takes the location, device and attribution of the visitor's latest pageview, so the visitor needs at least one tracked visit. ```bash curl -X POST https://datapocket.vo1d.studio/api/v1/goals \ -H "Authorization: Bearer dpk_…" \ -H "Content-Type: application/json" \ -d '{"visitor_id": "", "name": "ticket_purchased", "metadata": {"event": "spring-gala", "seats": 2}}' ``` | Field | Required | Notes | |---|---|---| | `visitor_id` | Yes | As for payments. | | `name` | Yes | 1 to 64 characters; normalized like browser goals. `payment` and `identify` are reserved. | | `metadata` | No | Up to 10 properties; keys `[a-z0-9_-]{1,64}`, values strings, numbers or booleans, stored as text up to 255 characters. | | `site_id` | With account tokens | Your site's public id. | Response: `{"status": "success", "data": {"name": "ticket_purchased"}}`. A visitor with no tracked pageview gets 404. ## Errors and limits Errors share one shape: `{"status": "error", "error": {"code": 400, "message": "currency: Invalid"}}`. Validation messages name each failing field. | Status | When | |---|---| | 400 | The body isn't JSON, a field is missing or invalid, a reserved goal name, or `site_id` missing with an account token. | | 401 | Missing or invalid API key. | | 403 | The key is read-only. | | 404 | No site for this key, no payment with that `transaction_id` (DELETE), or no tracked visit for the goal's visitor. | | 429 | More than 3 requests per second per key on average (bursts up to 120). Retry after a short wait. | ## Questions ### Is visitor_id required? No. Without it the payment counts as unattributed revenue unless DataPocket can find the visitor another way (customer id, a browser hint with the same transaction id, or an identified email). ### Is there an SDK? Not on the npm registry yet. The API is plain JSON over HTTPS, so any HTTP client works. ## Related - [Read API: stats, visitors, funnels and insights](https://datapocket.vo1d.studio/reference/read-api) - [Tracking script reference](https://datapocket.vo1d.studio/reference/tracking-script) - [Track Stripe revenue by traffic source](https://datapocket.vo1d.studio/guides/stripe-revenue-attribution) - [All reference](https://datapocket.vo1d.studio/reference) --- # Read API: stats, visitors, funnels and insights Call `GET /api/v1/stats/overview`, `/stats/breakdown?dim=source` and the other read endpoints with `Authorization: Bearer dpk_…` (or an account token `dpt_…` plus `site_id`). They take the dashboard's `period`, `from`/`to`, `g` and `f` parameters and answer `{"status": "success", "data": …}`. Any team member's key with the read scope works; keys are read-only by default. ## Authentication Every endpoint is `GET` and needs a key with the read scope (all keys have it). A site key (`dpk_…`) reads its own site. An account token (`dpt_…`) reads any site you're a member of: pass the site's public id as `?site_id=dp_…`, and list them with `GET /api/v1/sites`. Your membership and role are checked on every request, so a key stops working on a site as soon as you leave it. Keys see what the dashboard shows any team member, viewers included. ```bash curl https://datapocket.vo1d.studio/api/v1/stats/overview?period=7d \ -H "Authorization: Bearer dpk_…" ``` ## Untrusted text in responses Page paths, referrers, UTM values, goal names and properties, link targets, visitor identity names and emails, annotation text and parts of insight findings come from your visitors' browsers or your own calls, and anyone can put any text in them. They're returned as separate JSON fields and never joined into sentences, but if you hand responses to an AI model, treat those fields as data, not instructions. ## Period and filters Endpoints that read a period take the same parameters as the dashboard URL. Invalid values are a 400 with a message, never a silent fallback. | Parameter | Notes | |---|---| | `period` | `now`, `today`, `yesterday`, `24h`, `7d`, `30d` (default), `wtd`, `mtd`, `90d`, `180d`, `12m`, `ytd`, `all`, or `custom`. Periods are in the site's timezone. | | `from`, `to` | `YYYY-MM-DD`, inclusive, for `period=custom` (`from` alone implies it; `to` defaults to `from`). At most 1,098 days. | | `g` | Bucket size for series: `minute`, `hour`, `day`, `week`, `month`. Ignored when the period doesn't allow it; `range.allowed_granularities` in the response says which do. | | `f` | Filters as `dim:op:value`, several values joined with `|`, several filters with `,` (at most 20). Operators `is`, `is_not`, `contains`, `not_contains`. URI-encode values that contain `,` `:` `|`. Example: `f=country:is:US|DE,page:contains:%2Fblog`. | Filter dimensions: `channel`, `source`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`, `ref`, `via`, `country`, `region`, `city`, `browser`, `os`, `device`, `hostname`, `page`, `entry_page`, `exit_page`, `goal`, `visit_count`, `goal_prop` (`goal:key=value`). Responses for a period carry `range`: `period`, `label`, `from` and `to` (ISO 8601, `to` exclusive), `granularity`, `allowed_granularities` and `timezone`. Money is in the site's `currency`, in its ISO minor units (cents for USD and EUR, yen for JPY, fils for KWD). ## Endpoints | Endpoint | Returns | |---|---| | `GET /api/v1/sites` | Sites the key can read: `site_id`, `name`, `domain`, `timezone`, `currency`, `role`. One site for a site key. | | `GET /api/v1/site` | The same fields for one site. | | `GET /api/v1/stats/overview` | Visitors, visits, pageviews, bounce rate, visit duration, revenue, customers and conversion rate for the period, with the previous period and the number online now. | | `GET /api/v1/stats/timeseries` | The same metrics per bucket (`g`). | | `GET /api/v1/stats/breakdown?dim=source` | Top values of one dimension (the filter dimensions except `goal`, `visit_count`, `goal_prop`). `limit` 1-500 (default 10), `sort=visitors|revenue`, `search`. | | `GET /api/v1/stats/goals` | Goals with visitors, completions and conversion rate. `limit` 1-200 (default 50). For a goal over time use `/stats/timeseries?f=goal:is:signup`. | | `GET /api/v1/stats/goal-properties?goal=signup` | Up to 10 property keys of a goal with their 10 most common values. | | `GET /api/v1/stats/funnels` | Saved funnels and their steps. | | `GET /api/v1/stats/funnels/{id}` | Visitors at each step of one funnel in the period. | | `GET /api/v1/stats/visitors` | Visitors active in the period, latest first, with identity when known. `goal`, `customers=1`, `search`, `limit` 1-200 (default 25), `offset`; page while `more` is true. | | `GET /api/v1/stats/journeys?goal=signup` | Visitors who completed a goal and how long it took. `limit` 1-100 (default 20). | | `GET /api/v1/stats/goal-users` | Visitors who completed the most goals. `limit` 1-100 (default 20). | | `GET /api/v1/stats/exit-links` | Outbound links clicked. `limit` 1-500 (default 10). | | `GET /api/v1/stats/bots?category=answer` | Crawler hits per category (`answer`, `index`, `training`, `other`) and the top 12 providers and pages of one. | | `GET /api/v1/stats/realtime` | Visitors active in the last 5 minutes, the latest 40 events, top sources, countries and devices. No period. | | `GET /api/v1/annotations` | Chart notes and uptime outages on days in the period (up to 200). | | `GET /api/v1/insights` | The latest insights report as your team sees it, findings marked `dismissed` where hidden. `data` is null before the first report. Reading never starts an analysis. | ```bash curl "https://datapocket.vo1d.studio/api/v1/stats/breakdown?dim=utm_campaign&period=custom&from=2026-10-01&to=2026-10-31&sort=revenue&limit=20&site_id=dp_…" \ -H "Authorization: Bearer dpt_…" ``` ## GET /api/v1/sites ```json {"status": "success", "data": {"sites": [{"site_id": "dp_ab12cd34", "name": "Shop", "domain": "shop.example", "timezone": "Europe/Berlin", "currency": "EUR", "role": "owner"}]}} ``` ## Errors and limits Errors share the write API's shape: `{"status": "error", "error": {"code": 400, "message": "dim must be one of: …"}}`. | Status | When | |---|---| | 400 | A parameter is invalid, a required one (`dim`, `goal`) is missing, or `site_id` is missing with an account token. | | 401 | Missing or invalid API key. | | 403 | The key has no read scope. | | 404 | No site for this key (or you're no longer a member), or no funnel with that id. | | 429 | More than 3 requests per second per key on average (bursts up to 120), shared with the write endpoints. | | 500 | The query failed. Retry later. | No list is longer than 500 rows, and defaults are small: ask for more with `limit`. ## Questions ### Can a key read every site I have? An account token (`dpt_…`) can, one site per request with `site_id`. A site key reads only its site. ### Can a viewer's key read visitors and insights? Yes. A key reads what its owner sees in the dashboard, and every team member, viewers included, sees visitors and insights there. ## Related - [MCP server: your analytics in Claude, Cursor and other AI assistants](https://datapocket.vo1d.studio/reference/mcp) - [REST API: payments and goals](https://datapocket.vo1d.studio/reference/rest-api) - [Tracking script reference](https://datapocket.vo1d.studio/reference/tracking-script) - [All reference](https://datapocket.vo1d.studio/reference) --- # MCP server: your analytics in Claude, Cursor and other AI assistants DataPocket runs a remote MCP server at `https://datapocket.vo1d.studio/api/mcp` (Streamable HTTP). On claude.ai, add it as a custom connector with that URL, sign in to DataPocket and choose which websites to share. Clients that send headers can use a read-only API key instead, for example `claude mcp add --transport http datapocket https://datapocket.vo1d.studio/api/mcp --header "Authorization: Bearer dpk_…"`. The assistant gets 17 read-only tools over the same data and rules as the read API. ## Connect from claude.ai (sign in, no key) 1. On claude.ai (or Claude Desktop), open Settings → Connectors and choose Add custom connector. 2. Enter the URL `https://datapocket.vo1d.studio/api/mcp` and add it. Leave the OAuth client fields empty. 3. Click Connect. DataPocket opens: sign in, tick the websites the assistant may read, and choose Allow. The connection is read-only and limited to the websites you ticked. Your current membership and role are still checked on every call, so leaving a website ends its access. See and disconnect connected apps under Account → Connected apps; changing your password disconnects them all. Other MCP clients that support OAuth (dynamic client registration or client ID metadata documents, PKCE) connect the same way. ## Connect with an API key 1. In your website's Settings, under API keys, create a key with Read-only access. A site key (`dpk_…`) reads that site; an account token (`dpt_…`) reads every site you're a member of. 2. Add the server to your assistant with the key in the `Authorization` header (below). 3. Ask a question, such as "Which campaigns brought paying customers last month?". The assistant picks the tools. Claude Code: ```bash claude mcp add --transport http datapocket https://datapocket.vo1d.studio/api/mcp \ --header "Authorization: Bearer dpk_…" ``` Cursor (`~/.cursor/mcp.json`), Claude Desktop and other clients that take a JSON config with remote servers: ```json { "mcpServers": { "datapocket": { "type": "http", "url": "https://datapocket.vo1d.studio/api/mcp", "headers": { "Authorization": "Bearer dpk_…" } } } } ``` Keep the key out of shared config files: most clients can read it from an environment variable. ## Tools Every tool is read-only. Site tools take an optional `site_id` (from `list_sites`): required with an account token, optional with a site key. Tools over a period take `period` (or `from`/`to`) and `filters`, an array of `{dim, op, values}` objects with the read API's dimensions and operators. | Tool | Returns | Read API equivalent | |---|---|---| | `list_sites` | Sites the key can read. | `/api/v1/sites` | | `get_site` | Name, domain, timezone, currency, your role. | `/api/v1/site` | | `get_overview` | Headline KPIs with the previous period. | `/stats/overview` | | `get_timeseries` | KPIs per bucket (`granularity`). | `/stats/timeseries` | | `get_breakdown` | Top values of one dimension (`dim`, `sort`, `search`, `limit`). | `/stats/breakdown` | | `get_goals` | Goals with visitors, completions, conversion rate. | `/stats/goals` | | `get_goal_properties` | A goal's property keys and top values. | `/stats/goal-properties` | | `list_funnels` | Saved funnels and their steps. | `/stats/funnels` | | `get_funnel` | Visitors at each step of one funnel. | `/stats/funnels/{id}` | | `list_visitors` | Visitors in the period with identity when known. | `/stats/visitors` | | `get_goal_journeys` | Who completed a goal and how long it took. | `/stats/journeys` | | `get_goal_users` | Visitors who completed the most goals. | `/stats/goal-users` | | `get_exit_links` | Outbound links clicked. | `/stats/exit-links` | | `get_bot_traffic` | Crawler hits by category, top providers and pages. | `/stats/bots` | | `get_realtime` | Visitors in the last 5 minutes and the latest events. | `/stats/realtime` | | `list_annotations` | Chart notes and uptime outages. | `/annotations` | | `get_insights` | The latest insights report. Never starts an analysis. | `/insights` | Results come as JSON text and as `structuredContent`. Unlike the read API, money fields (`revenue`, `refunds`, `spent`…) are converted to major units of the site's currency, and results say so with `currency` and `money_unit: "major"`. ## Visitor-supplied text Page paths, referrers, UTM values, goal names and properties, link targets, visitor names and emails, annotation text and the `subjects` of insight findings come from browsers and API calls, so anyone can put any text in them, including text written to steer an AI. The server tells the assistant, in its instructions and in each tool's description, to treat those fields as data and never as instructions. Values are returned as they were stored (with invisible and control characters already removed at ingest), never rewritten. The tools can't change anything, so the worst a planted instruction can do is mislead an answer: check surprising claims in the dashboard. ## Access, limits and errors - Same keys and rules as the read API: your current membership and role are checked on every tool call, and a key you revoke stops working at once. OAuth connections work only here, not on the REST API, and only for the websites you approved; their access tokens last an hour and are refreshed automatically. - Tool calls share the read API's per-key rate limit. One request carries at most 10 tool calls. - Results are capped at about 50,000 characters; when a list is shortened, `truncated` names it with how many items were kept. Narrow the period, add filters or lower `limit` for the rest. - Missing or invalid credentials are HTTP 401 with a `WWW-Authenticate: Bearer` challenge pointing at the OAuth metadata (`resource_metadata`), which is how OAuth clients discover sign-in. A site you can't read, a bad argument or a failed query comes back as a tool error the assistant can read and correct. - The server is stateless and answers in JSON (protocol versions 2025-11-25, 2025-06-18 and 2025-03-26). It offers no SSE stream, resources or prompts. ## Questions ### Can the assistant change my data? No. Every tool reads, none writes, and a read-only key couldn't write even if one did. ### Does it work with claude.ai web connectors? Yes. Add a custom connector with the server URL, sign in to DataPocket and choose the websites to share. No API key needed. ### Which websites can a claude.ai connection read? Only the ones you ticked when you connected, and only while you're still a member. To change the selection, disconnect it under Account → Connected apps and connect again. ### Which key should I use? A read-only site key for one website. An account token if you want the assistant to compare several of your sites. ## Related - [Read API: stats, visitors, funnels and insights](https://datapocket.vo1d.studio/reference/read-api) - [REST API: payments and goals](https://datapocket.vo1d.studio/reference/rest-api) - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) - [All reference](https://datapocket.vo1d.studio/reference) --- # AI crawler tracking: see which AI bots read your site To see GPTBot, ClaudeBot, PerplexityBot and ChatGPT-User on your site, report them from your server: they fetch HTML without running JavaScript, so script-based analytics, Google Analytics 4 included, never sees them. Add one non-blocking call per bot request (snippets below), and DataPocket sorts each visit into AI answers, search indexing or model training, with the pages each bot read. It recognizes 53 user-agent tokens from 34 providers. DataPocket stores only the bot's user agent, the path and the status code. No IP addresses, cookies or headers. Replace `YOUR_SITE_ID` with the site ID from your Install page. ## Next.js Add this to middleware.ts (next to app/ or pages/): ```ts import { NextResponse, type NextFetchEvent, type NextRequest } from "next/server"; const BOTS = /bot|crawl|spider|-user|google-|facebookexternalhit|cohere|diffbot/i; export function middleware(req: NextRequest, ev: NextFetchEvent) { const ua = req.headers.get("user-agent") ?? ""; if (BOTS.test(ua)) { ev.waitUntil(fetch("https://datapocket.vo1d.studio/api/crawl", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site_id: "YOUR_SITE_ID", user_agent: ua, path: req.nextUrl.pathname }), }).catch(() => {})); } return NextResponse.next(); } export const config = { matcher: ["/((?!_next/|api/|favicon.ico).*)"] }; ``` ## Express Add this to before your routes: ```js const BOTS = /bot|crawl|spider|-user|google-|facebookexternalhit|cohere|diffbot/i; app.use((req, res, next) => { const ua = req.get("user-agent") || ""; if (BOTS.test(ua)) { res.on("finish", () => { fetch("https://datapocket.vo1d.studio/api/crawl", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site_id: "YOUR_SITE_ID", user_agent: ua, path: req.originalUrl, status: res.statusCode }), }).catch(() => {}); }); } next(); }); ``` ## Astro Add this to src/middleware.ts (pages rendered on demand): ```ts import { defineMiddleware } from "astro:middleware"; const BOTS = /bot|crawl|spider|-user|google-|facebookexternalhit|cohere|diffbot/i; export const onRequest = defineMiddleware(async (ctx, next) => { const res = await next(); const ua = ctx.request.headers.get("user-agent") ?? ""; if (BOTS.test(ua)) { fetch("https://datapocket.vo1d.studio/api/crawl", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site_id: "YOUR_SITE_ID", user_agent: ua, path: ctx.url.pathname, status: res.status }), }).catch(() => {}); } return res; }); ``` ## Cloudflare Worker Add this to a Worker on your site's route (works for static sites too): ```js const BOTS = /bot|crawl|spider|-user|google-|facebookexternalhit|cohere|diffbot/i; export default { async fetch(request, env, ctx) { const res = await fetch(request); const ua = request.headers.get("user-agent") || ""; if (BOTS.test(ua)) { ctx.waitUntil(fetch("https://datapocket.vo1d.studio/api/crawl", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ site_id: "YOUR_SITE_ID", user_agent: ua, path: new URL(request.url).pathname, status: res.status }), })); } return res; }, }; ``` ## Any server Add this to one request per bot visit, or up to 100 in "hits": ```bash curl -X POST https://datapocket.vo1d.studio/api/crawl \ -H "Content-Type: application/json" \ -d '{"site_id": "YOUR_SITE_ID", "user_agent": "Mozilla/5.0 (compatible; GPTBot/1.2; +https://openai.com/gptbot)", "path": "/pricing", "status": 200}' ``` ## What are the ways to track AI crawlers? Every method reads the request on the server side, because crawlers never run the JavaScript that browser analytics depends on. They differ in where the data comes from, how long it's kept and what else you get with it (checked December 4, 2026): - **Your server or CDN logs.** Free and complete: every request is there with its user agent and IP. You need access to the logs and something to parse them, and managed hosts often keep them only briefly or send them out through a paid log drain. - **Cloudflare AI Crawl Control**, if your site runs behind Cloudflare ([docs](https://developers.cloudflare.com/ai-crawl-control/)). It's on every plan including Free, needs no code, and can also block or allow each crawler. On the Free plan detection uses the user agent and the metrics cover the past 24 hours; longer windows come with Enterprise Bot Management. - **AI search visibility platforms** such as [Profound's Agent Analytics](https://docs.tryprofound.com/agent-analytics/overview). They import logs from your CDN or host (CloudFront, Cloudflare Logpush, Fastly, Netlify and others), check crawlers against the vendors' published IP ranges, and tie crawling to how often you appear in AI answers. They're commercial products built for that wider job. - **DataPocket.** One non-blocking call from your server per bot request, on any host or framework. It's free, keeps bot hits for 2 years, sorts them into AI answers, indexing and training, and shows them next to your visitors, AI referral traffic and revenue in one dashboard. It matches by user agent only and doesn't block anything. ## How do you check that it works? 1. Deploy, then request a page as a crawler: `curl -A "GPTBot/1.2" https://yoursite.com/`. 2. Within a minute the bot traffic card on your dashboard shows the hit under Training. Until the first hit arrives it says "No bot traffic recorded yet". 3. Nothing there? Check your server logs for the POST to `/api/crawl`. A recorded hit answers `{"ok":true,"recorded":1}`; a user agent that isn't a known crawler answers `"recorded":0`. ## What does the dashboard show? - Hits per category: AI answers (fetched because someone asked an assistant just now), Indexing (search and answer engines refreshing their index), Training (pages collected for model training) and Other (link previews). - Within a category, the providers that visited most and the user agents they used, with a chart over time. - The pages each category read most, with the top providers per page. Pages that AI answers fetch are the ones assistants use to talk about you. - With [the SEO audit](https://datapocket.vo1d.studio/guides/seo-audit), which pages Googlebot and AI crawlers fetched in the last 30 days and which missing pages crawlers keep asking for (send the status code to get these). ## Can a bot fake its user agent? Yes. Any client can send `GPTBot` as its user agent, and DataPocket matches by user agent only, so the counts are what bots reported, not verified. Some vendors publish the IP ranges their crawlers use: OpenAI lists them for [GPTBot](https://openai.com/gptbot.json), [OAI-SearchBot](https://openai.com/searchbot.json) and [ChatGPT-User](https://openai.com/chatgpt-user.json) (checked November 23, 2026). If you need certainty for one bot, check the request IP against its list in your server before reporting the hit. To keep forged reports from filling a dashboard, each site records at most 1,000,000 bot hits a month, and one sender can use at most 100,000 of them. ## How is this different from visitors sent by ChatGPT? Crawler hits are the assistant's own servers reading your pages. Visitors who click a link in an AI answer are people, and the normal tracking script already counts them in the AI channel with their revenue. [How to see traffic from ChatGPT and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic) covers that side. ## Which crawlers are recognized Matched by user-agent token. A bot can claim any user agent, so treat counts as reported, not verified. - **AI answers**: Meta AI (meta-externalfetcher); Gemini (Google-NotebookLM, Google-Read-Aloud, Google-Agent); Perplexity (Perplexity-User); Grok (Grok-DeepSearch); Mistral (MistralAI-User); DuckDuckGo (DuckAssistBot); ChatGPT (ChatGPT-User); Claude (Claude-User); Amazon (Amzn-User); Kimi (Kimi-User); Qwen (Qwen-User) - **Indexing**: Google (Google-InspectionTool, Googlebot); Anthropic (Claude-SearchBot); Meta (meta-webindexer); Amazon (Amzn-SearchBot); OpenAI (OAI-SearchBot); Perplexity (PerplexityBot); TikTok (TikTokSpider); DuckDuckGo (DuckDuckBot); Baidu (Baiduspider); Yandex (YandexBot); Apple (Applebot); Petal (PetalBot); Bing (bingbot, msnbot); You.com (YouBot) - **Training**: Cohere (cohere-training-data-crawler, cohere-ai); Google (Google-CloudVertexBot, GoogleOther); Meta (meta-externalagent); Anthropic (anthropic-ai, ClaudeBot); DeepSeek (DeepSeekBot); ByteDance (Bytespider); Amazon (Amazonbot); OpenAI (GPTBot); Allen AI (AI2Bot); Common Crawl (CCBot) - **Other**: Facebook (facebookexternalhit, FacebookBot); LinkedIn (LinkedInBot); Telegram (TelegramBot); X (Twitterbot); Discord (Discordbot); OpenAI (OAI-AdsBot); Slack (Slackbot); Grok (GrokBot, xAI-Bot); Diffbot (Diffbot) ## Questions ### Does Google Analytics show GPTBot or ClaudeBot? No. GA4 is a JavaScript tag, and crawlers fetch HTML without running scripts, so their visits never reach it. Server logs or a server-side report like this one are the only places they show up. ### Will reporting bots slow my site down? No. The snippets send the report in the background (waitUntil, or a request that isn't awaited) so the page is never delayed. Ordinary browser requests don't match the snippets' pre-filter, so they never trigger a call. ### Does this block or allow AI crawlers? Neither. It only counts them. Whether a crawler may fetch a page is still set in your robots.txt. ### Which bots are tracked? 53 user-agent tokens from 34 providers, including GPTBot, OAI-SearchBot, ChatGPT-User, ClaudeBot, Claude-User, PerplexityBot, Perplexity-User, Googlebot, bingbot and Applebot. The full list is below. ### Does it cost anything? No. Bot reporting is part of DataPocket's free plan, like every other feature. ## Related - [How to see traffic from ChatGPT, Perplexity and other AI assistants](https://datapocket.vo1d.studio/guides/chatgpt-traffic) - [SEO score, Core Web Vitals and missing pages](https://datapocket.vo1d.studio/guides/seo-audit) - [Install DataPocket on Next.js](https://datapocket.vo1d.studio/docs/nextjs) - [All install guides](https://datapocket.vo1d.studio/docs) - [Home](https://datapocket.vo1d.studio) --- # Install DataPocket on Next.js App Router or Pages Router. Client-side navigations are tracked automatically. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. Proxy through your own domain with two route handlers. They forward only what DataPocket needs (the event, User-Agent and the visitor's IP), never your visitors' cookies; a rewrite in next.config.js would pass the Cookie header along with every event. Create app/dp/js/[file]/route.ts: ```ts const PD = "https://datapocket.vo1d.studio"; export async function GET(_req: Request, { params }: { params: Promise<{ file: string }> }) { const { file } = await params; if (!/^script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js$/.test(file)) return new Response(null, { status: 404 }); const r = await fetch(`${PD}/js/${file}`, { next: { revalidate: 3600 } }); return new Response(await r.text(), { status: r.status, headers: { "Content-Type": "application/javascript", "Cache-Control": "public, max-age=3600" }, }); } ``` 2. And app/dp/api/event/route.ts: ```ts const PD = "https://datapocket.vo1d.studio"; export async function POST(req: Request) { // the visitor's IP, as your host reports it (Vercel, Netlify and most proxies set X-Forwarded-For) const ip = (req.headers.get("x-real-ip") ?? req.headers.get("x-forwarded-for")?.split(",")[0] ?? "").trim(); const r = await fetch(`${PD}/api/event`, { method: "POST", body: await req.text(), headers: { "Content-Type": "text/plain", "User-Agent": req.headers.get("user-agent") ?? "", ...(ip ? { "X-Forwarded-For": ip } : {}), }, cache: "no-store", }); return new Response(await r.text(), { status: r.status, headers: { "Content-Type": "application/json" } }); } ``` 3. Pages Router only? Route handlers live in app/ and work next to pages/: add the two files above and keep the rest of your app as it is. 4. Add the script to your root layout (app/layout.tsx): ```tsx import Script from "next/script"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( ``` 2. Using (view transitions)? Nothing else to do: keep the tag in the shared layout so it's identical on every page, and each navigation is recorded as a pageview. Pages that don't use this layout need the same tag. 3. Optional, to get past ad blockers: proxy through your own domain. This needs on-demand rendering (an adapter such as @astrojs/node, Vercel, Netlify or Cloudflare). Create src/pages/dp/js/[file].ts: ```ts import type { APIRoute } from "astro"; export const prerender = false; export const GET: APIRoute = async ({ params }) => { if (!/^script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js$/.test(params.file ?? "")) return new Response(null, { status: 404 }); const r = await fetch(`https://datapocket.vo1d.studio/js/${params.file}`); return new Response(await r.text(), { headers: { "Content-Type": "application/javascript", "Cache-Control": "public, max-age=3600" }, }); }; ``` 4. And src/pages/dp/api/event.ts, which forwards each event with the visitor's IP so their location stays correct: ```ts import type { APIRoute } from "astro"; export const prerender = false; export const POST: APIRoute = async ({ request, clientAddress }) => { const r = await fetch("https://datapocket.vo1d.studio/api/event", { method: "POST", body: await request.text(), headers: { "Content-Type": "text/plain", "User-Agent": request.headers.get("user-agent") ?? "", "X-Forwarded-For": clientAddress, }, }); return new Response(await r.text(), { status: r.status, headers: { "Content-Type": "application/json" } }); }; ``` 5. Then load the script from your own domain in the layout instead (same attributes, new src): ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```js const session = await stripe.checkout.sessions.create({ // …your line_items, mode, success_url… metadata: { datapocket_visitor_id: req.cookies.dp_vid, datapocket_session_id: req.cookies.dp_sid, }, }); ``` 2. 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": ""}' ``` ## 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. - [React Router](https://datapocket.vo1d.studio/docs/react-router): Framework mode (Remix) and library mode. pushState navigations are tracked automatically. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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) --- # Install DataPocket on React Router Framework mode (Remix) and library mode. pushState navigations are tracked automatically. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Framework mode: add the script in app/root.tsx inside : ```tsx export function Layout({ children }: { children: React.ReactNode }) { return ( ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```js const session = await stripe.checkout.sessions.create({ // …your line_items, mode, success_url… metadata: { datapocket_visitor_id: req.cookies.dp_vid, datapocket_session_id: req.cookies.dp_sid, }, }); ``` 2. 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": ""}' ``` ## 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 - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [FastAPI](https://datapocket.vo1d.studio/docs/fastapi): Async proxy with httpx. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # 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 : ```html ``` 2. Hash-mode router (createWebHashHistory)? Use the hash build: ```html ``` 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": ""}' ``` ## 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 (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) --- # Install DataPocket on JavaScript apps React, Vue, Svelte or Angular: the script tag with typed calls, plus server-side payments and goals over HTTP. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. The datapocket npm package isn't on the npm registry yet, so `npm install datapocket` won't work. Add the script tag to index.html (or your framework's document head): ```html ``` 2. Call it from your code. This helper is typed and queues calls made before the script loads: ```ts // datapocket.ts type Props = Record; declare global { interface Window { datapocket?: ((name: string, props?: Props) => void) & { q?: unknown[]; visitorId?: string } } } export function track(name: string, props?: Props) { const w = window; w.datapocket = w.datapocket || Object.assign((...args: unknown[]) => { (w.datapocket!.q = w.datapocket!.q || []).push(args); }, {}); w.datapocket(name, props); } // later track("signup", { plan: "pro" }); ``` 3. Server-side (Node, Bun, Deno, edge): record payments and goals with fetch. Every field is in the REST API reference (/reference/rest-api): ```ts const DP = "https://datapocket.vo1d.studio/api/v1"; const headers = { Authorization: `Bearer ${process.env.DATAPOCKET_KEY}`, "Content-Type": "application/json" }; await fetch(`${DP}/payments`, { method: "POST", headers, body: JSON.stringify({ amount: 49, currency: "USD", transaction_id: order.id, visitor_id: cookies.dp_vid }) }); await fetch(`${DP}/goals`, { method: "POST", headers, body: JSON.stringify({ visitor_id: cookies.dp_vid, name: "trial_started" }) }); ``` ## 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 - [React Router](https://datapocket.vo1d.studio/docs/react-router): Framework mode (Remix) and library mode. pushState navigations are tracked automatically. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [FastAPI](https://datapocket.vo1d.studio/docs/fastapi): Async proxy with httpx. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Express Serve the script and forward events from your Express server. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. Add two routes (Node 18+, global fetch): ```js const PD = "https://datapocket.vo1d.studio"; app.get("/dp/js/:file", async (req, res) => { if (!/^script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js$/.test(req.params.file)) return res.sendStatus(404); const r = await fetch(`${PD}/js/${req.params.file}`); res.set("Content-Type", "application/javascript").set("Cache-Control", "public, max-age=3600").send(await r.text()); }); app.post("/dp/api/event", express.text({ type: "*/*", limit: "16kb" }), async (req, res) => { const ip = (req.headers["x-forwarded-for"] || req.socket.remoteAddress || "").toString().split(",")[0].trim(); const r = await fetch(`${PD}/api/event`, { method: "POST", body: req.body, headers: { "Content-Type": "text/plain", "User-Agent": req.get("user-agent") || "", "X-Forwarded-For": ip }, }); res.status(r.status).type("application/json").send(await r.text()); }); ``` 2. Then load the script from your own domain. Ad blockers can't tell it apart from your own code, so visits from people whose ad blocker blocks analytics domains are still counted: ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```js const session = await stripe.checkout.sessions.create({ // …your line_items, mode, success_url… metadata: { datapocket_visitor_id: req.cookies.dp_vid, datapocket_session_id: req.cookies.dp_sid, }, }); ``` 2. 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": ""}' ``` ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on FastAPI Async proxy with httpx. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. pip install httpx, then add: ```py import re import httpx from fastapi import FastAPI, Request, Response PD = "https://datapocket.vo1d.studio" app = FastAPI() @app.get("/dp/js/{file}") async def dp_script(file: str): if not re.fullmatch(r"script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js", file): return Response(status_code=404) async with httpx.AsyncClient() as client: r = await client.get(f"{PD}/js/{file}") return Response(r.content, media_type="application/javascript", headers={"Cache-Control": "public, max-age=3600"}) @app.post("/dp/api/event") async def dp_event(request: Request): ip = request.headers.get("x-forwarded-for", request.client.host if request.client else "").split(",")[0].strip() async with httpx.AsyncClient() as client: r = await client.post(f"{PD}/api/event", content=await request.body(), headers={ "Content-Type": "text/plain", "User-Agent": request.headers.get("user-agent", ""), "X-Forwarded-For": ip}) return Response(r.content, status_code=r.status_code, media_type="application/json") ``` 2. Then load the script from your own domain. Ad blockers can't tell it apart from your own code, so visits from people whose ad blocker blocks analytics domains are still counted: ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```py session = stripe.checkout.Session.create( # …your line_items, mode, success_url… metadata={ "datapocket_visitor_id": request.cookies.get("dp_vid", ""), "datapocket_session_id": request.cookies.get("dp_sid", ""), }, ) ``` 2. 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": ""}' ``` ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Flask Proxy with requests. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. pip install requests, then add: ```py import re import requests from flask import Flask, Response, abort, request PD = "https://datapocket.vo1d.studio" app = Flask(__name__) @app.get("/dp/js/") def dp_script(file): if not re.fullmatch(r"script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js", file): abort(404) r = requests.get(f"{PD}/js/{file}", timeout=5) return Response(r.content, mimetype="application/javascript", headers={"Cache-Control": "public, max-age=3600"}) @app.post("/dp/api/event") def dp_event(): ip = request.headers.get("X-Forwarded-For", request.remote_addr or "").split(",")[0].strip() r = requests.post(f"{PD}/api/event", data=request.get_data(), timeout=5, headers={ "Content-Type": "text/plain", "User-Agent": request.headers.get("User-Agent", ""), "X-Forwarded-For": ip}) return Response(r.content, status=r.status_code, mimetype="application/json") ``` 2. Then load the script from your own domain. Ad blockers can't tell it apart from your own code, so visits from people whose ad blocker blocks analytics domains are still counted: ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```py session = stripe.checkout.Session.create( # …your line_items, mode, success_url… metadata={ "datapocket_visitor_id": request.cookies.get("dp_vid", ""), "datapocket_session_id": request.cookies.get("dp_sid", ""), }, ) ``` 2. 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": ""}' ``` ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Django Two views and two URL patterns. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. views.py (pip install requests): ```py import requests from django.http import HttpResponse, Http404 from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST PD = "https://datapocket.vo1d.studio" def dp_script(request, file): r = requests.get(f"{PD}/js/{file}", timeout=5) resp = HttpResponse(r.content, content_type="application/javascript") resp["Cache-Control"] = "public, max-age=3600" return resp @csrf_exempt @require_POST def dp_event(request): ip = request.META.get("HTTP_X_FORWARDED_FOR", request.META.get("REMOTE_ADDR", "")).split(",")[0].strip() r = requests.post(f"{PD}/api/event", data=request.body, timeout=5, headers={ "Content-Type": "text/plain", "User-Agent": request.META.get("HTTP_USER_AGENT", ""), "X-Forwarded-For": ip}) return HttpResponse(r.content, status=r.status_code, content_type="application/json") ``` 2. urls.py: ```py from django.urls import path, re_path from . import views urlpatterns = [ re_path(r"^dp/js/(?Pscript(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js)$", views.dp_script), path("dp/api/event", views.dp_event), # …your routes ] ``` 3. Then load the script from your own domain. Ad blockers can't tell it apart from your own code, so visits from people whose ad blocker blocks analytics domains are still counted: ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```py session = stripe.checkout.Session.create( # …your line_items, mode, success_url… metadata={ "datapocket_visitor_id": request.cookies.get("dp_vid", ""), "datapocket_session_id": request.cookies.get("dp_sid", ""), }, ) ``` 2. 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": ""}' ``` ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Laravel Routes with the Http client, excluded from CSRF. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. routes/web.php: ```php use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Route; Route::get('/dp/js/{file}', function (string $file) { $r = Http::get("https://datapocket.vo1d.studio/js/{$file}"); return response($r->body(), 200) ->header('Content-Type', 'application/javascript') ->header('Cache-Control', 'public, max-age=3600'); })->where('file', 'script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js'); Route::post('/dp/api/event', function (Request $request) { $r = Http::withHeaders([ 'Content-Type' => 'text/plain', 'User-Agent' => $request->userAgent() ?? '', 'X-Forwarded-For' => $request->ip(), ])->withBody($request->getContent(), 'text/plain')->post('https://datapocket.vo1d.studio/api/event'); return response($r->body(), $r->status())->header('Content-Type', 'application/json'); })->withoutMiddleware([ \Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class, ]); ``` 2. In Blade (resources/views/layouts/app.blade.php) : ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```php $session = $stripe->checkout->sessions->create([ // …your line_items, mode, success_url… 'metadata' => [ 'datapocket_visitor_id' => $_COOKIE['dp_vid'] ?? '', 'datapocket_session_id' => $_COOKIE['dp_sid'] ?? '', ], ]); ``` 2. 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": ""}' ``` ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on PHP One file, no framework, no rewrites. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. Save as dp.php in your web root: ```php [ 'method' => 'POST', 'ignore_errors' => true, 'timeout' => 5, 'header' => "Content-Type: text/plain\r\nUser-Agent: " . ($_SERVER['HTTP_USER_AGENT'] ?? '') . "\r\nX-Forwarded-For: $ip\r\n", 'content' => file_get_contents('php://input'), ]]); $body = file_get_contents("$PD/api/event", false, $ctx); preg_match('#HTTP/\S+ (\d+)#', $http_response_header[0] ?? '', $m); http_response_code((int) ($m[1] ?? 502)); header('Content-Type: application/json'); echo $body; exit; } $file = $_GET['file'] ?? 'script.js'; if (!preg_match('/^script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js$/', $file)) { http_response_code(404); exit; } header('Content-Type: application/javascript'); header('Cache-Control: public, max-age=3600'); echo file_get_contents("$PD/js/$file"); ``` 2. Load the script through it. data-api sends events back to dp.php: ```html ``` ## Revenue attribution 1. Pass the visitor cookie to Stripe Checkout so each sale is attributed to the channel that brought the buyer: ```php $session = $stripe->checkout->sessions->create([ // …your line_items, mode, success_url… 'metadata' => [ 'datapocket_visitor_id' => $_COOKIE['dp_vid'] ?? '', 'datapocket_session_id' => $_COOKIE['dp_sid'] ?? '', ], ]); ``` 2. 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": ""}' ``` ## 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 - [React Router](https://datapocket.vo1d.studio/docs/react-router): Framework mode (Remix) and library mode. pushState navigations are tracked automatically. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on NGINX Two location blocks in your server config. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. Inside your server { } block: ```nginx location ~ ^/dp/js/(script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js)$ { proxy_pass https://datapocket.vo1d.studio/js/$1; proxy_set_header Host datapocket.vo1d.studio; proxy_set_header Cookie ""; proxy_set_header Authorization ""; proxy_ssl_server_name on; proxy_hide_header Set-Cookie; } location = /dp/api/event { proxy_pass https://datapocket.vo1d.studio/api/event; proxy_set_header Host datapocket.vo1d.studio; proxy_set_header X-Forwarded-For $remote_addr; # proxy_pass forwards every request header: drop the visitor's cookies and credentials proxy_set_header Cookie ""; proxy_set_header Authorization ""; proxy_ssl_server_name on; proxy_hide_header Set-Cookie; } ``` 2. Reload (nginx -t && nginx -s reload), then: ```html ``` 3. Behind Cloudflare or a load balancer? Enable the realip module (set_real_ip_from + real_ip_header X-Forwarded-For) so $remote_addr is the visitor's IP. ## 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 - [React Router](https://datapocket.vo1d.studio/docs/react-router): Framework mode (Remix) and library mode. pushState navigations are tracked automatically. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is 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. - [Express](https://datapocket.vo1d.studio/docs/express): Serve the script and forward events from your Express server. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Caddy A single handle block. Caddy sets X-Forwarded-For for you. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. In your site block of the Caddyfile: ```caddy @datapocket path_regexp ^/dp/(js/script(\.[a-z]+)?(@\d+\.\d+\.\d+)?\.js|api/event)$ handle @datapocket { uri strip_prefix /dp reverse_proxy https://datapocket.vo1d.studio { header_up Host {upstream_hostport} header_up -Cookie header_up -Authorization header_down -Set-Cookie } } ``` 2. Then load the script from your own domain. Ad blockers can't tell it apart from your own code, so visits from people whose ad blocker blocks analytics domains are still counted: ```html ``` 3. Behind Cloudflare or a load balancer? Add `servers { trusted_proxies static private_ranges }` (or Cloudflare's ranges) to the global options so the visitor's IP, not the balancer's, is forwarded. ## 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 (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. - [Vue.js](https://datapocket.vo1d.studio/docs/vue): Vue 3 + Vue Router, Nuxt, Vite. History-mode routing is tracked automatically. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Google Tag Manager A Custom HTML tag on All Pages. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Tags → New → Tag Configuration → Custom HTML. Paste this. It injects the script so data attributes survive GTM: ```html ``` 2. Triggering → All Pages. Save, then Submit/Publish the container. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Framer Site Settings → General → Custom Code. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Open your project → Settings (top right) → General → Custom Code. Paste into "End of tag": ```html ``` 2. Publish. Framer page transitions are tracked as pageviews automatically. ## 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 - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Wix Settings → Custom Code (needs a Premium plan and a connected domain). Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Dashboard → Settings → Custom Code (under Advanced) → + Add Custom Code. Paste: ```html ``` 2. Name it "DataPocket", choose All pages · Load code once, Place code in: Head. Apply. ## 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 - [WordPress](https://datapocket.vo1d.studio/docs/wordpress): Official plugin: tracking, built-in proxy, WooCommerce revenue. - [Shopify](https://datapocket.vo1d.studio/docs/shopify): Theme snippet for the storefront, plus a custom pixel for checkout and verified order revenue. - [Ghost](https://datapocket.vo1d.studio/docs/ghost): Settings → Code injection → Site header. - [Kajabi](https://datapocket.vo1d.studio/docs/kajabi): Theme Settings → Header code. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Webflow Site Settings → Custom Code → Head code (paid site plan). Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Site Settings → Custom Code → Head Code. Paste: ```html ``` 2. Save Changes, then Publish. Custom code only runs on the published site, not in the Designer. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [WordPress](https://datapocket.vo1d.studio/docs/wordpress): Official plugin: tracking, built-in proxy, WooCommerce revenue. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Bubble Settings → SEO/metatags → Script/meta tags in header (paid plan). Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Settings → SEO / metatags → scroll to "Script/meta tags in header". Paste: ```html ``` 2. Deploy to Live. Track workflow goals with a "Run javascript" action (Toolbox plugin): ```js window.datapocket("signup") ``` ## 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 - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Framer](https://datapocket.vo1d.studio/docs/framer): Site Settings → General → Custom Code. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Squarespace Settings → Advanced → Code Injection → Header (Core plan or higher). Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Settings → Advanced → Code Injection → Header. Paste: ```html ``` 2. Save. Squarespace Commerce orders can be sent with the Payment API from a Zapier/Make step. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [WordPress](https://datapocket.vo1d.studio/docs/wordpress): Official plugin: tracking, built-in proxy, WooCommerce revenue. - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on WordPress Official plugin: tracking, built-in proxy, WooCommerce revenue. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. This guide serves the script from your own domain, so ad blockers can't tell it apart from your own code. ## Steps 1. Download the plugin, then Plugins → Add New → Upload Plugin → Activate: ``` https://datapocket.vo1d.studio/downloads/datapocket-wordpress.zip ``` 2. Settings → DataPocket: enter Site ID YOUR_SITE_ID and domain YOUR_DOMAIN. Turn on "Proxy through my site" to bypass ad blockers. 3. No plugin? Paste the tag into your theme's header.php before (or use a header-code plugin): ```html ``` ## Revenue attribution 1. WooCommerce: paste a website API key in Settings → DataPocket. Paid orders are sent with the buyer's visitor id, and refunds are synced automatically. ## 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 - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Framer](https://datapocket.vo1d.studio/docs/framer): Site Settings → General → Custom Code. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Shopify Theme snippet for the storefront, plus a custom pixel for checkout and verified order revenue. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Online Store → Themes → … → Edit code → layout/theme.liquid. Paste right before : ```liquid ``` 2. Settings → Customer events → Add custom pixel "DataPocket". Paste and Connect. This tracks checkout steps and the completed order: ```js const PD = "https://datapocket.vo1d.studio/api/event", SITE = "YOUR_SITE_ID", DOMAIN = "YOUR_DOMAIN"; async function send(type, href, extraData) { const [vid, sid] = await Promise.all([browser.cookie.get("dp_vid"), browser.cookie.get("dp_sid")]); if (!vid) return; fetch(PD, { method: "POST", keepalive: true, headers: { "Content-Type": "text/plain" }, body: JSON.stringify({ type, siteId: SITE, domain: DOMAIN, href, referrer: null, visitorId: vid, sessionId: sid || "s" + vid, extraData }) }); } analytics.subscribe("checkout_started", (e) => send("custom", e.context.document.location.href, { eventName: "checkout_started" })); analytics.subscribe("checkout_completed", (e) => { const c = e.data.checkout; send("payment", e.context.document.location.href, { shopify_order_id: String(c.order?.id ?? ""), amount: String(c.totalPrice?.amount ?? ""), currency: c.currencyCode }); }); ``` ## Revenue attribution 1. Settings → Revenue → Shopify: enter your store domain and an Admin API token (custom app with read_orders). Orders reported by the pixel are verified against Shopify before they count as revenue, and refunds sync via webhook. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Ghost Settings → Code injection → Site header. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Settings → Code injection → Site header. Paste and Save: ```html ``` 2. Track member signups by adding data-dp-goal="signup" to your signup form's submit button in the theme. ## 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 - [Google Tag Manager](https://datapocket.vo1d.studio/docs/gtm): A Custom HTML tag on All Pages. - [Framer](https://datapocket.vo1d.studio/docs/framer): Site Settings → General → Custom Code. - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Kajabi Theme Settings → Header code. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Website → Design (Themes) → Customize your theme → Settings → Custom Code / Header code. Paste and Save: ```html ``` 2. For purchases, add a Kajabi offer webhook (or Zapier) that calls the Payment API with the buyer email. DataPocket matches it to the visitor when you also call datapocket('identify', { user_id, email }) after login. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Podia Site → Settings → Advanced → Custom HTML head code. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Site → Settings → Advanced → Custom HTML Head Code. Paste and Save Changes: ```html ``` 2. Send Podia sales through Zapier → Webhooks → POST to the Payment API with the buyer email. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots) --- # Install DataPocket on Lovable Paste one prompt. Also works with Bolt, v0 and Replit. Replace `YOUR_SITE_ID` and `YOUR_DOMAIN` with the values from your site's Install page. ## Steps 1. Paste this prompt into Lovable's chat: ``` Add this analytics script to the of index.html exactly as written, without changing any attribute: The app uses client-side routing; do not add any extra pageview tracking code. ``` 2. Publish, then open your live site. The Install page turns green when the first visit arrives. ## 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 - [Wix](https://datapocket.vo1d.studio/docs/wix): Settings → Custom Code (needs a Premium plan and a connected domain). - [Webflow](https://datapocket.vo1d.studio/docs/webflow): Site Settings → Custom Code → Head code (paid site plan). - [Bubble](https://datapocket.vo1d.studio/docs/bubble): Settings → SEO/metatags → Script/meta tags in header (paid plan). - [Squarespace](https://datapocket.vo1d.studio/docs/squarespace): Settings → Advanced → Code Injection → Header (Core plan or higher). - [AI crawler tracking](https://datapocket.vo1d.studio/docs/ai-bots)