NewCode CLOUD — 20% off your first month on all cloud VPSClaim

How to Deploy Umami Web Analytics on Hong Kong VPS: Open-Source Google Analytics Alternative (2026)

· 3 min read

Umami is an increasingly popular open-source web analytics platform — simpler than Plausible, with a beautiful real-time dashboard and excellent performance characteristics. Like Plausible, it is privacy-focused, cookie-free, and critically: not blocked in mainland China when self-hosted on your own domain.

Compared to Plausible, Umami is lighter (no ClickHouse dependency), easier to set up, and provides real-time data in its dashboard. For teams that want simple self-hosted analytics without the operational complexity of ClickHouse, Umami on a Hong Kong VPS is an excellent choice.


Umami vs Plausible: Quick Comparison

Feature Umami Plausible
Database PostgreSQL or MySQL PostgreSQL + ClickHouse
Setup complexity Simple Moderate (two databases)
Real-time dashboard ✅ Yes ✅ Yes
Custom events ✅ Yes ✅ Yes
Multiple websites ✅ Unlimited ✅ Unlimited
RAM requirement ~256 MB ~512 MB+
Script size ~2 KB ~1 KB

Step 1: Deploy Umami with Docker Compose

mkdir -p /home/deploy/umami
cd /home/deploy/umami
nano docker-compose.yml
version: '3.8'
services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    container_name: umami
    restart: unless-stopped
    ports:
      - "127.0.0.1:3333:3000"
    environment:
      DATABASE_URL: postgresql://umami:${POSTGRES_PASSWORD}@db:5432/umami
      DATABASE_TYPE: postgresql
      APP_SECRET: ${APP_SECRET}
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:15-alpine
    container_name: umami_db
    restart: unless-stopped
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - umami_db_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U umami"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  umami_db_data:
nano .env
POSTGRES_PASSWORD=strong_postgres_password
APP_SECRET=$(openssl rand -hex 32)
chmod 600 .env
docker compose up -d
docker compose logs -f umami

Step 2: Configure Nginx

nano /etc/nginx/sites-available/umami
server {
    listen 443 ssl http2;
    server_name stats.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/stats.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/stats.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3333;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
ln -s /etc/nginx/sites-available/umami /etc/nginx/sites-enabled/
certbot --nginx -d stats.yourdomain.com --email your@email.com --agree-tos --no-eff-email
nginx -t && systemctl reload nginx

Step 3: Initial Setup and Tracking

  1. Navigate to https://stats.yourdomain.com
  2. Default credentials: username admin, password umami — change immediately
  3. Add website → enter domain name → get tracking code
<!-- Add to your website's <head> section -->
<script async defer
  src="https://stats.yourdomain.com/script.js"
  data-website-id="YOUR_WEBSITE_ID">
</script>

Step 4: Track Custom Events

// Track button clicks
document.getElementById('buy-now').addEventListener('click', () => {
  umami.track('purchase-intent', { product: 'Hong Kong VPS', plan: 'basic' });
});

// Track form submissions
document.getElementById('contact-form').addEventListener('submit', () => {
  umami.track('form-submit', { form: 'contact' });
});

// Track page sections viewed
const observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      umami.track('section-view', { section: entry.target.id });
    }
  });
});
document.querySelectorAll('[data-track-section]').forEach(el => observer.observe(el));

Conclusion

Self-hosted Umami on a Hong Kong VPS provides beautiful, real-time web analytics that works for Chinese visitors — solving the Google Analytics China blind spot with minimal server resources and simple setup. The PostgreSQL-only backend means you can deploy Umami on the same VPS as your main application without additional database complexity.

Add analytics to your Asia-Pacific stack on Server.HK’s Hong Kong VPS plans — Umami runs comfortably alongside your main application on a 2 GB RAM plan.


Frequently Asked Questions

Can I run Umami and Plausible on the same Hong Kong VPS?

Yes, but it is unnecessary — choose one analytics platform. If you are deciding between the two, Umami is simpler to set up and lighter on resources; Plausible has more advanced filtering capabilities and has been in production longer. Both serve the same core purpose of China-accessible self-hosted analytics.

Does Umami handle high traffic spikes?

Umami with PostgreSQL handles millions of monthly pageviews on modest hardware. The bottleneck is typically PostgreSQL write throughput for recording pageviews. For very high traffic (10+ million pageviews/month), consider tuning PostgreSQL or migrating the analytics database to a dedicated VPS while keeping Umami’s application on your main server.

Can I import historical Google Analytics data into Umami?

Umami does not support importing historical data from Google Analytics — it starts tracking from the day you install the script. For historical data, export from Google Analytics (available until its shutdown) and maintain the export separately for reference while Umami accumulates fresh data going forward.

Related articles

More in VPS & ServersServer setup guides