# CrispStats for developers: analytics, vitals and errors in one script

Updated 2026-11-16

CrispStats is one cookieless script, about 2.2 KB gzipped for the core, that reports traffic, custom events, web vitals and JavaScript errors. Everything it collects is available through a REST API and an MCP server on every plan.

## How do I add it to my app?

Use the script tag, or the npm SDK if you bundle your JavaScript. The SDK has a React component and hook, works with the Next.js App Router, is tree-shakeable and does nothing on the server. Single-page navigation through the History API is tracked with no extra code.

## Can I see real-user performance?

The vitals module reports [LCP](/glossary/lcp), [INP](/glossary/inp), [CLS](/glossary/cls), FCP and [TTFB](/glossary/ttfb) from real visits, following the web-vitals definitions, broken down by page and device.

## Can I catch JavaScript errors without another SDK?

The errors module sends uncaught errors and unhandled promise rejections with message, source, line and stack, grouped in the dashboard by the page and browser they hit.

## Can I query my data from code or an AI assistant?

The REST API is on every plan (10,000 requests a day on Starter, more on larger plans). The [MCP](/glossary/mcp) server lets Claude, Cursor and other MCP clients answer questions about your numbers.

## Can I see which AI crawlers hit my pages?

Crawlers do not run JavaScript, so a server helper reports [AI crawler](/glossary/ai-crawler) hits from your proxy, middleware or Worker. It sends only the user agent, path and status, and skips anything that is not a known AI crawler.

## Can I send events from the backend?

A server helper sends custom events and revenue from webhooks, crons and jobs with a secret key, using only `fetch`, so it runs on Node, Workers, Deno and Bun.

## What it does not do

- CrispStats is not open source and cannot be self-hosted.
- There are no mobile SDKs: the SDK targets the browser and server JavaScript.
- Error tracking covers JavaScript errors in the browser, not exceptions on your server.
- There is no session replay.

## Features to read next

- [Web vitals](/features/web-vitals): LCP, INP and CLS measured on real visits, by page and device.
- [Error tracking](/features/error-tracking): JavaScript errors grouped with the page and browser they hit.
- [Ask AI](/features/ask-ai): Ask about your numbers in plain words, in the app or over MCP.
- [AI traffic](/features/ai-traffic): Visitors sent by ChatGPT, Perplexity and Claude, plus AI crawler hits.
- [Uptime](/features/uptime-monitoring): Checks from outside your stack, with alerts and a status page.

## Your first week

1. **Add the script or SDK.** Turn on vitals and errors with `data-vitals` and `data-errors`, or pass the modules to `init`.
2. **Exclude yourself.** Run `localStorage.crispstats_ignore = 1` in your browser console so your own visits are not counted.
3. **Send your first custom event.** Call `crispstats("signup", { plan: "pro" })`, or use a `data-cs-event` attribute.
4. **Report AI crawlers.** Add the server helper to your proxy or Worker and hand its promise to `waitUntil`.
5. **Create an API key.** Pull stats into your own tools, or connect the MCP server to your editor.

## Frequently asked questions

### How big is the script?

The core is about 2.2 KB gzipped and the build with every optional module is about 3.8 KB. The build fails if either goes over its budget.

### Does it store anything in the browser?

No. The script sets no cookies and writes nothing to the device by default. Visitors are recognised for one day through a hash the collector rotates daily.

### Can I proxy it through my own domain?

Yes. Set the data-api attribute on the script tag to a path on your own domain, such as /stats, and forward that path to the collector.
