DEV Community

Cover image for Umami self-hosted: a Google Analytics alternative on Postgres
Abhishek Jaiswal
Abhishek Jaiswal

Posted on Originally published at ownkube.io

Umami self-hosted: a Google Analytics alternative on Postgres

Umami is web analytics you host yourself. It counts pageviews, visitors, referrers and custom events without cookies, and every visit is a row in your own Postgres database.

A working install needs the official Umami Docker image, a Postgres database and an HTTPS address that your sites can load a script from. On Ownkube the Umami template sets all of that up in one click, from about $10 a month.

The short version

  • Umami gives you a Google Analytics style dashboard for as many sites as you like, with the data in a database you control.
  • The Umami template deploys the official image with a managed Postgres database and an ownkube.app hostname with automatic HTTPS.
  • The first login is admin with the password umami. Sign in and change it right after the deploy.
  • Plausible is the other popular choice. Its self-hosted edition needs ClickHouse as well as Postgres, and Umami runs on Postgres alone.

Why people look for a Google Analytics alternative

Google Analytics is free and very deep, and that depth is the usual complaint. A small site owner who wants to know which pages people read and where they came from has to learn a reporting tool built for marketing teams. It also sets cookies, which is why many sites in Europe ask visitors for consent before it loads.

Umami answers a smaller question well. The dashboard shows pageviews, visitors, referrers, countries, devices and browsers on one screen. Umami's docs say it works "without cookies, cross-site tracking, or the automatic collection of personal data." Whether you still need a consent banner depends on your site and your country, so check with whoever handles privacy for you.

The code is MIT licensed, and you can run one install for every site you own.

Umami, Plausible and Google Analytics compared

Umami (self-hosted) Plausible Google Analytics
Hosting You run it Plausible Cloud, or the self-hosted Community Edition Google runs it
License MIT Community Edition is AGPLv3 Proprietary
Data store Postgres ClickHouse for events, plus Postgres Google's servers
Cookies None None Yes
Cost Your server and database Cloud plans, or your own server for the Community Edition Free

Plausible is a good product with a clear dashboard, and its cloud keeps data on EU-owned servers. The Community Edition is free to self-host and ships twice a year. It leaves out some cloud features, including funnels, ecommerce revenue goals and the sites API, and its README recommends at least 2 GB of RAM for ClickHouse and Plausible together.

Ownkube has no Plausible template. If you want Plausible, its cloud is the simplest route.

Umami fits when you want one small app and one Postgres database, and when you're happy to look after it yourself.

The fastest way: the Umami template

The Umami template on the Ownkube Marketplace creates a Postgres 18 database, deploys the official image and wires the connection string into DATABASE_URL. It also sets DATABASE_TYPE to postgresql and generates APP_SECRET, which signs login sessions. Umami creates its tables on first boot, so there is no setup step.

From the terminal, okctl runs the same install:

okctl regions list
okctl boxes list --kind database
okctl marketplace deploy umami-postgres --region <region-id> --db-box <box-id>
Enter fullscreen mode Exit fullscreen mode

Ownkube Compute runs in two regions, Germany and Mumbai, so a site with European visitors can keep its analytics in Germany.

The Marketplace sets up other self-hosted apps the same way. We have guides for Metabase, NocoDB and n8n.

First setup

Change the default password

Open the hostname and sign in as admin with the password umami. Change it straight away. Until you do, anyone who finds the hostname can sign in with the same pair.

Add a website

In the settings, add a website with a name and its domain. Umami gives it an ID and a tracking code, which you'll find under the Tracking code section of that website's settings.

Install the tracking code

Copy the tracking code into the <head> of every page on your site. It is a single script tag that loads from your Umami hostname and carries the website ID. Most site builders and frameworks have a place for head scripts, so this is usually one edit.

Visit your site in another browser and the visit shows up on the dashboard.

Track events

Pageviews are automatic. For button clicks and form submits, add a data-umami-event attribute with an event name to the element, or call the tracker from your own JavaScript. Events show up next to pageviews and can feed reports such as funnels and retention.

Use your own domain

Your sites load the tracking script from the Umami hostname, so a first-party name such as stats.example.com looks cleaner in your page source than a generated one. Custom domains need the Personal or Team plan, take two DNS records per host, and your DNS stays at your provider:

okctl domains add <app> stats.example.com
Enter fullscreen mode Exit fullscreen mode

Some ad blockers block requests to well-known script names. Umami lets you rename the script with TRACKER_SCRIPT_NAME and move the collection endpoint with COLLECT_API_ENDPOINT:

okctl vars set <app> TRACKER_SCRIPT_NAME=stats
okctl vars set <app> COLLECT_API_ENDPOINT=/api/collect
Enter fullscreen mode Exit fullscreen mode

Update the script tag on your sites after a rename. To stop Umami sending its own anonymous telemetry, set DISABLE_TELEMETRY=1 the same way.

The manual path

Use the manual path to pin a different version or to see what the template set up.

  1. Create a database box on Ownkube. Boxes start at $4 a month, plus storage at $0.25 per GB per month.
  2. Create a web app from ghcr.io/umami-software/umami with a Postgres tag. The container listens on port 3000, and /api/heartbeat makes a good readiness check.
  3. Set the variables:
DATABASE_URL=postgresql://<user>:<password>@<host>:5432/<database>
DATABASE_TYPE=postgresql
APP_SECRET=<a-long-random-string>
Enter fullscreen mode Exit fullscreen mode

Store the secret with okctl vars set <app> APP_SECRET --secret. okctl prompts for the value, so it never lands in your shell history.

Umami keeps everything in Postgres, so the app needs no volume and a redeploy keeps all your data.

The docker compose equivalent

If you're comparing this with an Umami docker compose install on a VPS, here's the same setup as a compose file. The postgres service becomes the managed database box and the umami service becomes the web deployment. The ownkube.app hostname replaces the reverse proxy, the certificate and the DNS record.

services:
  postgres:
    image: postgres:17
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: change-me
    volumes:
      - pgdata:/var/lib/postgresql/data

  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://umami:change-me@postgres:5432/umami
      DATABASE_TYPE: postgresql
      APP_SECRET: change-me-too
    depends_on:
      - postgres

volumes:
  pgdata:
Enter fullscreen mode Exit fullscreen mode

On a VPS the compose file leaves you to set up the reverse proxy, the certificate, Postgres backups, OS updates and restarts after a reboot. Visits that arrive while the analytics server is down go uncounted.

Sizing and cost

Umami does little work per visit: each pageview is one small request and one row. Start on metered pricing, billed per minute, and watch the memory graph for a few days. For a flat price, Spark 1 (0.5 GiB, $5 a month) suits a few small sites, and Spark 2 (1 GiB, $10 a month) gives headroom for busier ones.

Add the smallest database box at $4 a month and 5 GB of storage at $1.25. On Spark 1 that comes to about $10 a month, however many sites you track. The database grows with your traffic, so give it more storage before you touch the app.

On the Personal and Team plans, turn on 7-day backups with point-in-time restore for the database. They're off by default, and the database is the whole install.

If a client wants their analytics inside their own AWS account, the same app moves there with no rewrite, and logs, metrics and health checks come with it.

FAQ

Is Umami free?

The software is free and MIT licensed. Self-hosted, you pay for the app and its database. Umami also sells a hosted cloud if you'd rather not run it.

Does Umami use cookies?

No. Umami's docs say it tracks without cookies or cross-site tracking. Anything you choose to send yourself, such as event properties, is your responsibility.

Can I run Umami next to Google Analytics?

Yes. Both scripts can sit in the same <head>, and running them side by side for a few weeks is a sensible way to compare before you remove one.

Why don't my Umami numbers match Google Analytics?

The two tools define visits and sessions differently, and ad blockers stop some scripts from loading. Treat each as consistent with itself, and compare trends rather than exact counts.

How do I update Umami?

Change the image tag on the deployment and redeploy. Umami runs its database migrations on start. Pin a version so an upgrade is a step you choose and can roll back.

Where Ownkube fits

Umami needs one small app, a Postgres database and an HTTPS address your sites can reach. Ownkube Compute runs all of it, and the database can be backed up with a switch. Deploy the template, change the admin password and paste the tracking code into your site. See Ownkube pricing for the per-minute wallet model, from $5 a month. Deploy my first app.

Top comments (0)