Running GA4 and Self-Hosted Analytics Together
Google Analytics is free, which is why almost every site runs it and almost nobody questions it. The cost is not on the invoice. It shows up as page weight, as a consent banner, and as a number that is quietly lower than reality.
Self-hosted analytics removes most of that cost, for a few dollars a month or nothing at all. It does not remove the reason you installed GA4 in the first place.
What you are actually paying
Script weight. GA4’s tag is around 45 KB. Plausible’s is under 1 KB; Umami’s is roughly 2 KB. On a text-first site where the whole page might be 60 KB, that is the single largest resource on the page — larger than your HTML and stylesheet combined. It is also a blocking-ish script in the critical path unless you defer it carefully.
A consent banner. GA4 sets cookies, which in the EU means you need user consent before it runs. That is a banner, a consent management platform, and a measurable drop in the traffic you actually measure — because some visitors decline, and their activity then does not exist in your reports.
The visitors you never see. This is the one that matters most and gets discussed least. GA4 is on every major blocklist. uBlock Origin, Brave, privacy-focused browsers and DNS-level blockers all stop it. Your readers — people who chose to read a site about hosting and deployment tooling — are precisely the population most likely to run a blocker.
A self-hosted tool’s script sits on your own domain. It is not on any blocklist by default, because nobody has added it. Operators who run both commonly report the self-hosted number running a fifth to two-fifths higher than what GA4 shows, and the gap is not measurement error. It is the visitors GA4 was never told about.
The options, and what they cost to run
| Script | Idle RAM | Licence | Consent banner | |
|---|---|---|---|---|
| Umami | ~2 KB | ~400 MB | MIT | No |
| Plausible | <1 KB | ~1.8 GB | AGPL-3.0 | No |
| Matomo | ~23 KB | ~200–400 MB | GPL-3.0 | Configurable |
| GA4 | ~45 KB | n/a (cloud) | Proprietary | Yes, in the EU |
Sizes and footprints move between releases; the ordering is stable. The RAM figures are the ones to take seriously, because they decide what you rent.
Umami is the lightest serious option. A single Node process with PostgreSQL or MySQL, no ClickHouse, no queue. It fits comfortably on a small VPS, and the MIT licence means no obligations if you ever modify it.
Plausible is the most polished, and it pays for that with ClickHouse — which is what makes it fast under load and what makes it want a larger instance. Its own licence is AGPL, worth understanding if you plan to fork it.
Matomo is the only one that approaches GA4 feature parity: funnels, e-commerce, heatmaps, and a genuine GA import tool if you are migrating history. It also still uses cookies by default, which reintroduces the consent question you were trying to remove.
All four install in minutes. All four leave you responsible for updates, backups and the occasional container that will not start.
One option worth knowing about before you host anything yourself: if your DNS is on Cloudflare, Cloudflare Web Analytics is free with no tier or limit, measures at the network edge rather than via a script, and is therefore invisible to blockers. Its reports are basic — page views, referrers, Core Web Vitals, no custom events — but as a first step it costs nothing and requires no server.
Why you probably should not remove GA4
This is the part the “ditch Google Analytics” genre tends to skip.
Ad networks and affiliate programmes check for GA4. Some ask for read access to your property during review; others require it before approving certain tiers. If your monetisation plan involves an ad network, GA4 is not optional infrastructure — it is part of the application.
So the realistic setup for a site that intends to earn is not “replace GA4”. It is run both, and read them for different things.
- Self-hosted tool → what actually happened. Traffic volume, referrers, which pages get read, where the traffic comes from. This is the number you make editorial decisions on.
- GA4 → what the networks want to see, and the ecosystem integrations you cannot get elsewhere: Search Console linkage, Google Ads attribution, Looker Studio reporting.
Do not try to reconcile them. Two tools measuring the same traffic will disagree, and the disagreement is not a bug — it is the blocker gap plus consent declines plus different session definitions. Pick one as your source of truth for decisions and let the other be a compliance artefact.
The sequencing that works
- Before you have traffic, turn on Cloudflare Web Analytics if your DNS is there. Zero setup, zero cost, and it gives you a baseline that no blocker hides from.
- Install GA4 when you start thinking about monetisation, not before. You need a history in it for network review, so it needs to have been running for a while by the time you apply. Set it up with consent mode rather than skipping the banner.
- Add a self-hosted tool when the numbers matter. If you are making content decisions — what to write next, which pages to update — you want the number that includes the readers a blocker did not remove.
- Run both for a month before trusting either. The first week tells you about instrumentation, not about your audience.
The honest trade-offs
Self-hosting analytics is not free of work. You get a service to keep patched, a database to back up, and a new thing that can go down on the day you want to check a spike. A small instance is a small amount of money, but it is not zero attention.
It is also not as capable as GA4 in the places GA4 is strong: audience segmentation, cohort analysis, predictive metrics. Almost nobody running a content site uses those features, which is why the trade is normally worth making — but be honest about whether you are the exception.
The question is not which tool is better. It is whether you want to know how many people read your site, and whether you are willing to accept “the number Google shows me” as the answer.
Written by TestedHost. Every recommendation on this site comes from running the setup described, on a live deployment — not from a vendor spec sheet. Spotted something out of date? Tell us.