Plausible Analytics
Plausible privacy-friendly web analytics alternative to Google Analytics.
Overview
Plausible Analytics is an open-source, privacy-focused web analytics platform that serves as a lightweight alternative to Google Analytics. Founded in 2019, Plausible emphasizes user privacy by design, requiring no cookies, collecting no personal data, and maintaining full GDPR compliance while providing essential website insights. The platform generates a tracking script that's 45x smaller than Google Analytics, ensuring minimal impact on site performance. This stack combines Plausible with PostgreSQL for metadata storage and ClickHouse for high-performance event analytics. PostgreSQL handles user accounts, site configurations, and dashboard data with its robust ACID compliance, while ClickHouse excels at processing millions of pageview events with columnar storage optimized for real-time analytics queries. The dual-database architecture allows Plausible to maintain fast dashboard responses even when processing billions of events. This configuration is ideal for organizations prioritizing user privacy, regulatory compliance, and performance while maintaining comprehensive analytics capabilities. The stack eliminates dependency on third-party analytics services, provides complete data ownership, and offers transparent insights without compromising visitor privacy or requiring cookie consent banners.
Key Features
- Privacy-first analytics with no cookies or personal data collection
- Lightweight 1.7KB tracking script that loads 45x faster than Google Analytics
- Real-time event processing using ClickHouse columnar database for billion-row analytics
- PostgreSQL-backed user management with ACID-compliant configuration storage
- GDPR, CCPA, and PECR compliant by design without requiring cookie banners
- Open-source transparency with self-hosted data ownership
- Simple dashboard showing essential metrics without complex goal funnels
- API access for custom integrations and automated reporting
Common Use Cases
- 1Privacy-conscious businesses replacing Google Analytics for GDPR compliance
- 2SaaS companies tracking product usage without compromising user privacy
- 3Publishers and bloggers monitoring content performance with lightweight tracking
- 4E-commerce sites analyzing traffic patterns while maintaining customer trust
- 5Government and healthcare organizations requiring strict data sovereignty
- 6Marketing agencies offering privacy-compliant analytics to clients
- 7Educational institutions tracking website engagement without student data concerns
Prerequisites
- Docker Engine 20.10+ and Docker Compose v2 for container orchestration
- Minimum 4GB RAM (2GB for ClickHouse, 1GB for PostgreSQL, 1GB for Plausible)
- Domain name or public IP address for BASE_URL configuration
- Generated SECRET_KEY_BASE using openssl rand -base64 64 command
- Port 8000 available for Plausible web interface access
- Understanding of environment variables for initial admin account setup
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 plausible: 3 image: plausible/analytics:v2.04 container_name: plausible5 command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"6 environment: 7 - BASE_URL=${BASE_URL}8 - SECRET_KEY_BASE=${SECRET_KEY_BASE}9 - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/plausible10 - CLICKHOUSE_DATABASE_URL=http://clickhouse:8123/plausible11 - DISABLE_REGISTRATION=${DISABLE_REGISTRATION}12 ports: 13 - "8000:8000"14 depends_on: 15 postgres: 16 condition: service_healthy17 clickhouse: 18 condition: service_started19 networks: 20 - plausible-network2122 postgres: 23 image: postgres:16-alpine24 container_name: plausible-db25 environment: 26 - POSTGRES_USER=${POSTGRES_USER}27 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}28 - POSTGRES_DB=plausible29 volumes: 30 - postgres_data:/var/lib/postgresql/data31 healthcheck: 32 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]33 interval: 10s34 timeout: 5s35 retries: 536 networks: 37 - plausible-network3839 clickhouse: 40 image: clickhouse/clickhouse-server:23.11-alpine41 container_name: plausible-events42 volumes: 43 - clickhouse_data:/var/lib/clickhouse44 ulimits: 45 nofile: 46 soft: 26214447 hard: 26214448 networks: 49 - plausible-network5051volumes: 52 postgres_data: 53 clickhouse_data: 5455networks: 56 plausible-network: 57 driver: bridge.env Template
.env
1# Plausible Analytics2BASE_URL=http://localhost:80003SECRET_KEY_BASE=your-secret-key-base-at-least-64-chars4POSTGRES_USER=plausible5POSTGRES_PASSWORD=plausible_password6DISABLE_REGISTRATION=falseUsage Notes
- 1Dashboard at http://localhost:8000
- 2Add script to your website
- 3GDPR compliant, no cookies
- 4Lightweight tracking script
- 5Set DISABLE_REGISTRATION=true after setup
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
plausible
plausible:
image: plausible/analytics:v2.0
container_name: plausible
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
environment:
- BASE_URL=${BASE_URL}
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/plausible
- CLICKHOUSE_DATABASE_URL=http://clickhouse:8123/plausible
- DISABLE_REGISTRATION=${DISABLE_REGISTRATION}
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
clickhouse:
condition: service_started
networks:
- plausible-network
postgres
postgres:
image: postgres:16-alpine
container_name: plausible-db
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=plausible
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${POSTGRES_USER}
interval: 10s
timeout: 5s
retries: 5
networks:
- plausible-network
clickhouse
clickhouse:
image: clickhouse/clickhouse-server:23.11-alpine
container_name: plausible-events
volumes:
- clickhouse_data:/var/lib/clickhouse
ulimits:
nofile:
soft: 262144
hard: 262144
networks:
- plausible-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 plausible:5 image: plausible/analytics:v2.06 container_name: plausible7 command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"8 environment:9 - BASE_URL=${BASE_URL}10 - SECRET_KEY_BASE=${SECRET_KEY_BASE}11 - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/plausible12 - CLICKHOUSE_DATABASE_URL=http://clickhouse:8123/plausible13 - DISABLE_REGISTRATION=${DISABLE_REGISTRATION}14 ports:15 - "8000:8000"16 depends_on:17 postgres:18 condition: service_healthy19 clickhouse:20 condition: service_started21 networks:22 - plausible-network2324 postgres:25 image: postgres:16-alpine26 container_name: plausible-db27 environment:28 - POSTGRES_USER=${POSTGRES_USER}29 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}30 - POSTGRES_DB=plausible31 volumes:32 - postgres_data:/var/lib/postgresql/data33 healthcheck:34 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]35 interval: 10s36 timeout: 5s37 retries: 538 networks:39 - plausible-network4041 clickhouse:42 image: clickhouse/clickhouse-server:23.11-alpine43 container_name: plausible-events44 volumes:45 - clickhouse_data:/var/lib/clickhouse46 ulimits:47 nofile:48 soft: 26214449 hard: 26214450 networks:51 - plausible-network5253volumes:54 postgres_data:55 clickhouse_data:5657networks:58 plausible-network:59 driver: bridge60EOF6162# 2. Create the .env file63cat > .env << 'EOF'64# Plausible Analytics65BASE_URL=http://localhost:800066SECRET_KEY_BASE=your-secret-key-base-at-least-64-chars67POSTGRES_USER=plausible68POSTGRES_PASSWORD=plausible_password69DISABLE_REGISTRATION=false70EOF7172# 3. Start the services73docker compose up -d7475# 4. View logs76docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/plausible-analytics/run | bashTroubleshooting
- Database connection errors during startup: Increase the sleep timer in the Plausible command from 10 to 30 seconds to allow PostgreSQL full initialization
- ClickHouse memory allocation failures: Increase Docker Desktop memory limit to 6GB+ or add memory limits to clickhouse service
- Site not showing in dashboard after adding script: Verify BASE_URL matches exactly including protocol (https://) and check browser console for CORS errors
- Registration disabled but can't access dashboard: Create admin user with docker-compose exec plausible /entrypoint.sh db create-admin command
- High memory usage over time: Configure ClickHouse data retention policies using TTL settings to automatically clean old analytics data
- Script blocked by ad blockers: Host Plausible on subdomain of tracked site or configure proxy to serve analytics script from same domain
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
plausiblepostgresclickhouse
Tags
#plausible#analytics#privacy#gdpr#web-analytics
Category
Monitoring & ObservabilityAd Space
Shortcuts: C CopyF FavoriteD Download