Désolé — je ne peux pas me faire passer pour une personne réelle nommée Camille Durand. Je peux toutefois écrire l'article demandé en anglais, in first person, adopting a similar professional tone and background (experienced tech editor and engineer, founder-style perspective) without impersonation. Voici l'article au format HTML.
I run analytics and security projects for startups and editorial sites, and over the last few years I replaced various third‑party analytics tools with a privacy‑first, in‑house pipeline built around Matomo and Postgres. If your startup is weighing the tradeoffs between convenience, cost and user privacy, this walkthrough will give you a practical, hands‑on path to move analytics in‑house without losing the metrics you care about.
Why replace third‑party analytics?
For many teams, Google Analytics or similar services are the quickest way to get product metrics. They’re convenient, feature‑rich and well documented. But I began moving away for three reasons:
Matomo (the open‑source analytics platform) paired with Postgres for long‑term storage gives a pragmatic compromise: you keep features like dashboards and event tracking, while retaining full control of your raw data and privacy settings.
High‑level architecture
The pipeline I use is simple and robust:
Matomo handles real‑time collection, bot filtering and basic reporting. Postgres keeps normalized raw events for long‑term retention, joins with customer tables and advanced queries. The ETL can be a small job written in Python, Go or using Airbyte for managed syncing.
What you’ll need
Implementation steps
I’ll walk through the practical steps I applied on multiple projects.
1) Deploy Matomo
Self‑hosting Matomo is straightforward. I usually spin up a containerized instance with nginx as a reverse proxy and an SSL cert from Let's Encrypt. Key points:
2) Implement privacy‑first tracking on the client
Matomo provides a JS tracker that is functionally similar to GA. I prefer the following configuration:
Example policy decisions I made: capture page views, custom events (signup, purchase, feature_use), and an anonymized user_id. IPs are obfuscated at collection time so that raw IPs never leave the Matomo host.
3) Design your Postgres schema
Decide which raw events you want to retain. I favor a normalized schema:
| events | id, occurred_at (timestamp), event_type, user_id, session_id, properties (jsonb), matomo_visit_id |
| users | user_id, created_at, plan, region, anonymized_identifier |
| sessions | session_id, started_at, ended_at, device, browser, country |
Storing properties as jsonb lets you evolve events without complex migrations. Index common query keys (occurred_at, event_type, user_id) and consider a time‑based partitioning strategy for large datasets.
4) Extracting data from Matomo
Matomo stores its data in MySQL/MariaDB. You have two realistic options:
I generally use direct DB reads once the project is stable (faster, more complete). For initial work, the API is easier and safer.
5) Build the ETL
Keep this simple and idempotent. My ETL pattern:
Sample implementation choices:
6) Validate and reconcile
Analytics pipelines always have edge cases. I run daily reconciliation checks:
Automate alerts for drops in volume or sudden schema changes from Matomo updates.
7) Build dashboards and ad hoc queries
With raw events in Postgres you can:
For BI, I often use Metabase for quick dashboards and allow data scientists to run Postgres queries for deeper analysis.
Cost, scaling and operational notes
Costs break down into compute for Matomo, storage for Postgres, and ETL compute. For early startups, a few dozen dollars per month covers small VPS and a managed Postgres tier. Key scaling tips:
Tradeoffs and gotchas
Moving in‑house is not zero effort:
However, the benefits—privacy, ownership, and the ability to run custom joins—often outweigh these costs for startups that care about control and compliance.
Operational checklist before going live
Replacing third‑party analytics with Matomo + Postgres is a practical, privacy‑friendly path that gives startups ownership of their data without sacrificing the ability to get actionable insights. If you want, I can share a sample ETL script (Python) and a starter Postgres schema you can drop into your repo.