Open-Source Website Analytics with Plausible

A step-by-step guide to deploying the open-source website analytics tool, Plausible Analytics, on DigitalOcean.

In today's digital age, website traffic analytics is essential for businesses to make informed decisions about their online presence. Google Analytics is the most popular free solution in this space, but it is not available as a self-hosted option. In a previous post, I covered Umami, a lightweight, open-source alternative. Today, I'll explore Plausible Analytics - another privacy-focused alternative - what it is, key capabilities, and how to deploy a self-hosted version on DigitalOcean.

What is Plausible Analytics?

Plausible Analytics is a lightweight (< 1Kb), easy-to-use and open source web analytics solution. It does not use cookies or collect personally identifiable information from its users. It provides website owners with a range of metrics, including page views, bounce rates, and referral sources, which can be used to optimise website performance, improve user experience, and make data-driven decisions. It also provides users with detailed reports on visitor behaviour, including device types, locations, and offers customisable dashboards, which can help businesses enhance their online presence. Powered by European-owned cloud infrastructure, Plausible is compliant with the GDPR, CCPA and PECR regulations.

Image source:
Image source:

Deploy Plausible on a DigitalOcean Droplet

For this walk-through, I'll use DigitalOcean; if you don't have an account, sign up here - you’ll receive a $200, 60-day credit when you add a valid payment method. Set up your team and project, and deploy the Docker 1-Click Droplet from the marketplace. This droplet includes the Docker CE and Docker Compose packages, along with their respective dependencies. In addition to package installation, the droplet also configures Docker according to the official recommendations. Click Create Docker Droplet, select the data center region, the CPU option, an authentication option, the hostname, and click Create Droplet.

Once the droplet is ready, select it and launch the Droplet Console as root from the menu options. Run the following commands to clone the Plausible GitHub repo, install the required packages, and run the Plausible server.

# Download the Plausible GitHub repo
git clone
cd hosting

In this directory, the docker-compose.yml file installs and orchestrates networking between the Plausible server, Postgres and Clickhouse databases, and an optional SMTP server for email notifications. We are going to skip additional configuration, and use the defaults i.e. use local databases without email notifications. Look for the plausible-conf.env file and update the following variables:

  • SECRET_KEY_BASE: random 64-character secret key used to secure the app.
  • BASE_URL: base URL where the Plausible instance is available, including the scheme (http:// or https://), the domain name, and optionally a port if you don't wish to use the default 8000.

Generate the secret key value as follows and replace in the config file:

openssl rand -base64 64 | tr -d '\n' ; echo

The Plausible server runs on unencrypted HTTP by default and does not perform SSL termination. Let's set up a reverse proxy in front of the server using Caddy in the next section. First though, create a DNS A record in your DNS host that points to the droplet IP address, and update the BASE_URL in the config file accordingly i.e.

Configure HTTPS with Caddy Server

Caddy is a powerful yet simple, Go-based open-source web server. Written in a memory-safe language, it compiles to a single, static binary, making it easy to run Caddy practically anywhere, even in containers. Caddy obtains and renews TLS certificates automatically, staples OCSP responses, and even performs automatic HTTPS rewrites. Let's install Caddy on the droplet first.

apt install -y debian-keyring debian-archive-keyring apt-transport-https

curl -1sLf '' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf '' | sudo tee /etc/apt/sources.list.d/caddy-stable.list

apt update && apt install caddy

Next, update the docker-compose.caddy-gen.yml file under the /hosting/reverse-proxy folder. Update the domain name and email address in the section below.

    labels: "" # change to your domain name
      virtual.port: "8000"
      virtual.tls-email: "" # change to your email

Finally, run docker compose to deploy all the components and start Plausible.

docker compose -f docker-compose.yml -f reverse-proxy/docker-compose.caddy-gen.yml up

Configure Your Website for Plausible Analytics

Once you launch the Plausible URL, you'll be greeted with the account registration page. Provide the admin account details, and click Create my account.

Plausible admin registration
Plausible admin registration 

Next, provide the domain/website that you want to monitor traffic for, and click Add snippet. You can add more websites later.

Plausible website configuration
Plausible website configuration

You'll get a short Javascript code to inject into your website pages. Add the code to your web pages, launch your website, and watch the Plausible dashboard light up!

Plausible dashboard
Plausible dashboard

That was a straightforward way to self-host a Plausible instance - a few final thoughts and considerations below:

  • If you'd like to send transactional emails (e.g. account activation, password reset), see the SMTP server setup here.
  • If you'd like to use a geolocation database other than the default db-ip option, see the guidance here.
  • See this guide for information on getting the most out of your Plausible server.
  • Finally, if you like Plausible but don't want to self-host the server, Plausible also offers a cloud-hosted option - compare the capabilities here.

Subscribe to alphasec

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.