Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
Plausible Analytics: Privacy-First, Lightweight Google Analytics Alternative
Open Source

Plausible Analytics: Privacy-First, Lightweight Google Analytics Alternative

Deploy Plausible Analytics on Kubernetes โ€” GDPR-compliant, no cookies, under 1KB script, and full data ownership.

LB
Luca Berton
ยท 1 min read

Why Replace Google Analytics?

Google Analytics 4 is:

  • Heavy โ€” 45KB script, slows page load
  • Privacy-invasive โ€” cookies, fingerprinting, cross-site tracking
  • Complex โ€” event-based model confuses most teams
  • Blocked โ€” 40%+ of visitors use ad blockers that block GA

Plausible fixes all four problems.

Plausible vs Google Analytics

FeaturePlausibleGA4
Script sizeunder 1KB45KB
CookiesโŒ Noneโœ… Multiple
GDPR consent bannerNot neededRequired
Setup time5 minutesHours
Data ownershipโœ… FullโŒ Google owns it
Real-timeโœ…โœ…
Funnelsโœ…โœ…
Revenue trackingโœ…โœ…
Self-hostedโœ…โŒ
Ad blocker bypassโœ… (proxy)โŒ
Price$9/mo or free (self-hosted)Free (you are the product)

Self-Host on Kubernetes

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚       Plausible Stack              โ”‚
โ”‚                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Plausible โ”‚  โ”‚  ClickHouse โ”‚  โ”‚
โ”‚  โ”‚  (Elixir)  โ”‚  โ”‚  (Analytics โ”‚  โ”‚
โ”‚  โ”‚            โ”‚  โ”‚   Engine)   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚        โ”‚                 โ”‚         โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚
โ”‚                 โ”‚                  โ”‚
โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”‚
โ”‚         โ”‚  PostgreSQL   โ”‚          โ”‚
โ”‚         โ”‚  (metadata)   โ”‚          โ”‚
โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: plausible
  namespace: analytics
spec:
  replicas: 1
  template:
    spec:
      containers:
        - name: plausible
          image: ghcr.io/plausible/community-edition:v2.1
          ports:
            - containerPort: 8000
          env:
            - name: BASE_URL
              value: "https://analytics.yourdomain.com"
            - name: DATABASE_URL
              value: "postgres://plausible:pass@postgres:5432/plausible"
            - name: CLICKHOUSE_DATABASE_URL
              value: "http://clickhouse:8123/plausible"
            - name: SECRET_KEY_BASE
              valueFrom:
                secretKeyRef:
                  name: plausible-secrets
                  key: secret-key
            - name: TOTP_VAULT_KEY
              valueFrom:
                secretKeyRef:
                  name: plausible-secrets
                  key: totp-key
          resources:
            requests:
              memory: "256Mi"
              cpu: "100m"
            limits:
              memory: "1Gi"
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: clickhouse
  namespace: analytics
spec:
  replicas: 1
  template:
    spec:
      containers:
        - name: clickhouse
          image: clickhouse/clickhouse-server:24.3-alpine
          ports:
            - containerPort: 8123
          volumeMounts:
            - name: data
              mountPath: /var/lib/clickhouse
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 50Gi

Bypass Ad Blockers (Reverse Proxy)

# Nginx config - proxy the tracking script through your domain
location /js/visits.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 $remote_addr;
}

Script tag on your site:

<script defer data-domain="yourdomain.com" src="/js/visits.js"></script>

This bypasses ad blockers because the script loads from your own domain.

Custom Events

Track conversions without cookies:

// Track signup
plausible('Signup', {props: {plan: 'pro', source: 'blog'}})

// Track download
plausible('Download', {props: {file: 'whitepaper.pdf'}})

// Track outbound link
plausible('Outbound Link', {props: {url: 'https://calendly.com/lucaberton'}})

Migration from GA4

Plausible imports historical GA4 data:

  1. Export from GA4 (Google Takeout or API)
  2. Plausible Settings โ†’ Import Data โ†’ Google Analytics
  3. Historical data appears in same dashboard

Resource Requirements

ScaleVisitors/moRAMCPUStorage
Smallunder 100K512MB0.510GB
Medium100K-1M2GB150GB
Large1M-10M4GB2200GB
Enterprise10M+8GB+4+500GB+

Plausible is incredibly efficient โ€” a single small VPS handles 100K visitors easily.

Free 30-min AI & Cloud consultation

Book Now