Your analytics script is probably the heaviest third-party resource on your page. We break down what GA4's script actually does, why it's so large, and how to replace it without losing anything meaningful.
Before you can understand why Google Analytics is 45 KB, it helps to understand what that code is doing. GA4's global site tag (gtag.js) needs to:
That's a lot of surface area. Most of it is features the average small-to-medium website never uses — but you load all of it on every page view.
The 45 KB figure is the compressed (gzip) size of gtag.js — the script Google tells you to add to your page. On a standard broadband connection, 45 KB feels fast. But performance impact goes beyond raw transfer size:
www.googletagmanager.com — a different domain. That DNS lookup adds latency on the first visit.async or defer (which many tutorials show incorrectly), it blocks HTML parsing entirely.www.google-analytics.com to send event data. Each request is a separate network round-trip.Google's own PageSpeed Insights tool routinely flags GA4 as a Lighthouse performance issue — specifically for "Reduce JavaScript execution time" and "Avoid chaining critical requests." That's Google's own tool flagging Google's own analytics script.
The features that add weight to analytics scripts are mostly there for large enterprise customers with complex attribution needs: advertising integrations, audience segmentation for ad retargeting, cross-domain tracking, data layer integration, tag manager compatibility.
If you're running a SaaS product, a blog, an e-commerce store, or a marketing site, you probably don't need any of that. What you actually want to know is:
Answering those five questions doesn't require 45 KB of JavaScript. It requires capturing a page view, a referrer URL, and a few custom events. That can be done in roughly 2 KB.
Web Analyzer App's tracker (tracker.js) weighs 2 KB minified and gzipped. Here's what it does:
popstate / pushState and fires a synthetic page viewTracker.track() call: sends a custom event with the provided name and optional JSON payloadThat's it. No advertising code. No consent mode API. No feature flags. No cross-domain tracking. Just the data collection your dashboard actually uses.
The practical Lighthouse impact depends on your site's baseline. For a typical marketing site, removing GA4 and replacing it with a 2 KB async tracker tends to improve:
For sites already passing Core Web Vitals, the change may not move your score noticeably. For borderline sites, removing a 45 KB third-party script is often one of the highest-impact single changes available.
Replacing GA4 with a lightweight alternative is a two-step process:
gtag.js script and its configuration block) from your page template.<head>:
<script>window.webanalyzer_key = 'YOUR_KEY';</script>
<script src="https://webanalyzerapp.com/tracker.js" async defer></script>
If you were using GA4 custom events, you can replicate them with Tracker.track('event_name', { your: 'data' }). The event shows up in your dashboard immediately — no tag manager required.
Ready to trim your page weight and get analytics that respect your visitors? Start for free — the tracker installs in under 2 minutes.