> ## Content Index
> Fetch the complete content index at: https://goksel.dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# Simple, Quick, and Cookie-Free: Plausible Analytics Setup Guide
- URL: https://goksel.dev/simple-quick-and-cookie-free-plausible-analytics-setup-guide/
- Published: 2025-01-12T00:52:54.000Z
- Updated: 2025-01-14T15:39:48.000Z
- Description: Learn how to set up self-hosted, open-source Plausible Analytics on your server. A concise guide for secure, cookie-free tracking.
- Author: Goksel Ozardali

#### On this page

### Introduction

When you create a website, you probably want to know who visits your site, which browser they use, where your traffic comes from, and which of your contents are the most popular. There are plenty of tools you can use to get this kind of data. However, some of these tools provide tons of data that you might not even need, which can make things unnecessarily complicated.

At the end of the day, not everyone wants to see every single detail; sometimes, you just want to keep things simple. That’s exactly where I am, and I don’t want to deal with unnecessary data. This is where **Plausible** comes into play! It shows you what’s happening on your site in a simple way, while keeping all measurements completely anonymous. No cookies are used, no personal data is collected, and it’s open source.

I should also mention: since it doesn’t rely on cookies, it is less likely to be blocked by ad block extensions compared to other analytics tools. For example, **Google Analytics** can often be blocked by ad blockers. (Side note: If you’re using multiple analytics tools and you’re getting different results, you might want to look into this.)

If you’d like to compare Plausible with other tools, their website has detailed comparisons that you might find useful:

- [Google Analytics vs. Plausible](https://plausible.io/vs-google-analytics?ref=goksel.dev)
- [Matomo vs. Plausible](https://plausible.io/vs-matomo?ref=goksel.dev)
- [Cloudflare Web Analytics vs. Plausible](https://plausible.io/vs-cloudflare-web-analytics?ref=goksel.dev)

### Two Versions of Plausible: Cloud and CE

Plausible offers two different versions:

1. **Cloud**: You can pay $9 per month and simply add a single script to your website to start using it without any hassle.
2. **Community Edition (CE)**: If you’re up for a self-hosted solution, you can host it on your own server with about 15–30 minutes of effort. A small server costing $3–$4 per month will do the job.

The choice is entirely yours. If you’re thinking, *“I don’t want to deal with this, I’ll just pay”*, the Cloud version is perfect for you. But if you’re saying, *“I’ll put in a bit of effort, and I’ll spend the extra money on coffee”*, then CE is the way to go. 😉

Alright, now let's get to the main part. I've written the code for you; all you need to do is a bit of `CTRL + C` and `CTRL + V`.

### Plausible CE Installation Guide

Now, let me walk you through how to install the CE version of Plausible step by step. I installed it on a server running **Ubuntu 24.04**, but don’t worry, it works smoothly on **Ubuntu 22.04** as well.

### Requirements

[](https://github.com/plausible/community-edition?ref=goksel.dev#prerequisites)

- [**Docker**](https://docs.docker.com/engine/install/?ref=goksel.dev) and [**Docker Compose**](https://docs.docker.com/compose/install/?ref=goksel.dev) must be installed.
- Your CPU must support **SSE 4.2** or **NEON** (no ARM processors).
- At least **2 GB of RAM** is recommended to avoid issues.

First, connect to your server using SSH:

```shell
ssh root@YOUR_SERVER_IP
```

Then, update and upgrade the server packages:

```shell
sudo apt update && sudo apt upgrade -y
```

If there are kernel updates, reboot the server:

```shell
sudo reboot
```

### Installing Docker

Now, install the required dependencies:

```shell
sudo apt install -y ca-certificates curl gnupg
```

Add Docker’s GPG key and repository:

```shell
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
```

```shell
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```

Finally, install Docker:

```shell
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

After completing this step, your Docker installation will be finished. When you run the command below, you should see an output similar to the example provided (version numbers may vary).

```shell
docker --version
```

![docker version](https://goksel.dev/content/images/2025/01/1_docker-version-gokseldev.png)

docker version

### Installing Docker Compose

If Docker Compose is not already installed, you can install it using the following commands:

```shell
sudo curl -L "https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```

```shell
sudo docker ps
```

![docker ps](https://goksel.dev/content/images/2025/01/2_docker-ps-gokseldev.png)

docker ps

### Installing Plausible Analytics

Now it’s time to install Plausible. First, we’ll clone the official Plausible repository to our server. (Keep in mind that newer versions of Plausible might be available. If so, make sure to update the command before running it.)

I’ll follow my own folder structure for the installation. However, if you prefer to use a different structure, don’t forget to adjust the commands accordingly.

```
git clone -b v2.1.4 --single-branch https://github.com/plausible/community-edition /home/plausible-analytics
cd /home/plausible-analytics
```

Creating the `.env` File  
We’ll create a `.env` file for Plausible and add some basic configuration details:

```shell
touch .env
echo "BASE_URL=https://plausible.goksel.dev" >> .env
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
echo "HTTP_PORT=8000" >> .env
```

```shell
cat > compose.override.yml << END
services:
  plausible:
    ports:
      - 8000:8000
    environment:
      DISABLE_HTTPS_REDIRECT: true
END
```

**Adjusting Ports**  
If you change the default ports during installation, ensure you update the ports accordingly in the nginx configuration step.

That’s all we need to configure for now. Next, let’s install nginx on our server.

#### Reverse Proxy and SSL Setup

I’ll use **nginx** as a reverse proxy and set up an SSL certificate using **Let’s Encrypt**. (Alternatively, you can use **CaddyServer**, **ApacheServer**, or similar tools, but this guide will focus on nginx.)

### Installing nginx

Let’s start by installing nginx:

```shell
sudo apt install -y nginx
```

Next, let’s clean up the default nginx configuration:

```shell
sudo rm -rf /etc/nginx/sites-available/default
sudo rm -rf /etc/nginx/sites-enabled/default
```

Now, create a configuration file for your domain:

```shell
sudo nano /etc/nginx/sites-available/plausible.goksel.dev.conf
```

Copy and paste the following configuration into the file and save it. 

❗Don’t forget to update the `server_name` and `proxy_pass` port values to match your setup.

```
server {
    server_name plausible.goksel.dev;

    location / {
        proxy_pass http://127.0.0.1:8000; # Docker Plausible Port
        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;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }

    listen 80;
}
```

```shell
sudo ln -s /etc/nginx/sites-available/plausible.goksel.dev.conf /etc/nginx/sites-enabled/
```

We check for any errors in the configuration, and if there are none, we reload nginx. (If you encounter an error, the message will indicate which line contains the issue.)

```shell
sudo nginx -t
sudo systemctl reload nginx
```

### SSL Certificate with Let's Encrypt

Now, let’s set up SSL. To do this, we first need to install **certbot** on the server:

```shell
sudo apt install certbot python3-certbot-nginx
```

Once certbot is installed, we can create the SSL certificate:

```shell
sudo certbot --nginx -d plausible.yourdomain.com
```

We’ve now created the SSL certificate, completed the nginx configuration, and finalised the setup for Plausible. 

Navigate to the directory where Plausible is installed, and start it using Docker:

```shell
cd /home/plauisible
sudo docker compose up -d
```

Once the process is complete, run the following command to check the status:

```shell
sudo docker ps
```

![docker ps](https://goksel.dev/content/images/2025/01/3_docker-ps-gokseldev.png)

docker ps

If you see an output similar to the example below, congratulations! Plausible is running smoothly on Docker. Now, visit your site. 🎉

### Plausible Panel Setup

We’ve reached the final step of the setup. In the Plausible panel, you’ll need to fill in your details to complete the configuration.

If you’d like to enable additional features like password resets, you’ll need to set up **SMTP** settings. I won’t go into detail about that in this guide, but Plausible’s [documentation](https://github.com/plausible/community-edition/wiki/Configuration?ref=goksel.dev#email) provides clear instructions. You can easily activate email functionality by adding a few lines to your `.env` file.

![Plausible Analytics First Setup](https://goksel.dev/content/images/2025/01/plausible-analytics-1-gokseldev.png)

Plausible First Setup

### Possible Issue: SSL and WebSocket Errors

If you can access the site but something isn’t working—like clicking the **"Create my account"** button does nothing—check your browser’s console.

If you see an error related to **WebSocket**, it’s likely due to a minor issue in your SSL configuration.

![WebSocket connection problem](https://goksel.dev/content/images/2025/01/plausible-analytics-wss-error-gokseldev-1.png)

WebSocket connection problem

But don’t worry, the solution is simple: Go back to your **nginx** configuration and add the missing lines to the `location` block:

```shell
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
```

Then reload nginx:

```shell
sudo systemctl reload nginx
```

After this step, everything should work as expected!

### Analytics Data

Now it’s time to select which site’s analytics you want to track. In the panel, enter your site’s URL and choose the appropriate timezone for reporting. Once this step is completed, you can easily add additional sites to track in the future.

![Plausible analytics add website](https://goksel.dev/content/images/2025/01/plausible-analytics-3-gokseldev.png)

Plausible add website

![Plausible analytics website measurements](https://goksel.dev/content/images/2025/01/plausible-analytics-4-gokseldev.png)

Plausible website measurements

![Plausible analytics](https://goksel.dev/content/images/2025/01/plausible-analytics-6-gokseldev.png)

Plausible

If you see this screen, open your site in a different tab and celebrate 🥳

![Plausible Analytics Dashboard](https://goksel.dev/content/images/2025/01/plausible-analytics-7-gokseldev.png)

Plausible Analytics Dashboard

### Time to Treat Yourself to Some Real Cookies 🍪

That’s it! Grab a cup of coffee, pair it with a cookie, and enjoy monitoring your site’s analytics with ease! ☕ 🍪