DEV Community

Peon Sh
Peon Sh

Posted on Originally published at peon.sh

Self-Host Plausible Analytics: Own Your Website Data

Conduct analytics on your own servers, without any cookies. Deploy Plausible with just one click using Postgres and ClickHouse databases.

Why Plausible over Google Analytics
Plausible is the top privacy-focused analytics solution: the script size is less than 1 KB (compared to the GA4 tag of about 50 times larger); no cookies; no cross-site tracking; and a one-page dashboard that even a human could understand without special training. The compliance story under GDPR regulations is much easier since Plausible gathers no personal information at all.

The monthly plan starts from €9 with limitations on the number of visitors. Self-hosted Community Edition (AGPL license) will allow you to get rid of those limitations and payment in return.

The stack and deployment
A viable configuration of CE would consist of three services: the Phoenix app, Postgres database for user accounts and site configuration, and the ClickHouse database for the actual events. As a one-button deployment from Peon, the stack comes with all the right configuration, generated secrets, service connections and volumes; just give it a custom domain such as analytics.example.com and an SSL certificate will be generated automatically.

Two parameters need to be set during deployment: BASE_URL should correspond to the final URL (including scheme), and the first registered user will be treated as an admin; register right after deploying, then turn off open registration.

Sizing and resource reality
ClickHouse is the hungry piece: budget for 2 GB of RAM for the full stack to have some buffer

CPU is minimal at small scale; event collection is low

Disk increases with events; 1 GB per a few million pageviews is the cost-effective way to go

A shared 4 GB VPS can host Plausible along with two or three applications on websites reaching millions of monthly views

Connect your sites
Put the code block into each website; a single Plausible setup monitors limitless domains.

Ad blockers block third- party analytics domains less frequently when serving from your own domain, representing one of self-hosting's quieter accuracy victories.

Optional: run the script via the site's native origin to achieve superior capture metrics

Operations
Back up Postgres every night since it holds site configs, users, and goals; ClickHouse event logs are larger and potentially recoverable again, so back them up weekly or knowingly accept that compromise. System upgrades involve changing image tags then redeploying; Plausible updates database structures when starting up. Overall operating expense on a current machine: basically nothing compared to nine euros or higher per month if hosted, making data control a benefit instead of a cost.

Top comments (0)