Why the tracker stays under 1 KB
The script that records page views loads on every page of your site, so it has a 1 KB budget. It weighs 829 bytes today. This is everything it does.
Ultanimus teamOn this page7 sections
Why the size matters
The tracker loads on every page of every site that uses it, on every phone and every network those visitors have. So it gets a budget like the rest of the product. The limit is 1 KB gzipped, and the build fails past it.
What it sends
One JSON object per event, holding:
- your site ID and the event name
- the page address, and the referrer on the first event only
- the window width and the browser language
- any properties you add
- a random event ID, so ingest can drop a repeat
That is the whole list. The script reads no cookies, sets none and never touches local storage.
How it sends
navigator.sendBeacon hands each request to the browser, so it still goes out when the visitor closes the tab. If the browser refuses the beacon, the script falls back to fetch with keepalive and credentials turned off.
It never waits for an answer, so nothing on your page waits on it either.
What it skips
- Browsers that say they are automated, through
navigator.webdriver. - Pages the browser prerenders but the visitor never opens. The script waits until the page is shown.
- A second copy of the script for the same site. It reports the duplicate instead of counting the page twice.
- A navigation to the same path and query string.
Single-page apps
The script wraps history.pushState and listens for popstate, so a client-side navigation counts as a page view with no setup. Calls to track() made before the script loads wait in a queue and go out once it starts.
Extras load only where you use them
Anything optional goes into an add-on with its own 1 KB budget. The first one records clicks on links to other sites and on file downloads. It weighs 483 bytes gzipped, and the tracker loads it only when the script tag asks for it with data-outbound or data-downloads. A site that does not use it never downloads it.
The numbers
The script is 1,478 bytes minified and 829 bytes gzipped. The build prints both sizes on every change and fails when a file passes its budget.
Adding it to a site takes one script tag, and Links and downloads covers the add-on.