How a 2 KB Analytics Tracker Keeps Your Core Web Vitals Green
Traditional analytics scripts are heavy enough to move your Lighthouse score. Here is what a lightweight tracker does differently — and why it matters for real users.
Core Web Vitals are now a ranking signal. A slow analytics script is no longer just an inconvenience — it's a direct hit to your SEO and to the experience of every visitor on a slow connection. The irony of measuring your site's traffic with a script that degrades your site is real.
What traditional analytics scripts cost you
Google Analytics 4's global site tag is approximately 45 KB transferred. It makes several network requests on load — to collect.js, to the measurement protocol, and sometimes to additional feature scripts. On a mobile device on a 4G connection, that's a measurable delay before your page is interactive.
The impact shows up in three ways. First, the script request itself competes with your content for network bandwidth. Second, any synchronous execution blocks the main thread. Third, every subsequent analytics event (session start, page_view, engagement) triggers additional outbound requests.
How a lightweight tracker changes the math
Monoid's tracker is under 2 KB minified and gzipped. It loads with a plain async attribute, which means the browser downloads it in the background without blocking HTML parsing or rendering. Largest Contentful Paint is not affected because the script never sits in the critical rendering path.
When a pageview fires, the tracker sends a single POST to the collection endpoint:
fetch('/collect', {
method: 'POST',
keepalive: true,
body: JSON.stringify({ site_id, path, referrer, ... })
})
The keepalive: true flag is the key detail. It tells the browser to keep the request alive even if the user navigates away before it completes — the same mechanism the navigator.sendBeacon API uses, but with full JSON support. You get reliable delivery without blocking navigation.
The three Core Web Vitals, one by one
Largest Contentful Paint (LCP) measures when the main content is visible. An async script that isn't in the critical path doesn't delay LCP at all. The tracker has no DOM manipulation and doesn't load any images.
Interaction to Next Paint (INP) measures responsiveness to user input. The tracker's event listeners are read-only and lightweight — a single popstate listener for SPA navigation. No long tasks, no layout thrashing.
Cumulative Layout Shift (CLS) measures unexpected layout movement. The tracker adds no elements to the DOM, so it contributes zero layout shift.
Running a Lighthouse audit
If you want to quantify the difference, run a Lighthouse audit on a page before and after adding the tracker. You should see no change in Performance score. The tracker will appear in the network waterfall as a late-loading async script — small, fast, and outside the critical path.
Compare that with a GA4 audit, where Lighthouse will often flag the analytics tag under "Reduce the impact of third-party code" and report a thread-blocking time contribution.
Performance is a privacy argument too
There's a connection between script weight and privacy that's worth stating plainly: heavy analytics scripts are heavy because they do more. More tracking, more device identification, more behavioral profiling. The 2 KB tracker is small because it only collects what it needs — a handful of non-personal signals per pageview. Broad browser family and device type are derived server-side from the request User-Agent, while full User-Agent strings, browser versions, cookies, persistent identifiers, and device fingerprints are never stored.
Choosing lightweight analytics isn't a trade-off between performance and insight. It's recognizing that the extra weight in traditional tools comes from data collection you probably didn't ask for.