How much faster and smaller are lightweight analytics trackers compared to Google Analytics 4?
TrimStats ships its entire tracker (t.js) at 1,964 bytes gzipped and 1,732 bytes over Brotli (3,508 bytes uncompressed), roughly 20x smaller than base Google Analytics 4 gtag.js (35 to 45 KB gzipped) and 68x smaller than GA4 paired with Google Tag Manager (135+ KB). Using text/plain sendBeacon also eliminates CORS OPTIONS preflight round trips on every event.
- Measured directly from packages/tracker/dist/t.js, TrimStats transfers 1,732 bytes via Brotli and 1,964 bytes via gzip level 9 with zero external dependencies.
- An automated CI script (packages/tracker/scripts/check-size.mjs) fails any pull request that pushes t.js past a 3,072-byte (3 KiB) gzipped hard ceiling.
- Sending beacons via navigator.sendBeacon with Content-Type: text/plain qualifies as a CORS simple request, eliminating extra OPTIONS preflights on every pageview.
- Unlike lightweight trackers that strip out funnels, cohorts, revenue webhooks, and UI friction, TrimStats keeps all capabilities inside one sub-2 KB bundle.
Why script bytes still matter in 2026
Every kilobyte of third-party JavaScript added inside <head> is taxed twice: once on the wire over mobile networks, and again on the browser main thread during parse, compile, and execution. On mid-tier Android hardware, decompressing and executing 135 KB of tag manager and analytics libraries directly delays framework hydration and hurts Interaction to Next Paint (INP).
Many engineering teams assume lightweight trackers force a downgrade to bare pageview counters. To test what actually fits inside a strict sub-2 KB transfer budget, we measured our production build of TrimStats t.js alongside verified public specs for Google Analytics 4, Plausible, Fathom, and Umami.
TrimStats transfers 20x smaller than GA4 gtag.js and 68x smaller than GA4 + GTM
Compressed network transfer weight in kilobytes (KB, gzipped)
Base gtag.js alone transfers roughly 20x more compressed JavaScript than TrimStats t.js before a single marketing tag or consent SDK loads.
Methodology: TrimStats measured directly from packages/tracker/dist/t.js using zlib gzip level 9. Third-party figures reflect documented vendor specifications and public network transfer benchmarks.
View chart data table
| Label | Gzipped script transfer |
|---|---|
| TrimStats t.js (all-in-one + friction) | 1.96 KB |
| Umami script.js | ~2.0 KB |
| Fathom script.js | ~2.1-2.7 KB |
| Google Analytics 4 (base gtag.js) | ~35-45 KB |
| GA4 + Google Tag Manager + Signals | ~135 KB |
Measuring packages/tracker/dist/t.js byte by byte
TrimStats compiles packages/tracker/src/index.ts with esbuild into a single zero-dependency browser IIFE (dist/t.js). Rather than estimating size from marketing copy, every build runs packages/tracker/scripts/check-size.mjs against the real artifact:
# Reproducible measurement against compiled packages/tracker/dist/t.js
wc -c packages/tracker/dist/t.js # 3,508 bytes raw minified
gzip -9 -c packages/tracker/dist/t.js | wc -c # 1,964 bytes gzipped (1.96 KB)
brotli -c packages/tracker/dist/t.js | wc -c # 1,732 bytes Brotli (1.73 KB)
We enforce a hard CI budget of 3,072 bytes (3 KiB) gzipped so future feature additions can never quietly bloat the tracker into a 20 KB SDK. Today the shipped bundle sits 36% below that ceiling.
Exact TrimStats t.js byte measurements across encodings vs CI hard budget
Compiled artifact packages/tracker/dist/t.js measured in kilobytes (KB)
Keeping uncompressed minified JavaScript under 4 KB ensures fast main-thread parsing even on low-end mobile CPUs.
Methodology: Measured directly on macOS against packages/tracker/dist/t.js using wc -c, gzip -9, brotli, and packages/tracker/scripts/check-size.mjs.
View chart data table
| Label | Artifact size |
|---|---|
| Brotli transfer (CDN default) | 1.73 KB |
| Gzip level 9 transfer | 1.96 KB |
| CI hard gzip budget | 3.07 KB |
| Uncompressed minified JS | 3.51 KB |
What actually fits inside 1,964 bytes gzipped
Keeping an analytics script under 2 KB requires disciplined engineering rather than stripping out useful SaaS telemetry. Inside 1,964 B gzipped, t.js handles eight distinct jobs with zero runtime dependencies:
- Automatic pageviews & SPA routing: Wraps
history.pushStateand listens topopstatefor Next.js App Router, React Router, Vue, and Astro View Transitions. - Visibility-aware active engagement: Pauses dwell timing whenever
document.visibilityState === 'hidden'so background tabs never inflate visit time or distort the 10-second bounce rule. - Outbound link & file download capture: Detects external origins and common downloadable asset extensions automatically via delegated listeners.
- Dual-mode identity: Writes zero storage in default cookie-less mode and persists
_ts_vid+_ts_attrinlocalStorageonly whendata-mode="first-party"is opted in. - Pre-load FIFO command queue: Replays queued
window.trimstats.qcalls foreventandidentifybefore dispatching the initial pageview. - Checkout attribution snapshot: Exposes
window.trimstats.attribution()so Stripe, Paddle, and Polar checkouts attach clean acquisition metadata. - Opt-in UI friction diagnostics: Attaches rage-click, dead-click, and 90% scroll detectors only when
data-friction="true"is present. - Zero-preflight beacon delivery: Submits JSON payloads via
navigator.sendBeaconwithnew Blob([body], { type: 'text/plain' }), avoiding cross-originOPTIONSpreflight round trips on every hit.


Lightweight scripts vs pricing at SaaS scale
Performance is only half of the evaluation for growing SaaS products. Many lightweight analytics vendors charge steep feature gates once you need multi-step funnels, revenue attribution, or 1M to 5M monthly events.
When comparing verified November 2026 cloud pricing across full-featured tiers:
- Plausible Analytics ships a sub-1 KB base script for pure traffic, but requires its Business tier (
$39/moat 100k,$139/moat 1M,$259/moat 5M) to unlock funnels and revenue tracking. - Fathom Analytics scales cleanly on sites and forever retention (
$15/moat 100k,$60/moat 1M,$140/moat 5M), but omits funnels, cohorts, signed revenue webhooks, and UI friction. - Umami Cloud is aggressive at 1M events (
$20/moPro), then meters$0.00003per extra event ($140/moat 5M) and gates replays/heatmaps behind$200/moBusiness. - TrimStats includes every feature across all tiers:
$17(100k),$44(1M), and$134(5M events/month) with a 20% soft grace buffer and bot traffic dropped pre-billing.
Monthly cloud cost across lightweight privacy analytics at 100k, 1M, and 5M events
Verified monthly USD pricing for full-featured plans (Nov 2026)
At 5M monthly events, TrimStats Scale ($134/mo) saves $6/mo vs Fathom and Umami Pro overages and $125/mo vs Plausible Business.
Methodology: Monthly USD billing verified on 2026-11-30 from official vendor pricing pages. Plausible Business shown for funnel/revenue parity; Umami 5M includes $20 base + 4M x $0.00003 overage.
View chart data table
| Label | TrimStats (All features) | Fathom Analytics | Umami Pro (+ overages) | Plausible Business |
|---|---|---|---|---|
| 100k events | $17/mo | $15/mo | $20/mo | $39/mo |
| 1M events | $44/mo | $60/mo | $20/mo | $139/mo |
| 5M events | $134/mo | $140/mo | $140/mo | $259/mo |
Reproducing the check on your own site
Open Chrome DevTools on any production site, switch to the Network tab with Disable cache enabled, filter by JS, and compare the total Transferred and Resource bytes of your current analytics and tag manager scripts against 1.96 KB gzipped.
Pay attention to three numbers rather than just the first script request:
- Chained requests: Tag managers often download an initial 35 KB loader that dynamically injects two or three extra 25 to 60 KB scripts during hydration. Sum every third-party analytics and tag request triggered before load settles.
- Main-thread scripting duration: Open the DevTools Performance panel with 4x CPU throttling enabled and look for long tasks attributed to analytics scripts during page load and first user click. A 3,508-byte zero-dependency script parses in sub-millisecond time, whereas 135 KB bundles regularly consume 30 to 90 ms of mobile main-thread time right when users try to click hero buttons.
- Beacon network overhead: Filter the Network panel by
collectorg/collectand verify whether each pageview fires a singlePOSTrequest or triggers a pairedOPTIONSpreflight first. Eliminating preflights saves an entire TCP/TLS round trip on every route change over mobile networks.
Enforcing script size as a permanent CI invariant
Performance budgets fail whenever they rely on periodic manual audits. In TrimStats, packages/tracker/scripts/check-size.mjs runs automatically after esbuild bundles t.js, compressing the output at gzip level 9 and exiting non-zero if size ever crosses 3,072 bytes. Treating tracker bytes like a failing unit test guarantees Core Web Vitals stay protected as new analytics capabilities ship on the server side in ClickHouse instead of inside visitor browsers.
If you want to see how we also fit privacy-safe rage-click and dead-click detection inside the exact same 1,964 B bundle without session-replay overhead, read How TrimStats Detects UI Friction Without Session Replay.
Frequently asked questions
Why does analytics script size affect Core Web Vitals if the script has defer?
How does TrimStats avoid CORS OPTIONS preflight requests on every pageview?
Does Plausible have a smaller base script than TrimStats?
How can I verify the actual transferred size of any analytics script on my site?
Does TrimStats enforce its sub-2 KB tracker weight automatically in CI?
Does enabling opt-in UI friction or revenue attribution increase TrimStats script bytes?
Sources & references
- TrimStats Tracker Size Budget Script (check-size.mjs)Accessed 2026-11-30
- Plausible Analytics Pricing & Script SpecsAccessed 2026-11-30
- Fathom Analytics Official PricingAccessed 2026-11-30
- Umami Cloud Official PricingAccessed 2026-11-30
Co-founder of DotCamp LLC in Brooklyn, NY and lead engineer of TrimStats. Ships privacy-first web analytics, ClickHouse pipelines, and WordPress plugins used on 115,000+ active sites.
- • Architect of the TrimStats 1.96 KB gzipped browser tracker, Fastify collector, and ClickHouse MergeTree pipeline
- • Co-founder of DotCamp LLC (est. 2019), creator of Ultimate Blocks (50,000+ installs), WP Table Builder (50,000+ installs), Tableberg, and OptimizeCamp
- • WordPress.org plugin & theme developer since 2016 with 1,200+ community support replies and 5M+ cumulative plugin downloads
Verification standard: First-party benchmark: Direct byte measurements of compiled packages/tracker/dist/t.js (raw, gzip level 9, Brotli) paired with verified Nov 2026 vendor specs and pricing tiers.
Continue reading
Measure traffic, revenue, and UI friction in 1.96 KB gzipped
Cookie-less by default, powered by ClickHouse, and starting at $17/month for 100,000 monthly events with every feature unlocked.