> ## 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.

# What data CrispStats collects and stores

> The fields every CrispStats event carries, what the collector derives and discards, how URLs, location and payment emails are reduced, and how long data is kept.

Every CrispStats event from the script carries seven pieces of context: your site's public key, the page URL without the fragment and with its query string cut down, the referrer, the screen width, the browser language, the timezone name and a timestamp. The request also carries the IP address and User-Agent, as every web request does. The collector uses those two to derive a visitor id, the browser, operating system, device type and an approximate location, then discards them. Neither is stored or logged.

This page lists exactly what is sent, what is stored, what is reduced on the way, and how long it is kept.

## What the script sends

Each event is a small JSON payload. These are all the fields; the first block is on every event, the rest only on the event types that need them.

| Field | Content | Sent with |
| - | - | - |
| `k` | Your site's public key, `cs_pk_…` | Every event |
| `t` | Event type: `pageview`, `event`, `vitals`, `error`, `identify`, `revenue` or `ping` | Every event |
| `u` | Page URL, without the fragment, with the query string cut to the [kept parameters](#query-strings-are-cut-in-the-browser), at most 2,048 characters | Every event |
| `r` | Referrer: the external referrer on the first pageview, the previous tracked page after that, cut the same way as `u`. Possibly empty. | Every event |
| `w` | Screen width in CSS pixels | Every event |
| `l` | Browser language, such as `en-GB` | Every event |
| `z` | Timezone name, such as `Europe/Berlin` | Every event |
| `ts` | Timestamp from the browser | Every event |
| `n` | Event name, up to 120 characters | Custom events |
| `p` | Your custom properties: flat, string values cut at 500 characters | Custom events, `identify`, `revenue` |
| `a`, `c` | Amount in minor units and ISO 4217 currency | `crispstats.revenue()` |
| `d`, `s` | Seconds the page was visible and furthest scroll depth in percent | Engagement pings |
| `v` | Web vitals: LCP, INP, CLS, FCP, TTFB | `data-vitals` |
| `e` | Error message, source, line, column and stack | `data-errors` |
| `i` | The user id you passed to `crispstats.identify()` | Events after `identify()`, until the page unloads |
| `vid` | The random id from `localStorage.crispstats_vid` | Only with [persistent visitors](https://docs.crispstats.com/privacy/persistent-visitors.md) |

The script cuts string property values at 500 characters but does not shorten the other fields. The collector drops an event whose fields are over their limits, such as an event name over 120 characters, a property name over 60 or a user id over 200, and a browser gets no error for it.

The fragment (`#…`) is never sent unless you add `data-hash` for a hash router. See [single-page apps](https://docs.crispstats.com/tracking/single-page-apps.md).

### Query strings are cut in the browser

Query strings carry license keys, password reset tokens, checkout session ids and e-mail addresses, so the script cuts them before anything leaves the page, for the page URL and the referrer. It keeps only:

* `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`, `ref`, `source` and `via`, with their values,
* ad click ids (`gclid`, `gbraid`, `wbraid`, `msclkid`, `fbclid`, `ttclid`, `twclid`, `li_fat_id`), with the value replaced by `1`,
* the parameters you list in `data-keep-params`, with their values.

`/reset?token=abc123&utm_source=mail` is sent as `/reset?utm_source=mail`. `data-keep-params="*"` turns this off and sends the whole query string. See [script attributes](https://docs.crispstats.com/tracking/script-attributes.md#what-the-script-sends).

Two kinds of event carry other URLs, and the browser cuts them the same way: the `url` property of `Outbound link` and `File download` events, and the `source` of a JavaScript error. Both lose their fragment and every query parameter that is not kept. An error's stack trace is sent as the browser reports it, so it can still contain script URLs with their query strings.

## What the collector derives and discards

| From | Derived and stored | Discarded |
| - | - | - |
| IP address | Visitor id (as part of a [salted daily hash](https://docs.crispstats.com/privacy/cookieless-tracking.md)), approximate location | The address itself, after the event is processed |
| User-Agent | Visitor id (same hash), browser family, operating system family, device type | The User-Agent string itself |
| Screen width | Device type (desktop, mobile or tablet), together with the User-Agent | The width |
| Timezone name | Country, only when the network gives none, or behind a proxy that sends no location | The timezone |
| Referrer | The referrer's hostname, without `www.` and only when it is another site, plus a channel and source | The full referrer URL |
| Page URL | Hostname, normalised path, UTM values | Query string (see below) and fragment |

The IP address is also used in memory for rate limiting and to match your [excluded IP addresses](https://docs.crispstats.com/tracking/exclude-traffic.md). Excluded addresses are saved only as a SHA-256 hash and compared hash to hash.

## What is stored for each event

| Group | Fields |
| - | - |
| Identity | Event id, site, event type and name, timestamp (server time), visitor id, session id, your user id if you called `identify()` |
| Page | Hostname, path |
| Source | Referrer hostname, channel, source, `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content` |
| Location | Country, region, city, latitude and longitude rounded to 0.1 degree |
| Device | Browser family, operating system family, device type, browser language |
| Event data | Custom properties (up to 40 per event), web vitals or error details, revenue and currency, visible seconds and scroll depth |

No IP address, User-Agent string, full referrer URL, screen width or timezone is stored.

## Paths and query strings

What the browser sends is reduced again on the collector:

* The query string is removed from the stored path, except the parameters you keep under **Query parameters** in **Settings**, **General**, an allowlist for parameters that make a page different, such as `page` or `lang`. Everything else is dropped. When you keep a parameter there, the snippet in **Settings**, **Tracking code** adds it to `data-keep-params` so the browser sends it.
* UTM values are kept in their own fields, each cut at 200 characters. `ref`, `source` and `via` are read as `utm_source` when `utm_source` is absent.
* Query parameter names, without their values, are checked for ad click ids to classify a visit as paid. They are not stored.
* Duplicate slashes are collapsed, a trailing slash is removed, and the path is cut at 1,024 characters.

Anything you put in the path itself is stored as it is. If your URLs contain email addresses, tokens or other personal data in the path, add those pages to `data-exclude` or **Excluded paths**, or change the URLs.

## Fragments

The script never sends the fragment unless you add `data-hash`, and then only a route that starts with `#/` or `#!/`. The collector also keeps only a hash route that starts with `#/` or `#!/`, normalised like a path, and drops any query string inside it. Other fragments, such as `#pricing` or `#access_token=…`, are not stored.

## Location precision

Location comes from Cloudflare's estimate for the connection, not from the browser's location API. The collector keeps the country, region and city, and rounds latitude and longitude to 0.1 degree, about 11 km, before anything is broadcast to the live view or stored.

When the collector is reached through your own [proxy](https://docs.crispstats.com/tracking/proxy.md), the network location describes your server. A proxy that knows the visitor's location passes it in location headers, and the collector uses them the same way. Without them, only the country is kept, taken from the visitor's timezone name. See [location behind a proxy](https://docs.crispstats.com/tracking/proxy.md#location).

## Payments

Payments read from Stripe, Polar, Dodo Payments, Creem, Whop, Razorpay, Lemon Squeezy, RevenueCat and Superwall can include the customer's email address. The collector stores two derived values and never the address:

* a SHA-256 hash of the lowercased address, which links a customer's payments together,
* a masked form, such as `j***@e***.co.uk`, enough to recognise but not to contact.

Payments from Paddle, Shopify, the App Store and the Shopify App Store are stored without an email, so those payments have neither. Revenue sent with `crispstats.revenue()` carries no email at all. Each payment also stores the provider, its own id, kind, amount, currency, time, product name and the visitor, user and session ids it was attributed to. See [revenue attribution](https://docs.crispstats.com/revenue/overview.md).

## Domain Rating

For each site, the collector asks Ahrefs for the Domain Rating of the site's own domain, at most once a day. It sends the domain and nothing else: no visitor data and no site id. The value and its date are stored with the site and deleted with it.

## Widgets

For each widget, CrispStats keeps the time it was last loaded and the host name of the page it was loaded on, written at most once every 10 minutes. Widgets set no cookies, store nothing on a visitor's device and do not count the people who see them. IP addresses are used in memory for rate limiting only and are never stored.

## Data you control

CrispStats stores whatever you send in these fields, so keep personal data out of them unless you mean to collect it:

* custom event names and properties,
* the user id and traits you pass to `crispstats.identify()`, which are kept with events and in the visitor's profile,
* error messages and stacks from `data-errors`, which can contain URLs from your own site,
* page paths.

## Retention

Data is kept according to the plan of the workspace that owns the site, or its trial:

| Plan | Retention |
| - | - |
| Trial | 6 months |
| Starter | 24 months |
| Growth | 60 months |
| Scale | Kept while you are subscribed |

A daily job removes expired data. Cut-offs align to the start of a UTC month: on a 6-month plan, on 16 November everything before 1 May is removed, so you always keep at least the full retention period plus the current month. Retention applies to events, AI crawler hits, sessions, visitor profiles (by the date they were last seen), error groups, daily totals (including days [imported from Plausible](https://docs.crispstats.com/switch/import-from-plausible.md)) and resolved uptime incidents. Payments and refunds are kept on every plan until the site is deleted or you delete your account; to remove one buyer's payments, write to [privacy@crispstats.com](mailto:privacy@crispstats.com). When a workspace has no paid plan after its trial, or after a plan is cancelled or left unpaid, its sites and all their data are deleted 30 days later: see [when the trial or a plan ends](https://docs.crispstats.com/account/plans-and-limits.md#when-the-trial-or-a-plan-ends).

Some data has a fixed window on every plan: hourly totals are kept 35 days, raw uptime checks 90 days and alert delivery logs 90 days. When you delete a site, its payments are deleted with it, and a cleanup job removes its events, sessions, visitor profiles, AI crawler hits, uptime checks and totals.

## Learn more on crispstats.com

* Glossary: [cookieless tracking](https://crispstats.com/glossary/cookieless-tracking), [visitor hash](https://crispstats.com/glossary/visitor-hash) and [referrer](https://crispstats.com/glossary/referrer).

## Next steps

> [card] [Cookieless tracking](https://docs.crispstats.com/privacy/cookieless-tracking.md)
>
> How the visitor id is built from the IP address and User-Agent.

> [card] [Exclude traffic](https://docs.crispstats.com/tracking/exclude-traffic.md)
>
> Keep pages, hostnames and IP addresses out of your data.

> [card] [Plans and limits](https://docs.crispstats.com/account/plans-and-limits.md)
>
> Compare retention and allowances across plans.


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