Plausible Analytics is a simple, lightweight, open source and privacy-friendly alternative to Google Analytics, similar to Umami and Matomo. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR. The mission of Plausible is to reduce corporate surveillance by providing an alternative web analytics tool which doesn’t come from the AdTech world. In this step by step guide I will show you how to install Plausible on your Synology NAS using Docker.
Plausible v2.1.4 release.
This guide works perfectly with the latestSTEP 1
Please Support My work by Making a Donation.
STEP 2
Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.
STEP 3
Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.
STEP 4
Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.
STEP 5
Now click the “Create” button. Follow the instructions in the image below.
STEP 6
After you click the Create button, the window below will open. Follow the instructions in the image below.
On the General area, set the Reverse Proxy Name description: type in Plausible. After that, add the following instructions:
Source:
Protocol: HTTPS
Hostname: plausible.yourname.synology.me
Port: 443
Check Enable HSTS
Destination:
Protocol: HTTP
Hostname: localhost
Port: 9850
STEP 7
On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.
STEP 8
Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.
STEP 9
Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.
STEP 10
Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it plausible. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 11
Now create three new folders inside the plausible folder that you created at STEP 10 and name them data, db, logs. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 12
Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.
STEP 13
Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.
STEP 14
In the Name field type in plausible. Follow the instructions in the image below.
version: "3.9" services: db: image: postgres:15-alpine container_name: Plausible-DB hostname: plausible_db security_opt: - no-new-privileges:true volumes: - /volume1/docker/plausible/db:/var/lib/postgresql/data:rw environment: - POSTGRES_DB=plausible_db - POSTGRES_PASSWORD=postgres restart: on-failure:5 events-db: image: clickhouse/clickhouse-server:24.3.3.102-alpine ulimits: nofile: soft: 262144 hard: 262144 container_name: Plausible-EVENTS-DB hostname: plausible_events_db security_opt: - no-new-privileges:true user: 1026:100 volumes: - /volume1/docker/plausible/data:/var/lib/clickhouse:rw - /volume1/docker/plausible/logs:/var/log/clickhouse-server:rw restart: on-failure:5 plausible: image: ghcr.io/plausible/community-edition:latest command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" container_name: Plausible hostname: plausible security_opt: - no-new-privileges:true healthcheck: test: wget --no-verbose --tries=1 --spider http://localhost:8000/ || exit 1 ports: - 9850:8000 environment: DISABLE_REGISTRATION: false # Type in true Instead of false to Disable Registration After Your Initial Registration. BASE_URL: https://plausible.yourname.synology.me SECRET_KEY_BASE: fE2Z9z9idAfGOHzl3fAz1x4/zneBI3oel9R38k8icc6Ttlm0ZtLp3MS5Gd6RNhPzKEFpe3DeeL6x2rMm/+WZLQ== TOTP_VAULT_KEY: aihU7k+GSBKbcVFuX9VEPyUhuwlKEomqA94/SQQ0NR4= # MAILER_EMAIL: site@example.com SMTP_HOST_ADDR: smtp.gmail.com SMTP_HOST_PORT: 587 SMTP_USER_NAME: Your-own-gmail-address SMTP_USER_PWD: Your-own-app-password MAILER_ADAPTER: Bamboo.Mua restart: on-failure:5 depends_on: - db - events-db
Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for BASE_URL and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 6.
Note: Before you paste the code above in the Web editor area below, change the value for SMTP_USER_NAME and type in your own Gmail address. STEP 12.
Note: Before you paste the code above in the Web editor area below, change the value for SMTP_USER_PWD and type in your own Gmail app password. STEP 12.
Note: If you want, you can also add your own SMTP email details (not GMAIL) by removing the # in front of MAILER_EMAIL then adding your domain name email. If you don’t have your own SMTP details, and decide to use GMAIL SMTP from Google, then leave the code as it is with the #.
STEP 15
Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.
STEP 16
If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.
STEP 17
Go back to STEP 1 or you will deal with karma 🙂.
STEP 18
Now open your browser and type in your HTTPS/SSL certificate like this https://plausible.yourname.synology.me In my case it’s https://plausible.mariushosting.synology.me If everything goes right, you will see the Plausible main page. Type in your full name, your own email address and your own password. Confirm the password then click Create my account. Follow the instructions in the image below.
STEP 19
In the Domain field type in your own domain name that you want to monitor. Select your Timezone then click Add snippet. Follow the instructions in the image below.
STEP 20
Copy your own JavaScript snippet then click Start collecting data. Follow the instructions in the image below.
STEP 21
Paste your personal JavaScript snippet that you have automatically generated at STEP 20 on your website between the <head> and </head> tags of your site, then update your file. For example, I have a WordPress website hosted on a Synology NAS. If you have a WordPress website hosted elsewhere, know that the process is the same. Log into your WordPress admin Dashboard, click on the left sidebar on “Theme File Editor“, under Appearance. Select your theme then search for the header.php file. Paste your personal JavaScript snippet in the header.php file between the <head> and </head> tags of your site, then update your file. Follow the instructions in the image below.
Note: You can add multiple websites via the Plausible Dashboard later.
Go back to your plausible synology.me DDNS and start looking at the stats! After the JavaScript snippet is added to your website, Plausible will start to collect Real-Time analytics of your website. My blog doesn’t have any TRACKING CODE on it. I just installed Plausible to show you how it works and how easily you can implement it on your website. I have already uninstalled it. Don’t forget to go back to STEP 1. I have worked hard for this guide so you can enjoy it.
STEP 22
One of the most important things you need to know about Plausible is that anyone can register for a new account by default. Follow my step by step guide below to disable registration of new users in Plausible. Go to Portainer then click Stacks. Click on plausible. Follow the instructions in the image below.
STEP 23
Click on the Editor tab then scroll down the page a little bit. Follow the instructions in the image below.
STEP 24
Change the value for DISABLE_REGISTRATION from false to true then scroll down the page until you find the Update the stack button. Click Update the stack. Follow the instructions in the image below.
STEP 25
After you click Update the stack, a new pop up window will open. Click Update. Follow the instructions in the image below.
STEP 26
From now on, the registration for new user is closed.
STEP 27
Log into your Plausible instance. Click the Plausible logo at the center of the page. Click the 3 dots on the website rectangle, then Settings. Follow the instructions in the image below.
STEP 28
Your website settings at a glance!
Enjoy Plausible!
If you encounter issues by using this container, make sure to check out the Common Docker issues article.
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the Plausible container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: Instead of the synology.me DDNS you can also use your own domain name.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.
This post was updated on Friday / October 11th, 2024 at 4:49 PM