Plausible Analytics is the privacy-first alternative to Google Analytics — lightweight (under 1 KB script), cookie-free, GDPR-compliant by design, and critically for Asia-Pacific deployments: not blocked in mainland China. While Google Analytics scripts are frequently blocked or delayed for Chinese users (causing inaccurate data and page load slowdowns), a self-hosted Plausible on your own Hong Kong domain serves the analytics script directly from your infrastructure.
This guide deploys Plausible on a Hong Kong VPS using Docker Compose — giving you accurate analytics for Chinese visitors, zero per-pageview fees, and full data ownership.
Why Plausible on Hong Kong VPS for China Traffic
- Google Analytics is blocked: The
analytics.google.comdomain is blocked in mainland China — Chinese visitors either don’t load the script (causing undercounting) or experience 20–30 second timeouts (causing page load slowdowns) - Self-hosted = your domain: Plausible served from
analytics.yourdomain.comon your Hong Kong VPS is not blocked - CN2 GIA speed: The analytics script loads in 20–35 ms from China instead of timing out
- Accurate China data: You finally see your actual Chinese visitor counts instead of a fraction of them
- No cookies: Plausible uses cookieless tracking — no cookie consent banner required for EU/HK compliance
Step 1: Deploy Plausible with Docker Compose
mkdir -p /home/deploy/plausible
cd /home/deploy/plausiblenano docker-compose.ymlversion: "3.8"
services:
mail:
image: bytemark/smtp
restart: always
plausible_db:
image: postgres:16-alpine
restart: always
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
plausible_events_db:
image: clickhouse/clickhouse-server:24.3-alpine
restart: always
volumes:
- event-data:/var/lib/clickhouse
- ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
plausible:
image: ghcr.io/plausible/community-edition:v2.1
restart: always
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
- plausible_db
- plausible_events_db
- mail
ports:
- "127.0.0.1:8000:8000"
environment:
- BASE_URL=https://analytics.yourdomain.com
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- TOTP_VAULT_KEY=${TOTP_VAULT_KEY}
- DATABASE_URL=postgres://postgres:${POSTGRES_PASSWORD}@plausible_db:5432/plausible_db
- CLICKHOUSE_DATABASE_URL=http://plausible_events_db:8123/plausible_events_db
- SMTP_HOST_ADDR=mail
- SMTP_HOST_PORT=25
- MAILER_EMAIL=plausible@yourdomain.com
volumes:
db-data:
event-data:mkdir -p clickhouse
nano clickhouse/logs.xml<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<query_thread_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<part_log remove="remove"/>
</clickhouse>nano .envPOSTGRES_PASSWORD=strong_postgres_password
SECRET_KEY_BASE=$(openssl rand -base64 64 | tr -d '\n')
TOTP_VAULT_KEY=$(openssl rand -base64 32 | tr -d '\n')chmod 600 .env
docker compose up -d
docker compose logs -f plausibleStep 2: Configure Nginx Reverse Proxy
nano /etc/nginx/sites-available/plausibleserver {
listen 80;
server_name analytics.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name analytics.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/analytics.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/analytics.yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_buffering off;
}
}ln -s /etc/nginx/sites-available/plausible /etc/nginx/sites-enabled/
certbot --nginx -d analytics.yourdomain.com --email your@email.com --agree-tos --no-eff-email
nginx -t && systemctl reload nginxStep 3: Initial Setup and Site Registration
- Navigate to
https://analytics.yourdomain.com - Create your admin account
- Add your first site: enter your domain (e.g.
yourdomain.com) - Plausible provides a tracking snippet — paste it into your website’s
<head>
Install the tracking script
<!-- Add to <head> of your website -->
<script defer data-domain="yourdomain.com" src="https://analytics.yourdomain.com/js/script.js"></script>For WordPress, use the Plausible Analytics WordPress plugin — configure it to use your custom domain (analytics.yourdomain.com) instead of the hosted Plausible.io service.
Step 4: Proxy the Script for Ad-Blocker Bypass
Some browser ad-blockers block requests to /js/script.js even on custom domains. For maximum tracking accuracy, proxy the script through your main website’s Nginx:
# In your main website's Nginx server block:
location = /js/pa.js {
proxy_pass https://analytics.yourdomain.com/js/script.js;
proxy_set_header Host analytics.yourdomain.com;
}
location = /api/event {
proxy_pass https://analytics.yourdomain.com/api/event;
proxy_set_header Host analytics.yourdomain.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}<!-- Update tracking script to use proxied paths -->
<script defer data-domain="yourdomain.com"
data-api="/api/event"
src="/js/pa.js"></script>Conclusion
Self-hosted Plausible Analytics on a Hong Kong VPS solves the China analytics blind spot that affects every website using Google Analytics — giving you accurate visitor data from mainland China while serving the analytics script fast enough not to impact page performance. The Hong Kong location and CN2 GIA routing ensure Chinese users load the script in milliseconds rather than timing out.
Deploy your analytics infrastructure on Server.HK’s Hong Kong VPS plans alongside your main application for a fully China-accessible analytics stack.
Frequently Asked Questions
Is Plausible Analytics compliant with China’s data regulations?
Plausible is cookieless and does not collect personal data — it aggregates traffic statistics without identifying individual users. This approach is generally compliant with privacy regulations across jurisdictions including Hong Kong’s PDPO. For specific compliance questions regarding your use case, consult a qualified privacy practitioner.
How much server resources does Plausible need?
For sites with under 100,000 monthly pageviews, Plausible runs comfortably alongside other applications on a 2 GB RAM VPS. ClickHouse (the analytics database) is memory-efficient at small scale. For high-traffic sites with millions of monthly pageviews, dedicate a separate 2–4 GB RAM VPS to Plausible.
Can I track multiple websites with one self-hosted Plausible instance?
Yes. A single Plausible instance supports unlimited websites (sites) — add each domain in the Plausible admin interface and install the appropriate tracking snippet on each site. All site analytics are accessible from a single dashboard.