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

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.

What is Umami?


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.

Why choose Umami?

There are several reasons to choose Umami over other web analytics solutions, such as:

  1. Privacy-friendly: By default, Umami does not use cookies and does not collect personal data, making it GDPR compliant out of the box. IP addresses are anonymized to protect visitor privacy.
  2. Open-source: Umami's source code is publicly available on GitHub, allowing for transparency, community contributions, and self-hosting options.
  3. Lightweight and fast: With a tracking script size of less than 2 KB, Umami is designed for optimal performance and minimal impact on page load times.
  4. Custom event tracking: Umami enables you to track specific actions like button clicks, signups, purchases, and more. You can attach custom data properties to events for granular tracking and segmentation.
  5. UTM parameter tracking: Umami automatically captures UTM parameters from links, allowing you to measure the effectiveness of your marketing campaigns.
  6. Team collaboration: Umami's team functionality enables you to share access with colleagues while maintaining full control over your data.
  7. Does everything you need, nothing you don't: If you're looking to track heat maps and things like that, Umami isn't your tool. But if your looking for general website analytics, Umami is perfect.

Umami vs. other analytics tools

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
GDPR compliant
Script size <2 KB <3 KB 22.8 KB 17.7 KB
Custom events
UTM tracking
A/B testing
Built-in reporting
Data export
Team access

Did you expect anything different?

Self-hosting Umami with Docker Compose

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.

What is 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:

  • A Linux server with Docker and Docker Compose installed
  • Basic knowledge of Linux, you don't need to be a tech guru

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 | 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] $(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 docker-compose-plugin

Simple as that!

Step 1: Create a Docker Compose file

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:

      - "3000:3000"
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      DATABASE_TYPE: postgresql
      APP_SECRET: replace-me-with-a-random-string
        condition: service_healthy
    restart: always
      test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
      interval: 5s
      timeout: 5s
      retries: 5
    image: postgres:15-alpine
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      - umami-db-data:/var/lib/postgresql/data
    restart: always
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5

Update the password/user above, and save and close the file.

Step 2: Start the containers

In the directory containing the docker-compose.yml file, run the following command:

docker compose up -d

Step 3: Access the Umami dashboard

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.

Step 4: Add your website and install the tracking script

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!