Skip to main content
A coding agent can install CrispStats in one pass: the script in the right place for your framework, a proxy that never forwards your visitors’ cookies, the visitor id in your checkout metadata, and a check that it all works. The dashboard writes the prompt for your site, so the agent does not have to guess your key, your hostnames or your proxy path.

Copy the prompt

1

Open the install step

In the dashboard, open Settings, Tracking code, or the install step when you add a site. The first block is Set up with an AI agent.
2

Copy the prompt

Select Copy prompt and paste it into Claude Code, Cursor, Codex or any agent that can edit your project. Show prompt shows it first.
3

Review what it changed

The agent lists the files it changed and what the setup check returned. Review the diff like any other change, then deploy.
The prompt tells the agent, in this order, to:
  1. Detect the framework and the host, and say what it found before changing anything.
  2. Add only the script element, the framework’s way: in Next.js one next/script element in the root layout, never a replaced layout. The tag carries data-site, data-domains with your hostnames and your proxy path in data-api and src. It never adds id="crispstats", and adds data-hash only for an app that routes with /#/ URLs.
  3. Forward your proxy path to https://in.crispstats.com/p/* with the handler for your host, sending only content-type, user-agent, accept-language, referer, origin, if-none-match and the visitor’s address. Never cookie or authorization. On hosts without server code (Webflow, Framer, Shopify) it uses the direct tag instead.
  4. If the app takes payments, read crispstats.id() in the click handler that starts checkout and put it in the checkout’s metadata.crispstats_visitor_id. It leaves your own client_reference_id alone, and asks you to connect the provider yourself, because that needs a key the agent should not handle.
  5. If users sign in, call identify() where the session is known, and tell you that this makes the data personal data under GDPR.
  6. Verify with data-debug locally, then with the setup check after deploying, then remove data-debug.
It also lists what never to do: forward cookies, keep whole query strings with data-keep-params="*", keep a direct script tag on checkout pages next to the proxied one, or put a secret key in browser code. There is no npm package to install, and the prompt says so.

The install guide

The prompt links to a plain-text guide the agent fetches first:
It is the full reference in Markdown: every script attribute, every collector route, the proxy handler for Next.js, Next.js on Cloudflare (OpenNext and vinext), Vercel, Netlify, Cloudflare Workers and nginx, the checkout wiring for Stripe, Lemon Squeezy, Polar, Paddle, Dodo Payments, Creem, Razorpay and RevenueCat, the setup check’s fields and the never list. It is built from the same code as the snippets in the dashboard, so the two cannot disagree. Without a query string the guide uses placeholders such as cs_pk_your_site_key. The link in your prompt adds your site’s values:
Every value is public already (the key and hostnames are in your pages’ HTML) and is checked against a strict pattern, so a crafted link cannot put other text into the guide.

Let the agent check its own work

Connect the agent to the MCP server with a read-only key, as in connect AI assistants. It then has three setup tools and three prompts: In Claude Code, prompts appear as slash commands, for example /mcp__crispstats__install_crispstats.

Check it yourself

The setup check answers in your browser too. Open your proxy path’s check on your live site:
Look for "ok": true, "visitorAddressForwarded": true and "cookiesForwarded": false. The proxy guide explains every field.

Next steps

Next.js

The script element, types and the route handler, by hand.

Proxy the script

Every host’s handler and the setup check.

Visitor id at checkout

How payments are attributed.
Last modified on November 24, 2026