# Plausible Analytics — Privacy-First Google Analytics Alternative > Plausible is an open-source, cookie-free web analytics tool that provides essential traffic insights while respecting visitor privacy. GDPR/CCPA compliant by design. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use Add one script tag to your website: ```html ``` Or self-host with Docker: ```bash git clone https://github.com/plausible/hosting.git cd hosting docker compose up -d ``` Open `http://localhost:8000` — register and add your first site. ## Intro **Plausible Analytics** is an open-source, privacy-first web analytics platform designed as a lightweight alternative to Google Analytics. It provides all essential website traffic insights in a clean, simple dashboard — without cookies, without personal data collection, and fully compliant with GDPR, CCPA, and PECR out of the box. With 24.6K+ GitHub stars and AGPL-3.0 license, Plausible has become the go-to choice for privacy-conscious website owners who want actionable analytics without the complexity and privacy concerns of Google Analytics. ## What Plausible Does Plausible focuses on essential web analytics without bloat: - **Traffic Overview**: Unique visitors, page views, bounce rate, visit duration — all in one dashboard - **Source Attribution**: See where your traffic comes from (search engines, social media, referral sites, campaigns) - **Page Analytics**: Most visited pages, entry pages, exit pages with real-time data - **Location Data**: Country and city-level breakdown without IP tracking (uses timezone-based approximation) - **Device Analytics**: Browser, OS, and screen size breakdown - **Goal & Event Tracking**: Custom events, revenue tracking, and conversion funnels - **UTM Campaign Tracking**: Full UTM parameter support for marketing campaigns ## Why Privacy-First Matters ``` ┌─────────────────────────────────┐ │ Google Analytics │ │ ✗ 45KB script │ │ ✗ Sets cookies │ │ ✗ Tracks across sites │ │ ✗ Requires cookie banner │ │ ✗ Data sent to Google │ └─────────────────────────────────┘ ┌─────────────────────────────────┐ │ Plausible Analytics │ │ ✓ <1KB script │ │ ✓ No cookies │ │ ✓ No cross-site tracking │ │ ✓ No consent banner needed │ │ ✓ Data stays with you │ └─────────────────────────────────┘ ``` Plausible achieves accurate analytics without cookies by using a hash of the visitor's IP address + User-Agent for daily unique identification. This hash is rotated daily and never stored, making it impossible to track individual users. ## Self-Hosting Guide ### Prerequisites - Docker and Docker Compose - A server with 2GB+ RAM - A domain with DNS configured ### Setup ```bash git clone https://github.com/plausible/hosting.git cd hosting # Configure cp .env.example .env # Edit .env: # BASE_URL=https://analytics.yourdomain.com # SECRET_KEY_BASE=$(openssl rand -base64 48) # Start docker compose up -d ``` ### ClickHouse Backend Plausible uses ClickHouse for analytics data storage, providing: - Sub-second query performance on millions of events - Efficient columnar compression (10-20x less storage than row-based DBs) - Time-series optimized aggregations ### Reverse Proxy (Nginx) ```nginx server { listen 443 ssl; server_name analytics.yourdomain.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; } } ``` ## Advanced Features ### Custom Event Tracking ```html ``` ### API Access ```bash # Get site stats curl "https://plausible.io/api/v1/stats/realtime/visitors?site_id=yourdomain.com" -H "Authorization: Bearer YOUR_API_KEY" # Get breakdown by page curl "https://plausible.io/api/v1/stats/breakdown?site_id=yourdomain.com&period=30d&property=event:page" -H "Authorization: Bearer YOUR_API_KEY" ``` ## Plausible vs Alternatives | Feature | Plausible | Google Analytics | Umami | Fathom | |---------|-----------|-----------------|-------|--------| | Open Source | Yes (AGPL-3.0) | No | Yes (MIT) | No | | Cookie-free | Yes | No | Yes | Yes | | Script size | <1KB | 45KB | 2KB | 5KB | | Self-hosted | Yes | No | Yes | No | | Real-time | Yes | Delayed | Yes | Yes | | ClickHouse | Yes | Proprietary | No | No | | Revenue tracking | Yes | Yes | No | Yes | ## FAQ **Q: How does it count unique visitors without cookies?** A: Plausible identifies unique visitors using a daily-rotating hash of the visitor's IP + User-Agent. The hash is not stored, resets automatically each day, and cannot be used for cross-day tracking. **Q: What are the server requirements for self-hosting?** A: 2GB RAM minimum, 4GB+ recommended. For sites with under 100K daily visits, 1 core and 2GB runs smoothly. ClickHouse will use significant memory for query caching. **Q: Can I migrate from Google Analytics?** A: Yes. Plausible provides a GA import tool that supports historical data from Google Analytics (both UA and GA4). ## Source & Thanks - GitHub: [plausible/analytics](https://github.com/plausible/analytics) — 24.6K+ ⭐ | AGPL-3.0 - Website: [plausible.io](https://plausible.io) --- Source: https://tokrepo.com/en/workflows/plausible-analytics-privacy-first-google-analytics-55cad36c Author: Script Depot