Deployment Guide

    Plausible Analytics

    Self-hosted, privacy-friendly web analytics. No cookies, no personal data, full GDPR compliance by design.

    20–30 minutes
    2GB+ RAM recommended
    VPS

    2GB RAM minimum / 4GB recommended

    OS

    Ubuntu 22.04 / 24.04 LTS

    Also Needed

    Domain name with DNS access

    Introduction

    Plausible Analytics is a lightweight, open-source, privacy-friendly alternative to Google Analytics. It provides essential website traffic insights without using cookies, collecting personal data, or requiring complex configuration. The tracking script is approximately 75 times smaller than Google Analytics, resulting in faster page loads and reduced bandwidth.

    Plausible Community Edition (CE) is the self-hosted, AGPL-licensed version that gives you complete control over your analytics data. By deploying on a RamNode VPS, you get full data ownership, GDPR/CCPA/PECR compliance by design, and significant cost savings compared to managed services.

    Plausible CE requires at least 2 GB of RAM due to the ClickHouse database engine. RamNode VPS plans start at just $4/month, making self-hosted Plausible significantly more affordable than managed analytics services.

    Part 1: Server Preparation

    1Connect to Your VPS

    ssh root@YOUR_SERVER_IP

    2Update the System

    apt update && apt upgrade -y

    3Install Docker and Docker Compose

    curl -fsSL https://get.docker.com | sh
    
    # Verify installation
    docker --version
    docker compose version

    Docker Compose v2 is included with modern Docker installations. If docker compose version fails, install the plugin separately: apt install docker-compose-plugin

    4Configure the Firewall

    ufw allow OpenSSH
    ufw allow 80/tcp
    ufw allow 443/tcp
    ufw enable

    5Configure DNS

    Point a subdomain to your VPS by creating an A record:

    TypeNameValueTTL
    AanalyticsYOUR_SERVER_IP300

    DNS propagation can take up to 24 hours (typically minutes). Verify with: dig analytics.yourdomain.com

    Part 2: Deploying Plausible CE

    1Clone the Community Edition Repository

    mkdir -p /opt/plausible && cd /opt/plausible
    
    git clone -b v3.2.0 --single-branch \
      https://github.com/plausible/community-edition.git .

    2Create the Environment File

    touch .env
    
    # Set your domain (replace with your actual domain)
    echo "BASE_URL=https://analytics.yourdomain.com" >> .env
    
    # Generate and set a secure secret key
    echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
    
    # Disable public registration after creating your account
    echo "DISABLE_REGISTRATION=invite_only" >> .env

    The BASE_URL must match the exact domain where Plausible will be accessible, including https://. No trailing slash or path.

    3Configure HTTPS with Automatic TLS

    # Add port configuration to .env
    echo "HTTP_PORT=80" >> .env
    echo "HTTPS_PORT=443" >> .env

    Create a compose override to expose ports:

    compose.override.yml
    services:
      plausible:
        ports:
          - "80:80"
          - "443:443"

    Plausible handles TLS certificate provisioning and renewal automatically. No separate reverse proxy or Certbot setup required.

    4(Optional) Configure Email / SMTP

    For traffic reports, password resets, and team invitations:

    echo "MAILER_EMAIL=plausible@yourdomain.com" >> .env
    echo "SMTP_HOST_ADDR=smtp.yourmailprovider.com" >> .env
    echo "SMTP_HOST_PORT=587" >> .env
    echo "SMTP_USER_NAME=your_smtp_username" >> .env
    echo "SMTP_USER_PWD=your_smtp_password" >> .env
    echo "SMTP_HOST_SSL_ENABLED=true" >> .env

    Popular SMTP providers: SendGrid, Mailgun, Amazon SES, Postmark. Most offer a free tier sufficient for Plausible notifications.

    5Launch Plausible

    cd /opt/plausible
    docker compose up -d
    
    # Monitor startup
    docker compose logs -f

    Wait until you see log output indicating the web server is listening (typically 1–2 minutes on first launch).

    6Create Your Admin Account

    Navigate to your Plausible URL (e.g., https://analytics.yourdomain.com). Fill in the registration form to create your admin account.

    With DISABLE_REGISTRATION=invite_only, no one else can register unless you explicitly invite them from the dashboard.

    7Verify the Deployment

    • HTTPS is active (lock icon in browser address bar)
    • Dashboard loads without errors
    • All containers are healthy:
    docker compose ps

    Part 3: Adding & Tracking Sites

    Add a Website

    From your dashboard, click "+ Add a website". Enter your domain exactly as visitors see it (e.g., yourdomain.com without https://). Select your timezone and click "Add snippet."

    Install the Tracking Script

    Add this snippet to the <head> section of every page:

    HTML tracking snippet
    <script defer data-domain="yourdomain.com"
      src="https://analytics.yourdomain.com/js/script.js">
    </script>

    Platform-Specific Installation

    PlatformWhere to Add
    WordPressInsert Headers and Footers plugin, or edit header.php
    Static HTMLPaste into the <head> tag of every page
    Next.jsAdd to Head component in _app.js or app/layout.tsx
    GhostSettings → Code injection → Site Header
    Hugo / JekyllBase template or partials/head.html
    Gatsbygatsby-plugin-plausible or gatsby-ssr.js

    Additional Measurement Options

    Enable extra tracking by changing the script filename:

    FeatureScript Filename
    Outbound Link Clicksscript.outbound-links.js
    File Downloadsscript.file-downloads.js
    Custom Events (CSS)script.tagged-events.js
    Hash-Based Routingscript.hash.js
    All Combinedscript.outbound-links.file-downloads.tagged-events.js

    You can track as many websites as you want from a single Plausible instance. Each site gets its own dashboard and tracking snippet.

    Part 4: Google Search Console Integration

    Display the search keywords visitors use to find your site directly in your Plausible dashboard — no Google code on your website required.

    1Set Up Google Search Console

    1. Navigate to search.google.com/search-console and sign in.
    2. Click "Add a property" and choose Domain or URL prefix verification.
    3. Follow Google's instructions to verify ownership (DNS TXT record or HTML file).

    2Create Google Cloud OAuth Application

    1. Go to console.cloud.google.com and create a new project.
    2. Navigate to APIs & Services → OAuth consent screen. Select "External" and create.
    3. On the Scopes page, add the Google Search Console API with read-only access.
    4. Add your Gmail as a test user.

    3Generate OAuth Client Credentials

    1. Click Credentials → + Create Credentials → OAuth client ID.
    2. Set type to "Web application".
    3. Under Authorized redirect URIs, add: https://analytics.yourdomain.com/auth/google/callback
    4. Copy the Client ID and Client Secret.

    The redirect URI must exactly match your BASE_URL followed by /auth/google/callback.

    4Enable the API & Add Credentials

    In Google Cloud Console, search for and enable the "Google Search Console API". Then add credentials to Plausible:

    cd /opt/plausible
    
    echo "GOOGLE_CLIENT_ID=your_client_id_here" >> .env
    echo "GOOGLE_CLIENT_SECRET=your_client_secret_here" >> .env
    
    docker compose down && docker compose up -d

    5Connect in Plausible Dashboard

    1. Go to your site settings → Integrations / Search Console.
    2. Click "Continue with Google" and authenticate.
    3. Select your Search Console property and save.

    Google Search Console data is updated every 24–48 hours. If your OAuth app is in "Testing" status, tokens may expire after 7 days — publish to Production to avoid this.

    Part 5: Setting Up Goals

    Goals track specific visitor actions beyond pageviews. The Goal Conversions section appears at the bottom of your dashboard once configured.

    Pageview Goals

    Track visits to specific pages (thank-you pages, pricing, etc.):

    1. Site settings → Goals → + Add goal
    2. Select "Pageview" and enter the page path (e.g., /thank-you)

    Use wildcards to match multiple pages:

    Goal PathWhat It Tracks
    /blog*All pages under /blog
    /docs/*All documentation pages
    /products/*/reviewsReview pages for any product

    Custom Event Goals — CSS Class Method

    Use the tagged-events script extension and add CSS classes:

    HTML examples
    <!-- Track a button click -->
    <button class="plausible-event-name=Signup+Click">
      Sign Up Now
    </button>
    
    <!-- Track a CTA link -->
    <a href="/demo" class="plausible-event-name=Demo+Request">
      Request a Demo
    </a>

    Custom Event Goals — JavaScript API

    JavaScript API
    <script>
    window.plausible = window.plausible || function() {
      (window.plausible.q = window.plausible.q || []).push(arguments)
    }
    </script>
    
    // Track a form submission
    document.getElementById('signup-form')
      .addEventListener('submit', function() {
        plausible('Form Submission');
      });
    
    // Track with custom properties
    plausible('Purchase', {
      props: { plan: 'Pro', price: '49' }
    });

    Automated Tracking Goals

    • Outbound Link Clicks — Tracks all external link clicks
    • File Downloads — Tracks PDF, ZIP, DOCX, etc.
    • 404 Error Pages — Monitors broken pages
    • Form Submissions — Tracks form submissions site-wide

    Part 6: Maintenance & Administration

    Updating Plausible CE

    cd /opt/plausible
    
    git fetch --tags
    git checkout v3.x.x  # Replace with latest version
    
    docker compose pull
    docker compose down && docker compose up -d

    Always check the Plausible release notes on GitHub before upgrading. Some releases may require database migrations or configuration changes.

    Backing Up Your Data

    # Backup PostgreSQL
    docker compose exec plausible_db \
      pg_dump -U postgres plausible > backup_pg_$(date +%F).sql
    
    # Backup ClickHouse (data directory)
    docker compose stop plausible_events_db
    tar czf backup_ch_$(date +%F).tar.gz \
      /var/lib/docker/volumes/*event*
    docker compose start plausible_events_db

    Schedule automated backups using cron. For production, consider offsite backup storage.

    Monitoring Container Health

    docker compose ps
    docker compose logs --tail=50
    docker stats --no-stream

    Environment Variables Reference

    VariableDescription
    BASE_URLFull URL where Plausible is hosted
    SECRET_KEY_BASESecret key (64+ bytes, base64)
    DISABLE_REGISTRATIONControl who can register (invite_only)
    GOOGLE_CLIENT_IDOAuth client ID for Search Console
    GOOGLE_CLIENT_SECRETOAuth client secret for Search Console
    MAILER_EMAILFROM address for notifications
    SMTP_HOST_ADDRSMTP server hostname
    SMTP_HOST_PORTSMTP server port
    HTTP_PORT / HTTPS_PORTPorts for built-in server & auto TLS