Self-hosted analytics on your own server instead of Google Analytics
Google Analytics is free, but in return you hand your visitor data to Google, show a consent banner, and wrestle with the GA4 interface, where a simple question like “how many people came yesterday” hides behind three menus. If your site already lives on your own VPS, there is another way: put the analytics there too.
Here is what that gives you, what the options are, what happens with cookies and consent, and how to set it up without touching the running site.
What self-hosted analytics gives you
- The data stays with you. Visits are written to a database on your server. No third party sees them or uses them for ads.
- A simple interface. Visitors, pages, sources, countries, devices — on one screen, with no events or reports to configure.
- Usually no cookies. The popular self-hosted tools count visitors without cookies. What that means for the consent banner is covered below.
- A light script. The tracker weighs a couple of kilobytes, not dozens, and barely affects page speed.
What you won't get:
- demographics (gender, age, interests) — Google takes those from what it knows about people;
- Google Ads integration and remarketing;
- your Google Analytics history: it can't be moved over, counting starts from zero.
If you don't buy Google ads, you usually need none of this.
Umami, Plausible or Matomo
The three best-known options you can run on your own server:
| Umami | Plausible CE | Matomo | |
|---|---|---|---|
| Runs on | Node.js and PostgreSQL | Elixir and ClickHouse | PHP and MySQL |
| Server needs | small, a little VPS is enough | noticeable: ClickHouse likes memory | medium, grows with traffic |
| Interface | simple, one screen | simple, one screen | detailed, like the old GA |
| Cookies | no | no | yes, can be turned off |
For a site on a small VPS, Umami is usually the best fit: it's light, runs on the familiar PostgreSQL, and does all the essentials — sources, pages, UTM tags, events, funnels. Pick Matomo if you want nearly the full Google Analytics with every report. Plausible is good, but its ClickHouse database can take more memory on a small server than the site itself.
Cookies and consent
This is where people get confused most often, so carefully.
Cookieless analytics stores nothing in the visitor's browser. It recognises a returning visitor by details the browser sends with every request anyway — through one-way hashing, without saving an identifier on the person's device.
What follows from that:
- In Europe, banners are often required precisely because of cookies and similar technologies. Without them, consent for analytics is in many cases not needed. Some European regulators explicitly exempt analytics that only counts visits, shares no data with third parties and doesn't track people across other sites.
- But “no cookies” doesn't mean “the law doesn't apply”. Under European rules a visitor's address is personal data, even when it's hashed. The analytics still has to be mentioned in your privacy policy.
- Rules differ between countries. What's enough in one country may fall short in another. If your site serves Europe or collects customer data, check the requirements of your country.
In short: cookieless self-hosted analytics often lets you go without a banner, but it always needs a line in your privacy policy.
How to install Umami yourself
A general plan, not tied to specific versions: take exact commands and the current image from the Umami documentation.
- A separate directory and
docker-compose.ymlwith two services: Umami and PostgreSQL. The database is for Umami only, not shared with the site: that way updating analytics can't touch your site's data. - The port on
127.0.0.1only. Umami reaches the outside world through your web server with HTTPS, not as a bare port. Inportswrite127.0.0.1:3000:3000, otherwise Docker opens the port to the whole internet, past the firewall. - Its own subdomain, for example
stats.your-site.com, with a certificate. In the web server config, proxy it to127.0.0.1:3000. - Change the admin password right after the first login: a fresh install has a default one that everyone knows.
- Add the site in Umami and put the script line it gives you on your pages.
- Backups of the analytics database — on a schedule and not on the same disk.
- Updates. Umami releases often; update the image every month or two, taking a database backup first.
A couple of pitfalls:
- Don't count yourself. Umami can exclude visits from your browser; otherwise half the stats of a small site will be your own visits.
- Limit the domains. The script has a setting for which domains to count (
data-domains). Without it, your visits fromlocalhostduring development end up in the stats. - Some ad blockers cut every tracker, self-hosted ones included. The numbers will be a little lower than reality — that's true of any analytics.
How vpsFocus does this
vpsFocus is a free desktop app that installs Umami on your VPS for you and shows analytics for all your sites in one window.
- Installation doesn't touch your site. Analytics goes into its own directory, its own containers and its own port. If 80 and 443 are taken by your web server, the app doesn't take them over. The app issues the tracker's certificate itself, and if that needs DNS access, it tells you which record to add.
- The data stays on your server. Neither your site's visitors nor the analytics data pass through vpsFocus infrastructure. The Umami panel isn't exposed: the app reaches it over SSH.
- One screen, but in depth. Sources with channels and UTM tags, with people who came from ChatGPT, Perplexity and Claude answers shown separately. Pages with entries and exits, a visitor map, devices, “when they visit” by weekday and hour, returns, paths through the site and funnels, a live feed of visits. Clicking a row in any table filters the whole screen.
- Backups and updates. The app saves the analytics database into an archive on your computer, and installs updates with one button, taking a database backup before any change.
You don't even need an account for analytics, and there's no limit on the number of sites or servers.