# Lightweight analytics: a script that adds almost nothing to your page

Updated 2026-11-23

Lightweight analytics is a tracking script small enough that it has no measurable effect on how fast your pages load: a few kilobytes, loaded without blocking, sending one small request per page. The CrispStats script is about 3.8 KB gzipped with every optional module included, or about 2.2 KB for the core build without them, and the build fails if either grows past its budget.

## Pageviews, sources and engagement in the core

The about 2.2 KB core counts pageviews, single-page navigation, time on page and scroll depth, with no cookies.

More: [Realtime](/features/realtime)

## Web vitals as an option

Turn on the vitals module and LCP, INP and CLS are measured from real visits, so you can check that your own pages stay fast.

More: [Web vitals](/features/web-vitals)

## JavaScript errors as an option

The errors module reports uncaught errors and unhandled rejections, at most 10 per page load, each distinct error once.

More: [Error tracking](/features/error-tracking)

## The rest of the work happens on the server

Channel classification, bot filtering, location and revenue matching all run at the edge and in the backend, not in your visitor's browser.

More: [Revenue attribution](/features/revenue-attribution)

## How big is the script?

The script ships in two builds. The default snippet loads the full one, where the optional modules are included but only run when you switch them on with an attribute on the script tag. If you never use them, the core build is smaller still.

Sizes from the tracker build, which fails over budget

| Build | What is in it | Gzipped |
| --- | --- | --- |
| Full (`d.js`, the default) | Core plus outbound links, downloads, 404 pages, web vitals and errors, each behind its attribute | about 3.8 KB |
| Core (`d.core.js`) | Pageviews, single-page navigation, engagement, custom events, identify and revenue calls | about 2.2 KB |

Installing it is one tag, loaded with `defer` so it never blocks rendering:

```html
<script defer src="https://in.crispstats.com/d.js" data-site="YOUR_SITE_KEY"></script>
```

## How much does a few kilobytes matter?

Put the size next to a typical page. HTTP Archive's [Web Almanac 2024 page weight chapter](https://almanac.httparchive.org/en/2024/page-weight) measured the median mobile page at 2,311 KB in its October 2024 crawl, with 570 KB of that as JavaScript.

A worked example with the Web Almanac 2024 medians

| Comparison | Calculation | Share |
| --- | --- | --- |
| Core script vs median mobile page | 2.2 ÷ 2,311 KB | 0.10% |
| Full script vs median mobile page | 3.8 ÷ 2,311 KB | 0.16% |
| Full script vs median mobile JavaScript | 3.8 ÷ 570 KB | 0.67% |

Under one percent of the JavaScript on a median page is noise next to an image or a font. That is the point of a lightweight script: it should never be the reason a page is slow.

## Is script size the whole story?

No. Bytes are the easy number to compare, but four other things decide whether analytics slows a page:

- **Blocking.** A script loaded with `defer` or `async` does not hold up rendering. One loaded synchronously in the head does, whatever its size.
- **Extra requests.** Some tools load a second script, a configuration file or a tag manager first. Each adds a round trip.
- **Main-thread work.** Listening to every click and mouse move, as replay and heatmap tools do, costs more CPU than counting a pageview. That shows up in [INP](/glossary/inp).
- **When data is sent.** Engagement here is sent when the page is hidden or left, not on a timer, so an open tab does not keep sending requests.

> **Quiet in your tests.** The tracker skips automated browsers and local pages by default, so browser tests that announce themselves as automated and pages on localhost do not inflate the numbers.

## How do you measure an analytics script's weight?

You do not need to trust anyone's number, ours included. In any browser's developer tools:

1. **Open the network panel** and reload the page with the cache disabled.
2. **Filter by the script's domain** and read the transferred size of the script itself. That is the compressed size your visitors download.
3. **Count every request to that domain.** Include configuration files and the requests that send data.
4. **Record a performance profile** and look for long tasks that start inside the script.

Then check the effect on real users rather than a lab score. The [web vitals](/features/web-vitals) report shows [LCP](/glossary/lcp), INP and [CLS](/glossary/cls) at the 75th percentile by page, so you can see whether any script change moved them. [Core Web Vitals in plain English](/blog/core-web-vitals-plain-english) explains the thresholds.

## What does a lightweight script give up?

A few kilobytes cannot record sessions or draw heatmaps, and this one does not try: there is no session replay, heatmap, A/B testing or feature flag code in it. If you need those, the tool that provides them will be heavier, and that is a fair trade to make knowingly.

## Frequently asked questions

### Does the analytics script affect Core Web Vitals?

Loaded with defer, it does not block rendering, so it should not move LCP or CLS. It does little work on the main thread, which keeps INP unaffected. Measure it on your own pages with the vitals report to be sure.

### Why is there a core and a full build?

The default full build carries optional modules such as outbound links, downloads, web vitals and errors, each switched on by an attribute. Sites that only need pageviews, sources and events can load the smaller core build instead.

### Can I serve the script from my own domain?

Yes. A first-party proxy serves the script and receives events on your own domain, which avoids a third-party connection and keeps it working with some ad blockers.

### Does it set cookies?

No. Nothing is written to the device unless you switch on the opt-in persistent visitors mode, so there is no cookie to manage and no consent prompt to load alongside it. Visitors are counted with a hash that rotates daily, computed on the server.

## Related

- [Core Web Vitals in plain English](/blog/core-web-vitals-plain-english)
- [Web vitals](/features/web-vitals)
- [Cookieless analytics](/analytics/cookieless-analytics)
- [Web analytics for developers](/for/developers)
