How to Use Umami to Build Your Own Google Analytics Alternative

How to Use Umami to Build Your Own Google Analytics Alternative
# **Umami: A Privacy-Friendly, Open-Source Analytics Alternative to Google Analytics**

Website analytics are **crucial** for understanding how visitors engage with your content.  
While **Google Analytics** dominates, it can be **complex** for small projects and raises **privacy concerns**.

If you want something **simpler**, **open-source**, and **privacy-friendly**,  
[**Umami**](https://github.com/umami-software/umami) is an excellent alternative — lightweight, easy to deploy, and compliant with privacy laws like **GDPR**.

This guide explains **what Umami is**, **why it’s better for privacy-focused projects**, and **how to install it from scratch** — both locally and in the cloud via **Sevalla**.

---

## 📖 Table of Contents

- [Understanding Umami](#understanding-umami)
- [Why Choose Umami Over Google Analytics](#why-choose-umami-over-google-analytics)
- [Prerequisites](#prerequisites)
- [Installation Steps](#installation-steps)
  - [Step 1: Get the Source Code](#step-1-get-the-source-code)
  - [Step 2: Configure the Database](#step-2-configure-the-database)
  - [Step 3: Build the Application](#step-3-build-the-application)
  - [Step 4: Start the Server](#step-4-start-the-server)
  - [Step 5: Keep Umami Updated](#step-5-keep-umami-updated)
  - [Step 6: Add Tracking to Your Website](#step-6-add-tracking-to-your-website)
  - [Step 7: Explore the Dashboard](#step-7-explore-the-dashboard)
- [Hosting Umami on the Cloud using Sevalla](#hosting-umami-on-the-cloud-using-sevalla)
- [Privacy and Compliance](#privacy-and-compliance)
- [Conclusion](#conclusion)

---

## Understanding Umami

Umami is a **self-hosted**, **open-source** analytics platform designed to be:

- **Lightweight**
- **Privacy-respecting**
- **Easy to run anywhere**

It collects essential metrics like **page views**, **referrals**, and **device info** —  
**without tracking personal details** or using cookies.

> 🖼️ ![image](https://blog.aitoearn.ai/content/images/2025/11/img_001-78.png)  
> Try the [**live demo here**](https://cloud.umami.is/analytics/eu/share/LGazGOecbDtaIwDr)  
> Repo: **github.com/umami-software/umami**

---

## Why Choose Umami Over Google Analytics

Google Analytics is powerful — but also **heavy**, **complex**, and tied to **Google’s data collection ecosystem**.

Umami, in contrast:

- **Privacy-first** — No cookies, no third-party tracking.
- **GDPR-compliant** — Suitable for privacy-focused orgs.
- **Lightweight** — Runs well on modest hardware.
- **Fully open-source** — MIT licensed.

You **own** your analytics data entirely.

---

## Prerequisites

Before installing Umami, ensure:

- **Node.js** ≥ 18.18 installed
- A supported database:
  - PostgreSQL ≥ 12.14
  - MySQL ≥ 8.0
  - MariaDB ≥ 10.5

---

## Installation Steps

### Step 1: Get the Source Code

git clone https://github.com/umami-software/umami.git

cd umami

npm install -g pnpm

pnpm install


---

### Step 2: Configure the Database

Create `.env` in the root directory with:

DATABASE_URL=connection-url


Examples:

**PostgreSQL**

postgresql://username:password@localhost:5432/umami


**MySQL**

mysql://username:password@localhost:3306/umami


---

### Step 3: Build the Application

pnpm run build


This will:

- Compile the app
- Set up tables
- Create **admin** user:

Username: admin

Password: umami

  🔒 Change the password immediately.

---

### Step 4: Start the Server

pnpm run start


Open [http://localhost:3000](http://localhost:3000) to log in.

To make Umami public, use a reverse proxy (e.g., **nginx**).

---

### Step 5: Keep Umami Updated

**From source:**

git pull

pnpm install

pnpm run build


**If using Docker:**

docker compose pull

docker compose up --force-recreate -d


---

### Step 6: Add Tracking to Your Website

1. Log in to the dashboard
2. Add a new website
3. Copy the **tracking ``**
4. Paste into the `<head>` section of your site

![image](https://blog.aitoearn.ai/content/images/2025/11/img_002-66.png)

You can track multiple sites from a single Umami instance.

---

### Step 7: Explore the Dashboard

- Page views
- Referrers
- Operating systems
- Devices
- Live activity
- Date filtering
- Exporting data

---

## Hosting Umami on the Cloud using Sevalla

**Sevalla** makes deployment fast — prebuilt templates & free credits.

**Why Sevalla?**
- 🎁 $50 credit for testing
- 📦 Comes with an [Umami template](https://docs.sevalla.com/templates/overview)

**Deploy steps:**
1. [Login](https://app.sevalla.com/login)
2. Navigate to **Templates**
3. Select **Umami**
4. Click **Deploy Template**
5. Wait for PostgreSQL & Redis provisioning
6. Click **Visit app** & log in:</code></pre><p>   admin / umami</p><pre><code>
![image](https://blog.aitoearn.ai/content/images/2025/11/img_003-52.png)  
![image](https://blog.aitoearn.ai/content/images/2025/11/img_004-45.png)  
![image](https://blog.aitoearn.ai/content/images/2025/11/img_005-40.png)  
![image](https://blog.aitoearn.ai/content/images/2025/11/img_006-37.png)  
![image](https://blog.aitoearn.ai/content/images/2025/11/img_007-36.png)

---

## Privacy and Compliance

**Umami doesn’t:**
- Use cookies
- Track individuals
- Share data externally

Complies with **GDPR**, **CCPA**, **PECR** out of the box.

---

## Conclusion

Umami offers **transparent**, **fast**, and **privacy-respecting** analytics.  
It’s ideal for blogs, SaaS products, or client projects — letting you **control your data** entirely.

For multi-platform publishing powered by analytics,  
[**AiToEarn官网**](https://aitoearn.ai/) is a **free**, **open-source** solution to:

- Generate AI-powered content
- Distribute to Douyin, Kwai, WeChat, Bilibili, Xiaohongshu, Facebook, Instagram, LinkedIn, Threads, YouTube, Pinterest, X/Twitter
- Monetize and track performance — integrating seamlessly with Umami metrics

By combining Umami with AiToEarn, you can **measure**, **optimize**, and **monetize** content across platforms — all while maintaining **data ownership** and **user privacy**.

---</code></pre></body>

Read more