> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Troubleshoot a script that is not sending data

> A checklist for when CrispStats shows no visits: localhost and automated browsers, data-domains, the setup check, the /e request and its 202, proxies, CSP and exclusions.

When CrispStats shows no visits, the cause is almost always in one of three places: the script never loads, the script loads but decides not to send, or the collector receives the event and drops it. Work through this checklist in order. Each step points to the section that fixes it.

## I see nothing: the checklist

**1. Are you testing on localhost or in an automated browser?**

Visits from `localhost`, `*.localhost`, `127.x.x.x`, `[::1]` and `file://` pages are ignored, and so are Playwright, Puppeteer, Selenium and Cypress. A local `next dev` or Vite server, or a CI run, shows nothing in the dashboard by design. Add `data-debug` to see the events in the console instead, or test on your deployed site in a normal browser window. See [localhost and testing](https://docs.crispstats.com/tracking/localhost-and-testing.md).

**2. Is the hostname in data-domains?**

The dashboard snippet has `data-domains` with your site's domain. A preview deployment (`*.vercel.app`, `*.workers.dev`, `*.netlify.app`) or a staging host on another domain sends nothing. Open the site on its real domain, or add the hostname.

**3. Is the script running?**

On your live site, run this in the console:

```js theme={"theme":{"light":"github-light","dark":"github-dark"}}
window.crispstats && window.crispstats.v;
```

A version string means the script is running. `undefined` means it did not load or did not start: see [The script does not load](#the-script-does-not-load). Check `.v` rather than `window.crispstats` alone, because the [queue stub](https://docs.crispstats.com/tracking/script-attributes.md#call-the-global-before-the-script-loads) defines `window.crispstats` before the script loads.

**4. Does the script say why it is not sending?**

Add `data-debug` to the tag for a moment and reload. Each event logs a line such as `crispstats: pageview not sent (domain not allowed)`. The word in brackets is the reason; `debug mode` means nothing stops it. No line at all, while `crispstats.v` is set, means the script counted no page: check for [`data-manual`](https://docs.crispstats.com/tracking/single-page-apps#manual-pageviews). Remove `data-debug` afterwards: with it, nothing is sent.

**5. Was an event sent?**

Without `data-debug`, open the **Network** panel, type `/e` in the filter and reload. You should see a `POST` to `https://in.crispstats.com/e`, or `<data-api>/e` behind a proxy, answered with `202`. No request: see [The script loads but sends nothing](#the-script-loads-but-sends-nothing).

**6. Does the collector know the site and hostname?**

Open the setup check in the browser: `https://in.crispstats.com/check?k=cs_pk_xxxxxxxx`, or `https://example.com/k3x9qe/check?k=cs_pk_xxxxxxxx` through your [proxy](https://docs.crispstats.com/tracking/proxy.md#check-it-works). `"site": "unknown"` means the key is wrong. Your page's hostname must match one entry in `hostnames`. Behind a proxy, `visitorAddressForwarded` must be `true` and `cookiesForwarded` `false`.

**7. Does the visit reach Realtime?**

Open **Realtime** for the site. Your pageview shows in the **Live feed** within a few seconds. If the request got `202` but nothing appears, the collector dropped it: see [Events arrive but the dashboard stays empty](#events-arrive-but-the-dashboard-stays-empty).

## Read the response

The collector answers a browser event with `202` and an empty body, at once. A `202` only means the request arrived: the collector gives the same answer to an event it stores and to one it drops, so the response cannot tell you which. Use the setup check and **Realtime** for that.

| Status | Meaning |
| - | - |
| `202` | Received. It may still be dropped: see [Events arrive but the dashboard stays empty](#events-arrive-but-the-dashboard-stays-empty). |
| `400` | The body was not a JSON object. The script never sends this, so check custom code that posts to `/e`. |
| `404` | Behind a proxy: the request did not reach the collector. Check that the rule forwards your path to `https://in.crispstats.com/p/`. |
| `413` | The body was larger than 16 KB. |

The **First visitor** step of onboarding and the status row in **Settings**, **Tracking code** check every few seconds and switch to **Receiving events** once the collector has stored the first event for the site. After that they keep saying **Receiving events** and show when the last event arrived, so on a site that already has data, use **Realtime** to confirm your own visit.

## The script does not load

`window.crispstats.v` is `undefined`, or the request for `d.js` failed or never appears.

> [accordion] The tag is not on the live page
>
> Your change may not be deployed yet, or a CDN or page cache still serves the old HTML. Open the live page, view its source and search for `data-site`. If the tag is missing, redeploy and purge your host's cache. The tag must be on every page you want to count, ideally in `<head>`.

> [accordion] The tag uses type="module"
>
> The script reads its options from its own tag through `document.currentScript`, which is not set for module scripts. With `type="module"` the script stops before it starts tracking and `window.crispstats` is never created. Use a classic tag with `defer` or `async`:
>
> ```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
> <script
>   defer
>   data-site="cs_pk_xxxxxxxx"
>   data-domains="example.com"
>   src="https://in.crispstats.com/d.js"
> ></script>
> ```

> [accordion] An ad blocker or privacy extension blocks it
>
> Some blockers stop requests to analytics hosts. In Chrome the failed request shows `net::ERR_BLOCKED_BY_CLIENT`. Test in a private window with extensions off. To count visitors who use a blocker, serve the script from your own domain: see [ad blockers](https://docs.crispstats.com/help/ad-blockers.md).

> [accordion] A Content Security Policy blocks it
>
> If your site sends a `Content-Security-Policy` header, the console shows an error that names the blocked directive. Allow `https://in.crispstats.com` in both `script-src` and `connect-src`. See [Content Security Policy](https://docs.crispstats.com/help/content-security-policy.md).

> [accordion] The src is wrong
>
> The script lives at `https://in.crispstats.com/d.js`, or `https://in.crispstats.com/d.core.js` for the build without optional modules. Behind a proxy, `src` is your own path, such as `/k3x9qe/d.js`, and that path must forward to `https://in.crispstats.com/p/`. A `404` on the script means the path or the rule is wrong. See [proxy](https://docs.crispstats.com/tracking/proxy.md).

## The script loads but sends nothing

`window.crispstats.v` is set, but no request to `/e` appears. The script skips tracking without an error in each of these cases. `window.crispstats` still exists, so your own calls to it are harmless. Add `data-debug` to the tag and the console names the cause for each event.

| Cause | How to check | Fix |
| - | - | - |
| The page is local | The hostname is `localhost`, ends in `.localhost`, starts with `127.`, is `[::1]`, or the page is a `file://` URL. | Expected. Use `data-debug` to see the events, or `data-allow-localhost` to send them. See [localhost and testing](https://docs.crispstats.com/tracking/localhost-and-testing.md). |
| The hostname is not in `data-domains` | The tag has `data-domains` and the current hostname is neither one of the listed domains nor a subdomain of one. | Expected for previews and copies. Add the hostname to `data-domains` if it should count, and to the site's hostnames in **Settings**, **General**. |
| Your browser is opted out | `localStorage.crispstats_ignore` returns `"1"` in the console. | Run `localStorage.removeItem("crispstats_ignore")`. The key is stored per origin. |
| The path is excluded | The tag has `data-exclude` and a pattern matches the current path. | Change the pattern. In `data-exclude`, `*` matches anything, slashes included, and a pattern matches the whole path: `/admin*` also matches `/administrator`. See [exclude paths](https://docs.crispstats.com/tracking/script-attributes.md#exclude-paths). |
| Do Not Track is on | The tag has `data-dnt` and the browser sends Do Not Track. | Expected. Remove `data-dnt` to count these browsers. |
| The browser is automated | `navigator.webdriver` is `true`, or the page runs in Cypress. | Expected. Use `data-debug` to see the events in a test. See [test tracking in CI](https://docs.crispstats.com/tracking/localhost-and-testing.md#test-tracking-in-ci). |
| The page is prerendering | The page was prerendered and not yet shown. | Expected. The pageview is sent when the page is shown. |
| Manual pageviews are on | The tag has `data-manual` and your code never calls `crispstats.pageview()`. | Call `crispstats.pageview()` on each page change, or remove `data-manual`. See [manual pageviews](https://docs.crispstats.com/tracking/single-page-apps.md#manual-pageviews). |
| `data-site` is missing | The tag has no `data-site` attribute. | Add your public key, `cs_pk_…`, from **Settings**, **Tracking code**. |

Behind a proxy, also check that the tag has `data-api`. Without it the script sends events to `/e` on the origin it loaded from, which is your own domain, and those requests fail with `404`. See [proxy](https://docs.crispstats.com/tracking/proxy.md).

## Events arrive but the dashboard stays empty

The network panel shows a `POST` to `/e` with a `202`, but nothing appears in **Realtime**. The collector dropped the event. It drops these without telling the browser:

> [accordion] The hostname is not allowed for the site
>
> The collector only counts events from hostnames the site allows, in **Settings**, **General**:
>
> * With no **Additional hostnames**, the site's **Domain** and all its subdomains count.
> * Once the site has at least one additional hostname, the domain itself plus exactly the listed hostnames count. Other subdomains stop counting until you add them.
>
> `www.` and port numbers are ignored. A preview URL on your hosting provider is a different hostname: add it under **Additional hostnames**, or give it its own test site. See [exclude traffic](https://docs.crispstats.com/tracking/exclude-traffic.md#exclude-other-hostnames).

> [accordion] The key belongs to another site or was rotated
>
> Compare `k` in the request body with the public key in **Settings**, **Tracking code**. An unknown key gets the same `202`. After you rotate the key, the collector stops accepting the old one within about a minute, so a page that still has the old tag sends events nobody stores. Copy the current tag again.

> [accordion] The path or your IP address is excluded in settings
>
> **Settings**, **General** has **Excluded paths** and **Excluded IP addresses**. The collector drops events from matching paths and from excluded addresses. In **Excluded paths**, `*` matches within one path segment and `**` matches across segments. If you excluded your office or home address, your own visits from that network are not counted. See [exclude traffic](https://docs.crispstats.com/tracking/exclude-traffic.md).

> [accordion] The visit looks like a bot
>
> With **Bot filtering** on **Standard**, the default, the collector drops self-identified bots, headless browsers, HTTP clients, prerender and prefetch requests, verified bots, requests without a User-Agent and AI crawlers. **Strict** also drops visits the network scores as likely automated. **Off** drops only AI crawlers. A test from a script, a crawler or a monitoring service is dropped on purpose. See [bot filtering](https://docs.crispstats.com/privacy/bot-filtering.md).

> [accordion] The site is paused or the workspace is suspended
>
> Events for a paused site, or for any site of a suspended workspace, get the usual `202` and are dropped. The dashboard has no control to pause a site, so if you think this applies to yours, write to [hello@crispstats.com](mailto:hello@crispstats.com). Going over a paid plan's event allowance never does this.

> [accordion] The trial reached its monthly event limit
>
> At 25,000 events in a calendar month (UTC), a workspace in its trial is paused: events still get the usual `202` but are not recorded, and the dashboard pauses with them. Pick a plan on the [Billing screen](https://docs.crispstats.com/account/billing.md) to resume at once, or wait for 00:00 UTC on the first day of the next month. See [when the trial reaches its event limit](https://docs.crispstats.com/account/plans-and-limits.md#when-the-trial-reaches-its-event-limit).

> [accordion] The trial or the plan has ended
>
> A workspace with no paid plan after its trial, or after its plan was cancelled or left unpaid, is locked: events get the usual `202` but are not recorded, and the dashboard is closed. Pick a plan on the [Billing screen](https://docs.crispstats.com/account/billing.md) to resume at once. The workspace's sites and their data are deleted 30 days after the lock. See [when the trial or a plan ends](https://docs.crispstats.com/account/plans-and-limits.md#when-the-trial-or-a-plan-ends).

> [accordion] Too many events from one address
>
> The collector accepts up to 1,200 events a minute from one visitor address at each network location and drops the rest. A normal visitor never reaches this. Behind a proxy that does not forward the visitor's address, every event looks like it comes from your server, so a busy site can: check `visitorAddressForwarded` in the [setup check](https://docs.crispstats.com/tracking/proxy.md#check-it-works). See [collector limits](https://docs.crispstats.com/api-reference/rate-limits.md#collector-limits).

> [accordion] A field is too long
>
> The collector quietly drops a browser event whose fields are over its limits: an event name over 120 characters, a property name over 60, a user id over 200, or a revenue currency that is not a three-letter code. The script already cuts URLs to 2,048 characters and string property values to 500. Shorten the name, property key or user id.

## Other symptoms

> [accordion] Every visit is counted twice
>
> Loading the same script twice is safe: the second copy sees the first and does nothing. Double counts come from two different tags with two different keys, for example one in your layout and an old one in a tag manager, each sending to its own site. Search the page source for `data-site` and keep one.

> [accordion] Visitors on a proxied site all look the same
>
> Your proxy does not forward the visitor's address, so the collector sees your server for every visit. Open the [setup check](https://docs.crispstats.com/tracking/proxy.md#check-it-works) and look for `"visitorAddressForwarded": true`.

> [accordion] Pageviews arrive but custom events do not
>
> If you call `crispstats()` in inline code that runs before the deferred script, the call fails unless the queue stub is on the page first. Add the [queue stub](https://docs.crispstats.com/tracking/script-attributes.md#call-the-global-before-the-script-loads) above the script tag. On a page excluded with `data-exclude`, custom events are not sent either, and under `data-manual` events before the first `crispstats.pageview()` are dropped. For HTML attributes, check the spelling: `data-cs-event` and `data-cs-prop-*`. An event with an empty name is not sent.

> [accordion] Early calls fail with "crispstats is not a function"
>
> Browsers expose an element's id as a global, so `window.crispstats` is the script element until the script runs, and early calls to `crispstats()` throw. The script replaces the element with the real function when it loads, but remove the `id` and use the [queue stub](https://docs.crispstats.com/tracking/script-attributes.md#call-the-global-before-the-script-loads) for early calls.

> [accordion] Route changes in a single-page app are missing
>
> The script tracks `history.pushState`, `replaceState`, the Navigation API where the browser has it, and back and forward navigation. A router that saved `pushState` before the script loaded can still hide its changes in browsers without the Navigation API: use [manual pageviews](https://docs.crispstats.com/tracking/single-page-apps.md#manual-pageviews). Apps that route with the URL fragment (`#/page`) need `data-hash`. Two URLs that differ only in a query parameter count as one page unless you keep the parameter with `data-keep-params`. See [single-page apps](https://docs.crispstats.com/tracking/single-page-apps.md).

> [accordion] The install check says it is not answering
>
> **The check is not answering** means the dashboard could not reach its own status endpoint. It retries every few seconds and does not affect tracking. Use the network panel and **Realtime** to confirm events in the meantime.

## Next steps

> [card] [Test on localhost](https://docs.crispstats.com/tracking/localhost-and-testing.md)
>
> Track a local or staging build and confirm events step by step.

> [card] [Exclude traffic](https://docs.crispstats.com/tracking/exclude-traffic.md)
>
> Every setting that keeps visits out of your numbers, and how they combine.

> [card] [Content Security Policy](https://docs.crispstats.com/help/content-security-policy.md)
>
> The exact directives the script and collector need.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.