Matomo vs PostHog: Which Analytics to Self-Host?
Quick Verdict
Matomo and PostHog solve different problems. Matomo is a web analytics platform — it tracks page views, referrers, campaigns, and user demographics, directly replacing Google Analytics. PostHog is a product analytics platform — it tracks user actions within your application (button clicks, feature usage, conversion funnels) and includes feature flags, session recording, and A/B testing. Most self-hosters need web analytics, which makes Matomo the more relevant choice. If you’re building a SaaS product and need to understand user behavior inside your app, PostHog is the better tool.
Overview
Matomo (formerly Piwik) has been the standard open-source analytics platform since 2007. It provides a complete Google Analytics replacement with dashboards, segments, goals, funnels, heatmaps (via plugin), and e-commerce tracking. Written in PHP with MySQL/MariaDB, it’s mature and stable. GDPR-compliant out of the box when self-hosted.
PostHog launched in 2020 as an open-source product analytics suite. Beyond event tracking, it bundles feature flags, session recording, experimentation (A/B tests), and a data warehouse. Written in Python (Django) with PostgreSQL, ClickHouse, Redis, and Kafka, it’s a significantly heavier stack optimized for product teams.
Feature Comparison
| Feature | Matomo | PostHog |
|---|---|---|
| Primary focus | Web analytics | Product analytics |
| Page view tracking | Core feature | Supported |
| Event tracking | Yes (custom events) | Core feature (autocapture) |
| Funnel analysis | Yes (Goals + Funnels) | Yes (built-in) |
| Session recording | Plugin (premium) | Built-in |
| Heatmaps | Plugin (premium) | Built-in |
| Feature flags | No | Built-in |
| A/B testing | Plugin (premium) | Built-in |
| User identification | Yes (visitor profiles) | Yes (person profiles) |
| Cohort analysis | Basic | Advanced |
| Data warehouse | No | Built-in |
| Real-time dashboard | Yes | Yes |
| Custom dashboards | Yes | Yes |
| API | REST API | REST + GraphQL |
| Google Analytics import | Yes (built-in) | No |
| WordPress plugin | Official plugin | Community plugin |
| Mobile SDK | iOS, Android | iOS, Android, React Native, Flutter |
| GDPR compliance | Built-in (cookieless mode) | Built-in |
| License | GPL-3.0 (core) | MIT (core) |
| Self-hosted pricing | Free (core) + paid plugins | Free (self-hosted) |
Installation Complexity
Matomo
Matomo runs on a standard LAMP stack — PHP + MySQL. The Docker setup is straightforward:
services:
matomo:
image: matomo:5.8.0-apache
ports:
- "8080:80"
volumes:
- matomo_data:/var/www/html
environment:
MATOMO_DATABASE_HOST: db
MATOMO_DATABASE_DBNAME: matomo
MATOMO_DATABASE_USERNAME: matomo
MATOMO_DATABASE_PASSWORD: secret
depends_on:
- db
db:
image: mariadb:11
volumes:
- db_data:/var/lib/mysql
environment:
MARIADB_ROOT_PASSWORD: root_secret
MARIADB_DATABASE: matomo
MARIADB_USER: matomo
MARIADB_PASSWORD: secret
Two containers. Works on 1 GB RAM. Setup takes 10 minutes.
PostHog
PostHog’s self-hosted stack is significantly heavier:
- PostHog web (Django)
- PostgreSQL
- ClickHouse (analytics database)
- Redis
- Kafka (event streaming)
- Object storage (MinIO or S3)
- Worker processes
The official installation uses a Helm chart or docker compose with 8+ containers. Minimum 4 GB RAM recommended; 8 GB for production.
Winner: Matomo — dramatically simpler to deploy and operate.
Performance and Resource Usage
| Resource | Matomo | PostHog |
|---|---|---|
| Minimum RAM | 1 GB | 4 GB |
| Recommended RAM | 2 GB | 8 GB+ |
| Idle RAM usage | ~200 MB | ~2 GB |
| Database | MySQL/MariaDB | PostgreSQL + ClickHouse |
| Container count | 2 (app + db) | 8+ (app + db + ClickHouse + Redis + Kafka + workers) |
| Disk usage (1M events) | ~2 GB | ~5 GB (ClickHouse stores raw events) |
| Scales to | Millions of page views/month | Billions of events/month |
Matomo can run comfortably on a $5/month VPS. PostHog’s ClickHouse + Kafka architecture is designed for high-volume product analytics at scale — it’s overkill for a personal blog but necessary for a SaaS with thousands of users.
Community and Support
| Metric | Matomo | PostHog |
|---|---|---|
| GitHub stars | ~20K | ~25K |
| First release | 2007 (as Piwik) | 2020 |
| Release frequency | Monthly | Weekly |
| Documentation | Comprehensive | Excellent |
| Community forum | forum.matomo.org | community.posthog.com |
| Commercial support | Matomo On-Premise (paid) | PostHog Cloud (free tier + paid) |
| Plugin ecosystem | 100+ plugins (marketplace) | Growing (apps framework) |
Both have strong communities. Matomo benefits from 19 years of maturity and a large plugin ecosystem. PostHog has aggressive development velocity and modern developer-focused documentation.
Use Cases
Choose Matomo If…
- You want a Google Analytics replacement for websites
- You need GDPR-compliant cookieless tracking without consent banners
- Your server has limited resources (1-2 GB RAM)
- You manage WordPress sites (official plugin)
- You want e-commerce tracking (WooCommerce, Shopify integration)
- You need to import existing Google Analytics data
- You run a blog, marketing site, or content site and need standard web analytics
Choose PostHog If…
- You’re building a SaaS product and need to understand user behavior
- You need feature flags to control rollouts
- You want session recording to watch how users navigate your app
- You need A/B testing built into your analytics platform
- You have 4+ GB RAM available for self-hosting
- Your team uses product-led growth methodology
- You need to track custom events at high volume (autocapture)
Final Verdict
These tools serve different audiences. Matomo replaces Google Analytics for website owners who want standard traffic analytics (page views, referrers, campaigns, goals) without sending data to Google. PostHog replaces Mixpanel and Amplitude for product teams who need behavioral analytics, feature management, and experimentation in one platform.
For most selfhosting.sh readers — people running personal sites, blogs, or small business websites — Matomo is the right choice. It’s lighter, simpler to deploy, and purpose-built for web analytics. PostHog is the right choice if you’re building software and need to understand how users interact with your product at a granular level.
If you want something even simpler than Matomo, consider Plausible (privacy-first, ~50 MB RAM) or Umami (lightweight, modern UI).
FAQ
Can Matomo replace PostHog for product analytics?
Not effectively. Matomo tracks web analytics (pageviews, referrers, campaigns) well, but it lacks PostHog’s core product analytics features: autocapture, session replays (free), feature flags, A/B testing (free), cohort analysis, and retention tracking. Matomo has paid plugins for session recording and A/B testing, but they cost €199+/year each. If you need product analytics, PostHog’s free self-hosted version includes all of these.
Can I run PostHog on a 4 GB VPS?
The official hobby deployment can start on 4 GB, but performance will be poor — ClickHouse and Kafka are memory-hungry, and you will hit swap frequently. PostHog recommends 8-16 GB for a reasonable experience. Matomo runs comfortably on 2 GB. If your VPS has 4 GB or less, use Matomo or a lighter tool like Plausible or Umami.
Does PostHog’s self-hosted version have usage limits?
The hobby deployment is designed for low-volume use (~100K events/month). Beyond that, performance degrades. PostHog’s commercial cloud product handles higher volumes with auto-scaling. For self-hosted high-volume usage, you need to manually tune ClickHouse and Kafka — which requires significant ops experience.
Can I import Google Analytics data into PostHog?
No. PostHog does not support Google Analytics data import. Matomo has a built-in GA import tool that pulls historical data from both Universal Analytics and GA4. If preserving your analytics history is important when migrating from Google Analytics, Matomo is the only option.
Which is better for GDPR compliance?
Both can be GDPR-compliant when self-hosted (data stays on your server). Matomo has a clearer compliance story — its cookieless mode, built-in consent management, and data anonymization features are well-documented. PostHog’s session replays capture DOM state, which may include personal data visible on screen. You need to carefully configure data masking and privacy settings in PostHog. For a straightforward GDPR setup, Matomo requires less configuration.
Can I use both together?
Yes — this is actually a good approach. Use Matomo for your public website (traffic analytics, SEO performance, campaign tracking) and PostHog inside your application (user behavior, feature usage, experiments). They serve different purposes and can coexist by adding both tracking scripts.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments