Skip to Content
GuidesSkoup Analytics

Skoup Analytics

Skoup Analytics measures the visits ChatGPT, Perplexity, Gemini or Claude send to your site, for Revenue › AI traffic and GET /v1/brands/{brand}/traffic. Enable it in Settings › Integrations › Skoup Analytics, then paste the tag.

<script defer src="https://app.skoup.ai/t.js" data-site="site_…"></script>

Paste it on every page, right before </body>. Hits go to https://api.skoup.ai/t (POST, JSON as text/plain, sendBeacon), batched every second.

With a framework

The core and its wrappers are published on npm, source on github.com/lunifyfr/skoup-sdk  (MIT):

PackageFor
@skoup/analyticsThe core: createSkoup({ site }), or the skoup.iife.js tag
@skoup/analytics-react<SkoupProvider site>, useSkoup(), useSkoupPageview()
@skoup/analytics-next<SkoupAnalytics site> in the root layout (App Router)
@skoup/analytics-vueapp.use(createSkoupPlugin({ site, router })), useSkoup()
@skoup/analytics-nuxtModule: skoup: { site } in nuxt.config
@skoup/analytics-svelteinitSkoup({ site }), trackPage() from afterNavigate
// Next.js — app/layout.tsx import { SkoupAnalytics } from '@skoup/analytics-next' export default function RootLayout({ children }) { return <SkoupAnalytics site="site_…" consent="wait">{children}</SkoupAnalytics> }

Every wrapper exposes the same instance: skoup.event(), skoup.consent(), skoup.attribution(). Page views follow the framework’s navigation, nothing to call.

What Skoup Analytics measures

SentNever sent
Page views: host, path, utm_* and ref parametersPage title, form contents, any other URL parameter, fragment
Referrer (without its parameters)Screen size, language, browser, OS
Named events (skoup('event', …)) with their scalar propertiesThe IP address is not stored: it gives the country, then is forgotten
Visitor id: a random value, held in memory for one page before the visitor consents, then in the skp_vid cookie (13 months), set on the site’s registrable domain (nordvelo.fr for www., shop. and app.: one visitor across subdomains)Any identity data

A visit groups the hits of one visitor without a thirty-minute gap; a page entered from an AI assistant or with a utm_source opens a new visit, so it gets attributed. A visit’s source (referrer or utm_source) is classified by the surface list Skoup maintains. The first touch of a conversion is the oldest visit of the same visitor within the last 30 days.

Skoup Analytics has two modes:

  • Without a tracker, until the visitor consents: nothing is read from or written to their device, the id is random and lives for one page (a single-page app keeps it from one route to the next).
  • Cookie skp_vid, once they consent.

Add data-consent="wait" to the tag (consent="wait" on the wrappers): the script measures without a tracker until skoup('consent', 'granted').

<script defer src="https://app.skoup.ai/t.js" data-site="site_…" data-consent="wait"></script> <script> // when your banner gets the consent: window.skoup && window.skoup('consent', 'granted') // if the visitor opts out of measurement: nothing is sent anymore // window.skoup && window.skoup('consent', 'off') </script>

Without a cookie, two pages are not linked from one load to the next: no first touch, no deferred conversion from one visit to another, and a purchase is counted without being linked to its order. A page opened from your own site does not count as a new visit; a page reached from an AI assistant, a campaign or another site does. To let visitors opt out of measurement, call skoup('consent', 'off').

Events

// a sign-up, a demo request, a call, a booking… skoup('event', 'signup', { plan: 'growth' }) // an order outside Shopify (amount, currency, order id) skoup('event', 'purchase', null, { value: 129.9, currency: 'EUR', order_id: '1042' })

An event name is [a-z0-9_], 64 characters at most; up to 20 scalar properties of 256 characters. For a store, the report’s conversion counts the purchase events; for a SaaS or an establishment, the key events chosen in the app (every named event by default). Calls made before the script loads are queued: window.skoup = window.skoup || function () { (window.skoup.q = window.skoup.q || []).push(arguments) }.

A single-page app sees every route change as a page; skoup('pageview') forces one.

Conversions already sent to Google Analytics: since 1.1.0, the tag picks up the conversions the site already sends to GA4 (gtag('event', …) or dataLayer.push({ event }), GTM included), with no code. Only conversion names are taken, never their properties: purchase (amount, currency, order id), generate_lead, form_submit → lead, sign_up → signup, book_appointment → booking, phone_call → call_click, contact. The same event also declared through skoup('event', …) counts once. Google’s consent plays no part; Skoup’s applies. To turn it off: data-gtag="off" (or captureGtag: false).

Attributing a Stripe subscription

skoup.attribution() returns what the visit came from — { visitor_id, referrer, landing_url, utm_source, utm_medium, utm_campaign }, kept for the browser session. Write it into the subscription’s (or customer’s) Stripe metadata, which Skoup already reads:

const from = skoup.attribution() ?? {} await stripe.checkout.sessions.create({ subscription_data: { metadata: { skoup_referrer: from.referrer, skoup_utm_source: from.utm_source, skoup_landing_url: from.landing_url } }, // … })

Shopify store

On a connected Shopify store, Skoup installs the Skoup Analytics pixel itself (the app’s web pixel extension) as soon as the brand has its site key: page views, product views, add-to-carts, checkouts and purchases, including the checkout pages a theme tag cannot reach. Nothing to paste in the theme; the tag remains for your other sites (landing, blog).

The pixel sends its hits through the store’s app proxy (https://your-store.com/apps/skoup/t): first-party, signed by Shopify, off the blockers’ lists. Consent is the store’s: the pixel is declared analytics to Shopify, which loads it only after the visitor agreed where the law requires it (Shopify’s banner or a compatible consent app).

Every purchase carries the order id and the checkout token: Skoup joins the order received by webhook to the visit that made it, whichever arrives first. That is what feeds the “First AI contact” of Revenue › Orders and first_touch of GET /v1/brands/{brand}/attribution: the buyer who asked ChatGPT ten days ago, then came back through Google.

The pixel needs the write_pixels and read_customer_events scopes: a store connected before they were added shows “Reconnect the store” in Settings › Integrations. Rotating the site key updates the pixel; forgetting the key removes it from the store.

WooCommerce store

Paste the tag on every page of the store, in the theme (header.php or the site editor) or with a header code-insertion plugin. On the « Order received » page, the tag recognises the order confirmation by itself and sends the purchase with the order id: Skoup joins the order received by webhook to the visit that made it, as for Shopify, which feeds first_touch of GET /v1/brands/{brand}/attribution.

Consent is yours (see Consent): add data-consent="wait" to the tag, then call skoup('consent', 'granted') once your banner gets consent.

PrestaShop store

Paste the tag on every page of the store, in the theme (your theme’s head template or a code-insertion module). To match an order with its visit, send the purchase on the order confirmation page with PrestaShop’s order id (id_order):

skoup('event', 'purchase', null, { value: 96, currency: 'EUR', order_id: '501' })

Skoup then matches the order read every hour with the visit that made it, which attributes it to the assistant that brought the buyer. Consent remains yours to collect (see Consent).

First-party proxy

Serve the tag and receive the hits on your own domain: ad blockers no longer see skoup.ai, and the skp_vid cookie is set by the collector’s response, over HTTP, so it lives 13 months even on Safari (which caps a cookie set in JavaScript at 7 days). Nothing to declare on Skoup’s side, like Sentry’s tunnel: copy the secret from Settings › Integrations › Skoup Analytics › Install › First-party proxy, and serve the tag from your domain. The script served at /_skoup/t.js sends its hits to /_skoup/t on its own (data-endpoint forces it if needed):

<script defer src="https://www.your-site.com/_skoup/t.js" data-site="site_…"></script>

Your server forwards two paths, adding two headers to the request to the collector:

PathToHeaders added
GET /_skoup/t.jshttps://app.skoup.ai/t.js—
POST /_skoup/thttps://api.skoup.ai/tX-Skoup-Proxy: <secret> · X-Skoup-Client-IP: <visitor's IP>

The collector trusts X-Skoup-Client-IP (for the country, never stored) and returns the cookie only with the right secret; the collector’s response, Set-Cookie included, goes back to the browser as is. Without the secret, the hit is handled as a direct one.

nginx

location = /_skoup/t.js { proxy_pass https://app.skoup.ai/t.js; proxy_set_header Host app.skoup.ai; proxy_ssl_server_name on; } location = /_skoup/t { proxy_pass https://api.skoup.ai/t; proxy_set_header Host api.skoup.ai; proxy_ssl_server_name on; proxy_set_header X-Skoup-Proxy "skp_proxy_…"; proxy_set_header X-Skoup-Client-IP $remote_addr; proxy_pass_request_headers on; }

Cloudflare Worker (route www.your-site.com/_skoup/*)

export default { async fetch(request, env) { const url = new URL(request.url) if (url.pathname === '/_skoup/t.js') { return fetch('https://app.skoup.ai/t.js', { cf: { cacheTtl: 3600 } }) } if (url.pathname === '/_skoup/t' && request.method === 'POST') { const headers = new Headers(request.headers) headers.set('X-Skoup-Proxy', env.SKOUP_PROXY_SECRET) headers.set('X-Skoup-Client-IP', request.headers.get('CF-Connecting-IP') ?? '') return fetch('https://api.skoup.ai/t', { method: 'POST', headers, body: request.body }) } return new Response(null, { status: 404 }) }, }

Next.js (app/%5Fskoup/[...path]/route.ts: a folder starting with _ is private in the App Router, %5F puts it in the URL)

export async function GET() { return fetch('https://app.skoup.ai/t.js', { next: { revalidate: 3600 } }) } export async function POST(request: Request) { const ip = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? '' return fetch('https://api.skoup.ai/t', { method: 'POST', headers: { 'Content-Type': 'text/plain', 'X-Skoup-Proxy': process.env.SKOUP_PROXY_SECRET!, 'X-Skoup-Client-IP': ip }, body: await request.text(), }) }

The secret is renewed with the site key (« Regenerate the key »). Keep it server-side: never in the page.

AI agent reads

When ChatGPT, Perplexity or Claude read a page of your site to answer someone, a robot requests it (ChatGPT-User, Perplexity-User, Claude-User…), not a browser: the tag never sees it, only your server does. Your server forwards those requests only to Skoup, which counts them in Results › Being visited (« read by assistants »), beside the visits and never added to them: a read is not a visit.

Skoup knows three kinds of agents:

KindWhat it isAgents
userAn assistant reads the page to answer a question, at that momentChatGPT-User, Perplexity-User, Claude-User, MistralAI-User, Google-Agent, Google-GeminiNotebook, DuckAssistBot, meta-externalfetcher, Amzn-User
searchThe assistant’s search index, what it may cite laterOAI-SearchBot, PerplexityBot, Claude-SearchBot, MistralAI-Index, Applebot, meta-webindexer, Amzn-SearchBot, YouBot
trainingA crawler collecting pages to train modelsGPTBot, ClaudeBot, MistralAI-Training, meta-externalagent, Amazonbot, CCBot, Bytespider, AI2Bot

Only the user kind shows on the Results timeline; all three are in GET /v1/brands/{brand}/agent-reads.

Verified: Skoup checks the IP of each read against the ranges the agent’s publisher publishes (OpenAI, Perplexity, Anthropic, Mistral, Google, DuckDuckGo, Apple, Amazon, Common Crawl), then forgets the IP. A publisher that publishes none (Meta, ByteDance…) leaves its reads « unverified ». A request wearing an agent’s name from an IP outside its publisher’s ranges is someone else borrowing it: it is in no figure.

The contract

POST https://api.skoup.ai/t/agents Content-Type: application/json X-Skoup-Proxy: skp_proxy_… { "s": "site_…", "e": [ { "ua": "Mozilla/5.0 … ChatGPT-User/1.0 …", "ip": "20.171.207.10", "u": "https://www.your-site.com/products/strade-7", "ts": 1760436000, "st": 200 } ] }
Field
sThe site key (site_…)
eUp to 50 reads per request
uaThe request’s User-Agent (at most 512 characters read)
ipThe client’s IP — the agent’s, not a proxy’s or a CDN’s
uThe URL requested; Skoup keeps its path only
tsUnix seconds; more than an hour away from the reception, the reception time is used
stThe HTTP status served (optional): 4xx / 5xx count as errors (errors), 404 / 410 also as missing pages (not_found); a read without one is counted apart (unknown_status), never as a success

Answers: 204 accepted (even when reads are dropped: unknown agent, host outside the site’s hosts, disabled site), 401 secret missing or wrong for the site, 422 body outside the contract, 429 too many requests. X-Skoup-Proxy is the first-party proxy secret (Settings › Integrations › Skoup Analytics › Install).

Only send the agents’ requests: the list of tokens fits in one regular expression, to copy as is.

const AI_AGENTS = /ChatGPT-User|OAI-SearchBot|GPTBot|Perplexity-User|PerplexityBot|Claude-User|Claude-SearchBot|ClaudeBot|MistralAI-(User|Index|Training)|Google-Agent|Google-GeminiNotebook|Google-NotebookLM|DuckAssistBot|meta-external(fetcher|agent)|meta-webindexer|Amzn-(User|SearchBot)|Amazonbot|Applebot|YouBot|CCBot|Bytespider|AI2Bot/i

Next.js

With @skoup/analytics-next 1.1.0, reportAiAgents spots the agents in proxy.ts and forwards their request after the response (event.waitUntil), delaying nothing:

// proxy.ts import { NextResponse, type NextFetchEvent, type NextRequest } from 'next/server' import { reportAiAgents } from '@skoup/analytics-next/proxy' export function proxy(request: NextRequest, event: NextFetchEvent) { reportAiAgents(request, event, { site: 'site_…', secret: process.env.SKOUP_PROXY_SECRET! }) return NextResponse.next() }

No status from proxy.ts. The proxy runs before the page renders: it does not know yet whether the page will answer 200 or 404, so its reads carry no st. Skoup counts them in unknown_status — never as successes — and once a day asks each of those pages itself (one HEAD, GET when HEAD is refused, redirects not followed, from SkoupBot), then writes the answer on the reads of the last 28 days: they move to errors / not_found or out of unknown_status. A page answering 404 / 410 to the agents becomes a fix in Fixes (agent_reads_missing_page, urgent when an assistant also cites the page), asked again every day until it answers. Since @skoup/analytics-next 1.2.0, reportAiAgents takes a status option for the responses the proxy decides itself (a redirect, a 410 for a removed page); a 404 of the app is still left to Skoup’s daily check.

Cloudflare Worker

The Worker sees every request, including those the cache serves without waking your server. Route www.your-site.com/*, secret in SKOUP_PROXY_SECRET:

const AI_AGENTS = /ChatGPT-User|OAI-SearchBot|GPTBot|Perplexity-User|PerplexityBot|Claude-User|Claude-SearchBot|ClaudeBot|MistralAI-(User|Index|Training)|Google-Agent|Google-GeminiNotebook|Google-NotebookLM|DuckAssistBot|meta-external(fetcher|agent)|meta-webindexer|Amzn-(User|SearchBot)|Amazonbot|Applebot|YouBot|CCBot|Bytespider|AI2Bot/i export default { async fetch(request, env, ctx) { const response = await fetch(request) const ua = request.headers.get('User-Agent') ?? '' if (AI_AGENTS.test(ua)) { ctx.waitUntil(fetch('https://api.skoup.ai/t/agents', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Skoup-Proxy': env.SKOUP_PROXY_SECRET }, body: JSON.stringify({ s: 'site_…', e: [{ ua, ip: request.headers.get('CF-Connecting-IP'), u: request.url, ts: Math.floor(Date.now() / 1000), st: response.status, }] }), })) } return response }, }

PHP (nginx, Apache, WordPress)

Loaded before your application: auto_prepend_file in php.ini (nginx + PHP-FPM, Apache), or a file in wp-content/mu-plugins/ on WordPress. The read leaves after the response, with its status:

<?php const SKOUP_SITE = 'site_…'; const SKOUP_AI_AGENTS = '/ChatGPT-User|OAI-SearchBot|GPTBot|Perplexity-User|PerplexityBot|Claude-User|Claude-SearchBot|ClaudeBot|MistralAI-(User|Index|Training)|Google-Agent|Google-GeminiNotebook|Google-NotebookLM|DuckAssistBot|meta-external(fetcher|agent)|meta-webindexer|Amzn-(User|SearchBot)|Amazonbot|Applebot|YouBot|CCBot|Bytespider|AI2Bot/i'; function skoup_report_ai_agents(): void { $ua = $_SERVER['HTTP_USER_AGENT'] ?? ''; if ($ua === '' || ! preg_match(SKOUP_AI_AGENTS, $ua)) { return; } $url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; register_shutdown_function(function () use ($ua, $url): void { if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); // the response is out, the agent does not wait } $ch = curl_init('https://api.skoup.ai/t/agents'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-Skoup-Proxy: '.getenv('SKOUP_PROXY_SECRET')], CURLOPT_POSTFIELDS => json_encode(['s' => SKOUP_SITE, 'e' => [[ 'ua' => $ua, 'ip' => $_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['REMOTE_ADDR'] ?? null, 'u' => $url, 'ts' => time(), 'st' => http_response_code() ?: null, ]]]), CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 2, ]); curl_exec($ch); }); } function_exists('add_action') ? add_action('init', 'skoup_report_ai_agents') : skoup_report_ai_agents();

Reading the reads

I want…Call
The assistants’ reads, week by week, beside the visitsGET /v1/brands/{brand}/results/timeline → weeks[].ai_reads, ai_reads_pages
All three kinds, per publisher, agent, week and pageGET /v1/brands/{brand}/agent-reads ?period=30d&kind=user
The pages the agents find missingGET /v1/brands/{brand}/insights?market=FR → kind: agent_reads_missing_page; per page, agent_reads of GET /v1/brands/{brand}/pages

Scope revenue:read. No event: a read is a matter of volume, not a moment to notify.

Pitfalls

  • Impossible on hosted Shopify (and on site builders without a server of your own): agents’ requests never go through your code there. The Shopify pixel measures visits, not robots.
  • The secret stays on the server: never in the page nor in the repository. It changes with the site key (« Regenerate the key »): update your server, or get 401.
  • The agent’s IP, not your CDN’s: behind Cloudflare, CF-Connecting-IP; behind another proxy, the IP it forwards. With the proxy’s IP, every read of a verifiable agent looks spoofed and leaves the figures.
  • Caching: a page your CDN serves without touching your server escapes server code (Next.js, PHP); the Cloudflare Worker sees everything.
  • No market: an agent’s IP is its publisher’s, it says nothing of the country of the person who asked. The reads are the site’s.
  • null, never 0: until your server forwarded something, the timeline and the API say null. A robots.txt blocking an agent… blocks its reads too.
  • unknown_status is not a success: a read forwarded without st (Next.js proxy.ts) only gets a status once Skoup asked the page, the next morning. Send st whenever your server knows it.
  • www. or not: the site’s hosts are stored without www. (www.your-site.com = your-site.com, which covers its subdomains): hits and reads from either are accepted.

Pitfalls

  • One site per brand, declared hosts: hits from a domain other than the key’s are dropped (empty = every domain). A declared host covers its subdomains: nordvelo.fr accepts www., shop. and app.; a second domain (a landing on another name) is declared on its own. The cookie is set on the registrable domain the browser accepts; data-cookie-domain (or cookieDomain) forces it.
  • The current day is not counted: the report stops at yesterday; hits are recorded every minute.
  • Regenerating the key refuses the old one at once: update the tag. Forgetting the key stops the collection and keeps the visits already measured.
  • Ad blockers and Safari: a blocker may hold the script back; Safari caps a cookie set in JavaScript at 7 days, which shortens the first touch. The first-party proxy above lifts both.
Last updated on