vpsFocus
Русский Sign in Create account

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

What you won't get:

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:

UmamiPlausible CEMatomo
Runs onNode.js and PostgreSQLElixir and ClickHousePHP and MySQL
Server needssmall, a little VPS is enoughnoticeable: ClickHouse likes memorymedium, grows with traffic
Interfacesimple, one screensimple, one screendetailed, like the old GA
Cookiesnonoyes, 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 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.

  1. A separate directory and docker-compose.yml with 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.
  2. The port on 127.0.0.1 only. Umami reaches the outside world through your web server with HTTPS, not as a bare port. In ports write 127.0.0.1:3000:3000, otherwise Docker opens the port to the whole internet, past the firewall.
  3. Its own subdomain, for example stats.your-site.com, with a certificate. In the web server config, proxy it to 127.0.0.1:3000.
  4. Change the admin password right after the first login: a fresh install has a default one that everyone knows.
  5. Add the site in Umami and put the script line it gives you on your pages.
  6. Backups of the analytics database — on a schedule and not on the same disk.
  7. Updates. Umami releases often; update the image every month or two, taking a database backup first.

A couple of pitfalls:

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.

You don't even need an account for analytics, and there's no limit on the number of sites or servers.

Download vpsFocus