ConfigsApr 10, 2026·1 min read

Umami — Modern Privacy-Focused Website Analytics

Umami is an open-source, privacy-focused analytics platform and Google Analytics alternative with real-time dashboards, event tracking, and multi-site support.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

git clone https://github.com/umami-software/umami.git
cd umami
cp .env.example .env
# Set DATABASE_URL in .env
npm install
npx prisma migrate deploy
npm run build
npm start

Open http://localhost:3000 — login with admin/umami and add your first website.

Intro

Umami is an open-source, privacy-focused web analytics platform that serves as a modern alternative to Google Analytics, Mixpanel, and Amplitude. Built with Next.js and supporting both PostgreSQL and MySQL, it provides beautiful real-time dashboards, custom event tracking, and product analytics features — all without cookies and fully GDPR compliant.

With 36K+ GitHub stars and MIT license, Umami is one of the most popular open-source analytics solutions, trusted by thousands of websites worldwide for its simplicity, performance, and respect for user privacy.

What Umami Does

Umami provides comprehensive analytics across web and product metrics:

  • Real-time Dashboard: Live visitor count, page views, sessions, and geographic distribution
  • Page Analytics: Detailed per-page metrics with entry/exit tracking and flow visualization
  • Custom Events: Track button clicks, form submissions, signups, purchases, and any user interaction
  • User Journey: Session replay, funnel analysis, and conversion path tracking
  • Audience Segmentation: Filter by country, device, browser, OS, referrer, and custom properties
  • UTM Tracking: Campaign attribution with source, medium, campaign, term, and content parameters
  • Multi-site: Manage unlimited websites from a single dashboard with team sharing

Architecture

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│  Your Site   │────▶│  Umami       │────▶│  PostgreSQL  │
│  (Tracker)   │     │  (Next.js)   │     │  or MySQL    │
└──────────────┘     └──────┬───────┘     └──────────────┘
                            │
                     ┌──────┴───────┐
                     │  Dashboard   │
                     │  (React UI)  │
                     └──────────────┘

Installation

Docker Compose (Recommended)

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: your-random-secret
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - umami-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U umami"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  umami-db:
docker compose up -d
# Login: admin / umami

One-Click Deploy

Umami supports one-click deployment to:

  • Vercel: Connect GitHub repo → auto-deploy with PostgreSQL (Neon/Supabase)
  • Railway: Template-based deploy with built-in PostgreSQL
  • DigitalOcean: App Platform with managed database

Tracking Setup

Basic Page Tracking

<script defer src="https://analytics.yourdomain.com/script.js"
  data-website-id="your-website-id"></script>

The tracking script is only 2KB gzipped and loads asynchronously — zero impact on page performance.

Custom Event Tracking

// Track button click
umami.track('signup-click', { plan: 'pro', source: 'landing' });

// Track form submission
umami.track('contact-form', {
  type: 'enterprise',
  company: 'Acme Corp'
});

// Track page view with custom data
umami.track({ url: '/virtual-page', title: 'Custom Page' });

React/Next.js Integration

import Script from 'next/script';

export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <Script
          defer
          src="https://analytics.yourdomain.com/script.js"
          data-website-id="your-website-id"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

API & Integrations

REST API

# Authenticate
TOKEN=$(curl -s -X POST https://analytics.yourdomain.com/api/auth/login 
  -H "Content-Type: application/json" 
  -d '{"username":"admin","password":"umami"}' | jq -r '.token')

# Get website stats
curl "https://analytics.yourdomain.com/api/websites/{id}/stats?startAt=1704067200000&endAt=1706745600000" 
  -H "Authorization: Bearer $TOKEN"

# Get page views
curl "https://analytics.yourdomain.com/api/websites/{id}/pageviews?startAt=1704067200000&endAt=1706745600000&unit=day" 
  -H "Authorization: Bearer $TOKEN"

Umami vs Plausible

Feature Umami Plausible
License MIT AGPL-3.0
Stack Next.js + PostgreSQL Elixir + ClickHouse
Custom events Rich props Basic props
User journey Funnels + paths Goals only
Product analytics Yes (cohorts, segments) Basic
Team management Yes Yes
API Full REST API Stats API
Script size 2KB <1KB

常见问题

Q: Umami 和 Plausible 选哪个? A: 如果你只需要简洁的流量统计,Plausible 更轻量。如果你需要产品分析功能(用户分群、漏斗分析、用户旅程),Umami 更全面。Umami 的 MIT 许可也更宽松。

Q: 数据库用 PostgreSQL 还是 MySQL? A: 推荐 PostgreSQL。虽然两者都支持,但 Umami 的核心开发以 PostgreSQL 为主,社区支持和文档也更完善。

Q: 能处理高流量网站吗? A: 可以。Umami 使用高效的数据聚合查询,单实例可处理每天数百万页面浏览量。对于超大规模站点,可以水平扩展 Umami 实例并使用数据库读副本。

来源与致谢

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets