Docs / Self-Hosted Applications / Deploying Plausible Analytics: Privacy-Friendly Alternative to Google Analytics

Deploying Plausible Analytics: Privacy-Friendly Alternative to Google Analytics

By Admin · Mar 5, 2026 · Updated Apr 23, 2026 · 764 views · 2 min read

Why Plausible?

Feature Plausible Google Analytics
Privacy No cookies, GDPR compliant Requires cookie consent
Script size < 1 KB ~45 KB
Data ownership You own it (self-hosted) Google owns it
Interface Simple, focused Complex, overwhelming
Page speed impact Negligible Measurable

Docker Installation

# docker-compose.yml
services:
  plausible:
    image: ghcr.io/plausible/community-edition:latest
    ports:
      - "8000:8000"
    env_file:
      - plausible-conf.env
    depends_on:
      - plausible_db
      - plausible_events_db
    restart: unless-stopped

  plausible_db:
    image: postgres:16-alpine
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
    restart: unless-stopped

  plausible_events_db:
    image: clickhouse/clickhouse-server:latest
    volumes:
      - event-data:/var/lib/clickhouse
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    restart: unless-stopped

volumes:
  db-data:
  event-data:

Configuration

# plausible-conf.env
BASE_URL=https://analytics.example.com
SECRET_KEY_BASE=$(openssl rand -base64 48)
DATABASE_URL=postgres://postgres:postgres@plausible_db:5432/plausible_db
CLICKHOUSE_DATABASE_URL=http://plausible_events_db:8123/plausible_events_db
MAILER_EMAIL=analytics@example.com
SMTP_HOST_ADDR=localhost
DISABLE_REGISTRATION=invite_only

Nginx Reverse Proxy

server {
    listen 443 ssl http2;
    server_name analytics.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;
    }
}

Adding to Your Website

<!-- Just one line in your <head> -->
<script defer data-domain="example.com" src="https://analytics.example.com/js/script.js"></script>

That's it. No cookie banners needed.

What You Can Track

  • Unique visitors per day/week/month
  • Page views and top pages
  • Referral sources (where traffic comes from)
  • Countries and devices
  • Goals and conversions (custom events)
  • UTM campaign tracking

Custom Events

// Track a button click
plausible('Signup', { props: { plan: 'Pro' } });

// Track a form submission
plausible('Contact Form');

Resource Usage

Plausible is lightweight:

Traffic RAM CPU
< 10K/month 512 MB 1 vCPU
10K-100K/month 1 GB 1 vCPU
100K-1M/month 2 GB 2 vCPU

Tip Self-hosting Plausible means your analytics data never leaves your server. This makes GDPR compliance trivial and earns trust with privacy-conscious users.

Was this article helpful?