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.
- Detect the framework and the host, and say what it found before changing anything.
- Add only the script element, the framework’s way: in Next.js one
next/scriptelement in the root layout, never a replaced layout. The tag carriesdata-site,data-domainswith your hostnames and your proxy path indata-apiandsrc. It never addsid="crispstats", and addsdata-hashonly for an app that routes with/#/URLs. - Forward your proxy path to
https://in.crispstats.com/p/*with the handler for your host, sending onlycontent-type,user-agent,accept-language,referer,origin,if-none-matchand the visitor’s address. Nevercookieorauthorization. On hosts without server code (Webflow, Framer, Shopify) it uses the direct tag instead. - If the app takes payments, read
crispstats.id()in the click handler that starts checkout and put it in the checkout’smetadata.crispstats_visitor_id. It leaves your ownclient_reference_idalone, and asks you to connect the provider yourself, because that needs a key the agent should not handle. - If users sign in, call
identify()where the session is known, and tell you that this makes the data personal data under GDPR. - Verify with
data-debuglocally, then with the setup check after deploying, then removedata-debug.
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: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:"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.