How to Self-Host Your Own Website Analytics with Umami
Learn how to self-host Umami, a privacy-focused alternative to Google Analytics using Docker Compose.
Publish date: 5/20/2024
Learn how to self-host Umami, a privacy-focused alternative to Google Analytics using Docker Compose.
Publish date: 5/20/2024
If you're looking for a privacy-focused, open-source alternative to Google Analytics that you can self-host, Umami is a solid option to consider.
In this article, we'll explore Umami's features and benefits, compare it to other popular self-hosted analytics tools like Plausible and Matomo, and guide you through the process of self-hosting Umami using Docker Compose, which is relatively straightforward.
Let's get started and see if Umami might be a good fit for your website analytics needs.

Umami is a lightweight, open-source website analytics tool designed with simplicity, performance, and privacy in mind.
It provides a clean, intuitive dashboard that displays key metrics such as page views, unique visitors, bounce rate, referral sources, and more.
Plus, Umami is built for speed, with an extremely lightweight tracking script (under 2 KB) that won't slow down your website.
Overall, it does just about everything you realistically need in terms of website analytics, but it's not quite as feature rich as some other website analytics options. That's not a bad thing either, it's simple.
There are several reasons to choose Umami over other web analytics solutions, such as:
When it comes to website analytics, Google Analytics is often the go-to choice. However nowadays, there are quite good self-hosted and privacy oriented alternatives.
The main ones are going to be Umami, Plausible, Matomo. I'm not going to get too in depth on the last two in this article, though, because we've already written an article comparing them here.
Anyway, here's how these website analytics tools match up:
| Feature | Umami | Plausible | Matomo | Google Analytics |
|---|---|---|---|---|
| Self-hosted | ✅ | ✅ | ✅ | ❌ |
| Open-source | ✅ | ✅ | ✅ | ❌ |
| GDPR compliant | ✅ | ✅ | ✅ | ❌ |
| Cookies | ❌ | ❌ | ✅ | ✅ |
| Script size | <2 KB | <3 KB | 22.8 KB | 17.7 KB |
| Custom events | ✅ | ✅ | ✅ | ✅ |
| UTM tracking | ✅ | ✅ | ✅ | ✅ |
| Heatmaps | ❌ | ❌ | ✅ | ❌ |
| A/B testing | ❌ | ❌ | ✅ | ✅ |
| Built-in reporting | ❌ | ✅ | ✅ | ✅ |
| Data export | ❌ | ✅ | ✅ | ✅ |
| Team access | ✅ | ✅ | ✅ | ✅ |
Did you expect anything different?
Now that you understand the benefits of Umami and how it compares to other analytics tools, let's walk through the process of self-hosting Umami using Docker Compose.
Docker Compose is a tool that allows you to define and manage multi-container Docker applications.
It uses a YAML file to configure your application's services, networks, and volumes, making it easy to create and deploy complex applications with multiple interconnected containers.
With Docker Compose, you can define your entire application stack in a single file, and then use simple commands to start, stop, and manage your containers.
It'll make this process much easier, and incredibly easy to move in the future if needed. But you can install from source.
Before getting started, ensure you have the following:
If you don't already have a server for hosting Umami, xTom is an infrastructure as a service provider that's older than a decade.
Our VPS brand right here gives you a super affordable option to host this.
We recommend Debian "Bookworm" 12, but you can use any Linux distribution you'd like.
On Debian 12 to install Docker and Docker Compose, you would run the following:
# Add Docker's official GPG key:
sudo apt update
sudo apt install curl gnupg dpkg apt-transport-https lsb-release ca-certificates
sudo curl -sS https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/debian $(lsb_release -sc) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
And then:
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Simple as that!
Create a new directory for your Umami installation and navigate to it:
mkdir umami && cd umami
Then run:
nano docker-compose.yml
And paste the following inside:
services:
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
ports:
- "3000:3000"
environment:
DATABASE_URL: postgresql://umami:umami@db:5432/umami
DATABASE_TYPE: postgresql
APP_SECRET: replace-me-with-a-random-string
depends_on:
db:
condition: service_healthy
restart: always
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
interval: 5s
timeout: 5s
retries: 5
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: umami
POSTGRES_USER: umami
POSTGRES_PASSWORD: umami
volumes:
- umami-db-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
volumes:
umami-db-data:
Update the password/user above, and save and close the file.
In the directory containing the docker-compose.yml file, run the following command:
docker compose up -d
Open your web browser and navigate to http://your-ip:3000.
Then login in using the default credentials (username: admin, password: umami). Remember to change the password after logging in.
In the Umami dashboard, click "Add website" and fill in your website details.
After saving, click "Get tracking code" and copy the provided JavaScript snippet. Add this snippet to your website's HTML, just before the closing </body> tag.
And that's it! Umami is now set up and will start tracking your website analytics.
Umami is a great option fir website analytics, and best of all you can self-host it.
Why give Google even more data when you don't have to?
Ultimately, Umami does all you can ask for without cluttering its user interface with a bunch of useless features you'll hardly ever use. Give it a try and I'm willing to bet you won't regret it.
Finally, as mentioned above, xTom would love to be your next digital home. We provide anywhere from dedicated to colocation and beyond. You can see all of our services right here.
For Umami, our cost-effective KVM NVMe VPS line right here works great.
Thanks for reading!