data-api attribute on the tag. This page explains what a blocker does, how to see it, and what changes when you proxy.
What a blocker does
The standard tag loads the script fromhttps://in.crispstats.com/d.js and sends events to https://in.crispstats.com/e. A blocker that lists analytics hosts can stop either request:
- The script is blocked.
d.jsnever loads, so nothing is tracked on that page.window.crispstats.visundefined. - The events are blocked. The script runs, but its requests to
/efail, so the collector never sees the visit.
Check whether a blocker affects you
Open your site in a browser with the blocker on, open the developer tools and reload with the Network panel open:- A request to
d.jsor/ethat fails, in Chrome withnet::ERR_BLOCKED_BY_CLIENT, means the blocker stopped it. window.crispstats && window.crispstats.vreturningundefinedin the console means the script did not run.
Serve CrispStats from your own domain
With a proxy, the browser loads the script and sends events to a path on your own site, such as/k3x9qe/d.js and /k3x9qe/e. Your server forwards everything under that path to https://in.crispstats.com/p/. Requests to your own domain look like any other request to your site, which is why a blocker that matches analytics hosts lets them through.
1
Forward one path to the collector
Settings, Tracking code, Proxy through your own domain proposes a path made for your site and shows the rule for Next.js, Next.js on Cloudflare, Vercel, Netlify, a Cloudflare Worker and nginx. The same code is in the proxy guide. Each example forwards only the headers analytics needs and the visitor’s address, never their cookies.Use a path unique to your site rather than
/stats or /analytics, which blockers can list as easily as a host.2
Point the tag at your path
Replace the tag on every page. Keep any other attributes you use, such as
src loads the script from your domain and data-api sends events there too:data-outbound.3
Check it
Open
https://example.com/k3x9qe/check?k=cs_pk_xxxxxxxx and look for "proxied": true and "visitorAddressForwarded": true. Then, with the blocker on, reload your site and filter the network panel by your path: the script should load with 200 and the POST to /k3x9qe/e should get 202. Your visit appears in Realtime.What changes behind a proxy
- The visitor’s address comes from your proxy. The collector reads it from
x-forwarded-foron proxy routes and uses it, as always, only to derive the daily visitor id. The examples set it for you. See the visitor address. - Location comes from your proxy or the timezone. Proxies on Vercel, Netlify and Cloudflare pass the visitor’s country, region and city. Others give the country only, from the browser’s timezone. See location.
crispstats.id()works through the proxy, and falls back to the collector directly when the proxy does not answer.- Rate limits count each visitor, not your server. See rate limits behind a proxy.
- Your Content Security Policy can use
'self'instead ofhttps://in.crispstats.com. See Content Security Policy.
Next steps
Proxy setup
The rule for every host, the setup check and signing.
Troubleshooting
Work through other reasons a visit does not show up.
Content Security Policy
Allow the script and events, direct or through a proxy.