Self-Hosted Google Analytics Alternative 2026
TL;DR
The three best self-hosted Google Analytics alternatives in 2026 are Plausible (fastest setup, GDPR-ready by default), Umami (cleanest dashboards, easiest Docker setup), and Matomo (full GA feature parity including heatmaps, funnels, and ecommerce tracking). All three track 100% of visitors — no cookie consent banners, no ad blocker interference. Google Analytics 4 misses 25–40% of traffic because of cookie rejection and ad blocker blocks.
Key Takeaways
- Plausible (AGPL-3.0, 24K+ stars) — 1 KB script, cookieless by default, GDPR-compliant out of the box, $6/month cloud or free self-hosted
- Umami (MIT, 23K+ stars) — the simplest Docker setup (1 container + 1 DB), clean dashboard, 1M events/month free on cloud
- Matomo (GPL-3.0, 20K+ stars) — the most complete GA replacement, PHP-based, includes heatmaps, A/B testing, funnels, and ecommerce tracking
- PostHog (MIT, 25K+ stars) — adds product analytics (session replay, feature flags, experiments) on top of web analytics
- Self-hosted analytics capture 100% of real traffic because first-party scripts aren't blocked by uBlock Origin, Brave, or Safari ITP
- GA4's data model is sampling-based at high volumes — self-hosted tools store exact event counts
Why Self-Host Your Analytics?
Privacy compliance is the primary driver. Data protection authorities in Austria, France, Italy, Norway, and Sweden have ruled that using Google Analytics for EU visitors violates GDPR because it transfers personal data (IP addresses, device identifiers) to US servers. Self-hosted analytics keep all visitor data on your own infrastructure — no transatlantic data transfer, no consent requirement under ePrivacy.
Accuracy is the second reason. GA4 requires cookie consent, and 30–50% of EU visitors reject consent banners. Brave blocks GA by default. Firefox with Enhanced Tracking Protection blocks Google domains. The result: GA4 often shows 60–70% of actual traffic. Plausible's script loads from your own domain — no blocklists target it.
Cost is the third reason. Google Analytics 360 (the paid enterprise tier) costs ~$150,000/year. GA4 free is genuinely free, but if you need raw data exports, BigQuery ML integration, or SLAs, you're looking at enterprise contracts.
Feature Comparison
| Feature | Plausible | Umami | Matomo | PostHog |
|---|---|---|---|---|
| License | AGPL-3.0 | MIT | GPL-3.0 | MIT |
| GitHub Stars | 24K+ | 23K+ | 20K+ | 25K+ |
| Script Size | < 1 KB | ~2 KB | ~22 KB | ~6 KB |
| Cookies Required | No | No | Optional | Optional |
| Real-time Dashboard | Yes | Yes | Yes | Yes |
| Custom Events | Yes | Yes | Yes | Yes |
| Goals & Funnels | Goals only | Basic | Full funnels | Full funnels |
| Heatmaps | No | No | Yes (plugin) | No |
| Session Recording | No | No | Yes (plugin) | Yes |
| A/B Testing | No | No | Yes | Yes |
| Ecommerce Tracking | Basic | No | Full | Basic |
| API | REST | REST | REST | REST |
| SSO | Yes | Yes | Yes | Yes |
| Multi-site | Yes | Yes | Yes | Yes |
| Setup Time | 10 min | 5 min | 30 min | 20 min |
| Min RAM | 512 MB | 256 MB | 512 MB | 2 GB |
Option 1: Plausible — Best for Most Sites
Plausible loads a 1 KB script (vs Google Analytics' ~35 KB) and stores no personally identifiable information. It's fully cookieless and doesn't require GDPR consent banners in the EU under its default configuration.
Self-Hosting Plausible
# docker-compose.yml
version: "3.8"
services:
plausible_db:
image: postgres:16-alpine
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
plausible_events_db:
image: clickhouse/clickhouse-server:24.3
restart: unless-stopped
volumes:
- event-data:/var/lib/clickhouse
- ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml
- ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml
ulimits:
nofile:
soft: 262144
hard: 262144
plausible:
image: ghcr.io/plausible/community-edition:v2
restart: unless-stopped
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
- plausible_db
- plausible_events_db
ports:
- "8000:8000"
environment:
BASE_URL: https://analytics.yourdomain.com
SECRET_KEY_BASE: "${SECRET_KEY_BASE}"
DATABASE_URL: "postgres://postgres:${POSTGRES_PASSWORD}@plausible_db:5432/plausible"
CLICKHOUSE_DATABASE_URL: "http://plausible_events_db:8123/plausible_events"
volumes:
db-data:
event-data:
Create clickhouse/logs.xml:
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<query_thread_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<part_log remove="remove"/>
</clickhouse>
# Generate secret key
openssl rand -base64 64 | tr -d '\n'
Plausible uses ClickHouse for event storage — this is what makes it fast at high page view volumes. The setup is the most complex of the three options here, but the performance payoff is worth it at 100K+ pageviews/month.
For a complete walkthrough including SMTP for email reports, see how to self-host Plausible Analytics.
Option 2: Umami — Simplest Setup
Umami (MIT) is the fastest to deploy — a single Next.js container with a PostgreSQL database. The dashboard is minimal and clean: top pages, referrers, countries, devices, events. Nothing more.
Self-Hosting Umami
# docker-compose.yml
version: "3.8"
services:
umami-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: umami
POSTGRES_USER: umami
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
volumes:
- umami-db-data:/var/lib/postgresql/data
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
restart: unless-stopped
depends_on:
- umami-db
ports:
- "3000:3000"
environment:
DATABASE_URL: "postgresql://umami:${POSTGRES_PASSWORD}@umami-db:5432/umami"
APP_SECRET: "${APP_SECRET}"
volumes:
umami-db-data:
Default admin credentials: admin / umami. Change these immediately in Settings → Users.
Umami is a 256 MB RAM tool — runs on the smallest VPS you can find. If you just need page view counts, sessions, and basic referrer data, Umami is all you need.
Option 3: Matomo — Full GA Replacement
Matomo (GPL-3.0) is the only self-hosted analytics tool that replicates every major Google Analytics feature: goal tracking, multi-step funnel analysis, ecommerce revenue tracking, content A/B testing, and heatmaps (via the free HeatmapSessionRecording plugin on self-hosted).
For the complete Matomo setup guide including WordPress plugin, reverse proxy config, and GDPR consent management, see how to self-host Matomo web analytics.
Matomo requires more resources — a PHP + MariaDB stack, 512 MB+ RAM — and the setup takes 30 minutes vs Umami's 5 minutes. The payoff is a dashboard that non-technical stakeholders recognize as "analytics" because it looks and works like GA.
When to Use Which
Choose Plausible if:
- You want the smallest script footprint and best performance impact on your site
- GDPR compliance out of the box is non-negotiable
- You want clean, simple charts that don't require training to interpret
Choose Umami if:
- You want the fastest possible Docker setup (one container + one DB)
- Your analytics needs are basic: page views, referrers, devices, countries
- You need MIT license instead of AGPL (commercial product integration)
Choose Matomo if:
- You need heatmaps, session recordings, A/B testing, or ecommerce tracking
- You're replacing a Google Analytics 360 deployment and need feature parity
- Your team is already familiar with GA's reporting model
Choose PostHog if:
- You need product analytics alongside web analytics (feature flags, session replay, user paths)
- You're a SaaS product team rather than a content/marketing team
For a full comparison including PostHog and Open Web Analytics, see Best Open Source Alternatives to Google Analytics in 2026.
Tracking Accuracy: First-Party vs Google Analytics 4
The accuracy gap between GA4 and first-party analytics has grown significantly as privacy defaults have tightened. Understanding the mechanics helps set expectations:
Why GA4 undercounts visitors: GA4's tracking script (gtag.js) is loaded from Google's CDN (www.googletagmanager.com). Major ad blockers (uBlock Origin, AdGuard) maintain block lists that include Google's analytics domains by default. Safari's Intelligent Tracking Prevention (ITP) deletes cross-site tracking cookies within 7 days by default. Brave Browser blocks Google Analytics without any extension. The combined effect: GA4 typically captures 60–75% of actual traffic for a general audience, and as low as 40% for a developer-focused audience where ad blocker adoption is highest.
Why self-hosted tools capture more: Plausible's script loads from your-analytics-subdomain.yourdomain.com — first-party. No block list targets a URL on your own domain. Umami's script tag is served from your server. Matomo's tracking script can be configured in "first-party mode" where both the script and the collection endpoint are on your domain. Ad blockers cannot distinguish these from legitimate first-party scripts without site-specific rules.
The 30–40% accuracy improvement is real for most sites. For an e-commerce site analyzing funnel conversion rates, the difference between 60% and 100% traffic capture can mean the difference between a statistically meaningless sample and actionable data.
Caveat: Self-hosted tools still can't track users who block JavaScript entirely (a tiny fraction) or who use privacy-preserving browsers with all scripting disabled. But these users are uncountable by any means.
GDPR and ePrivacy Compliance: What "Cookieless" Actually Means
Plausible and Umami are commonly described as "cookieless" and "GDPR-compliant by default." Understanding what this means in practice matters for legal compliance:
What cookieless means: These tools don't set any cookies — no _ga cookie, no session cookie, no persistent identifier in the browser's cookie store. They can't track users across sessions by default. Each page view is counted independently. Returning users aren't re-identified.
How they count unique visitors without cookies: Plausible uses a daily rotating hash based on IP address + User-Agent + domain. This creates a pseudonymous identifier that expires in 24 hours and is never stored. Umami uses a similar approach. Matomo in cookieless mode uses a session hash that expires with the browser session.
What this means for consent requirements: Under ePrivacy Directive Article 5(3), cookies (and similar tracking mechanisms) require prior informed consent in the EU unless they are "strictly necessary" for the service. Plausible and Umami's daily hash doesn't persist beyond 24 hours and contains no personal data — it doesn't constitute a "persistent identifier" under most EU DPA interpretations. Austrian, French, and Swedish DPAs that have ruled against Google Analytics have specifically cited the transfer of personal data to US servers; these rulings don't apply to self-hosted, cookieless analytics.
Practical result: Plausible and Umami can be deployed on EU-visitor sites without a cookie consent banner. Matomo in cookieless mode similarly avoids consent requirements. Add a line to your privacy policy describing the session hashing approach, and you're covered.
Caveat: If you enable Matomo's "cookie tracking" mode (which uses persistent cookies for cross-session user identification), consent requirements apply again.
Advanced Custom Event Tracking
All three tools support custom events beyond page view tracking. The implementation pattern is consistent:
Plausible custom events:
<!-- Track button click -->
<button onclick="plausible('Signup Button Clicked', {props: {plan: 'pro'}})">
Sign up for Pro
</button>
// Track form submission with context
document.querySelector('#contact-form').addEventListener('submit', function() {
plausible('Contact Form Submitted', {
props: { source: document.referrer || 'direct', page: window.location.pathname }
});
});
Umami custom events:
// umami.track() — same pattern
umami.track('Signup Button Clicked', { plan: 'pro' });
Matomo custom events:
// Matomo tracks with category/action/name/value
_paq.push(['trackEvent', 'User Actions', 'Signup', 'Pro Plan', 1]);
Plausible and Umami's custom event model (named event + flat properties object) is simpler and works well for most tracking needs. Matomo's four-parameter model (category, action, name, value) provides more structured data but requires more thought upfront to define a consistent taxonomy.
For SaaS applications tracking trial-to-paid conversion funnels, custom events on key actions (trial start, feature first-use, paywall encounter, checkout initiation, payment success) give you the funnel data GA4 provides without sending user behavior data to Google.
Methodology
Script size and feature data from each project's official documentation and GitHub repositories as of April 2026. Privacy analysis based on CNIL (France) and Austrian DSB guidance on Google Analytics and first-party analytics. Block rate estimates from published academic research on ad blocker adoption (2024) and browser privacy defaults. VPS cost estimates from Hetzner cloud pricing.
Server Requirements & Cost
| Tool | Min RAM | Disk | Monthly VPS Cost | Handles |
|---|---|---|---|---|
| Umami | 256 MB | 5 GB | ~$4 (1 vCPU/512MB) | 1M pageviews/month |
| Plausible | 512 MB | 10 GB | ~$6 (1 vCPU/1GB) | 10M+ pageviews/month |
| Matomo | 512 MB | 20 GB | ~$6 (1 vCPU/1GB) | 2M pageviews/month |
| PostHog | 2 GB | 50 GB | ~$12 (2 vCPU/4GB) | 1M events/month |
Self-hosting all four of these combined costs less than a single month of Google Analytics 360.