Plausible is a lightweight, privacy-friendly alternative to Google Analytics. Its script is about 1 KB, it doesn’t use cookies or collect personal data, and its single-page dashboard shows what most site owners actually need: visitors, pageviews, sources, top pages, countries, devices and goals.
The Community Edition (CE) is free to self-host under the AGPL. It runs on Elixir with PostgreSQL for configuration and ClickHouse for event data.
Requirements
- Docker and Docker Compose — see installing Docker on Ubuntu.
- At least 2 GB RAM (ClickHouse is the heavy part); 4 GB for busier sites.
- A CPU with SSE 4.2 (required by ClickHouse; any modern x86 VPS has it —
grep -o sse4_2 /proc/cpuinfo | head -1). - A subdomain such as
stats.example.com.
1. Get the official CE setup
Plausible maintains a community-edition repository with the Compose file. Clone the tag for the current release:
git clone -b v3.0.1 --single-branch https://github.com/plausible/community-edition plausible-ce
cd plausible-ce
(Check the repository for the latest version tag and adjust.)
2. Configure
Create .env:
cat > .env <<EOF
BASE_URL=https://stats.example.com
SECRET_KEY_BASE=$(openssl rand -base64 48)
HTTP_PORT=8000
EOF
To keep Plausible behind your own Nginx reverse proxy, publish the port on localhost only with a compose.override.yml:
services:
plausible:
ports:
- 127.0.0.1:8000:8000
Optional settings in .env include SMTP for email reports, DISABLE_REGISTRATION=invite_only (default after the first user), and MaxMind credentials for city-level geolocation.
3. Start
docker compose up -d
docker compose logs -f plausible
Wait until migrations finish.
4. HTTPS with Nginx
server {
listen 80;
server_name stats.example.com;
location / {
proxy_pass http://127.0.0.1:8000;
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;
}
}
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d stats.example.com
(Plausible CE can also obtain its own certificates if you let it bind ports 80/443 directly — then skip Nginx.)
5. Create your account and add a site
Open https://stats.example.com, register the first (admin) user, then add your website’s domain. Plausible shows the snippet to add to your site’s <head>:
<script defer data-domain="example.com" src="https://stats.example.com/js/script.js"></script>
Extensions of the script (e.g. script.outbound-links.js, script.file-downloads.js, script.tagged-events.js) enable extra tracking; newer versions may offer a per-site script with options set in the dashboard.
Visit your site and watch the realtime counter.
6. Proxy the script through your own domain (optional)
Ad blockers often block analytics scripts on third-party domains. Serving the script and event endpoint from your own site’s domain improves accuracy:
location = /js/script.js {
proxy_pass https://stats.example.com/js/script.js;
proxy_set_header Host stats.example.com;
proxy_ssl_server_name on;
}
location = /api/event {
proxy_pass https://stats.example.com/api/event;
proxy_set_header Host stats.example.com;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Then use src="/js/script.js" and data-api="/api/event" in the snippet. Forwarding the client IP matters, because Plausible derives unique-visitor counts and location from it.
7. Goals and custom events
Track signups, purchases or button clicks as goals: pageview goals (/thank-you), or custom events from JavaScript:
plausible('Signup', { props: { plan: 'starter' } });
8. Backups
Back up both databases:
docker compose exec plausible_db pg_dump -U postgres plausible_db | gzip > plausible-pg-$(date +%F).sql.gz
docker compose exec plausible_events_db clickhouse-client --query "BACKUP DATABASE plausible_events_db TO File('backup-$(date +%F)')"
ClickHouse backups need a backup disk configured, or simply stop the stack and back up the Docker volumes. Container names may differ — check docker compose ps.
9. Updates
Follow the CE repository’s release notes: pull the new tag, docker compose pull, docker compose up -d. Major versions can include migrations.
Privacy and compliance
Plausible doesn’t set cookies or store personal data, so in many jurisdictions it can run without a cookie banner — but rules vary; check what applies to you. Self-hosting keeps all analytics data on your own server.
Alternatives
- Umami — similar idea, runs on Node.js + PostgreSQL/MySQL, lighter (no ClickHouse).
- Matomo — full-featured, closest to Google Analytics.
A Docker VPS with 4 GB RAM comfortably runs Plausible for many sites.