Self hosted analytics. Like google, but not so intrusive.
Google Analytics.
The last time I ran a website of any meaning, it was something I built for my fathers fledgling business. It was a simple affair, and lets be honest pretty ropey looking, design never being one of my strong skills. Shout out to the developers of the theme (klise) I’m currently running on Relf.co.
The one thing that did interest my farther and I was, is the website getting any traffic, are people clicking on things, and was the £29.99 a year we were paying to our web hosting company worth the money.
So off to Google Analytics I went, signed up, generated a snip-it and mashed that bad-boy into the header of the website. Before long we started to get the answers to the questions we were asking. Yes the website was generating traffic, yes people were staying and engaging with the content.
Unfortunately they were also getting loaded down with loads of cookies and other tracking crap, curtsey of Google Analytics.
Tracking Cookies, the EU and shudder GDPR
Back in the olden times, the mid to late 2000’s, data privacy on the internet was something people were either not aware of, not concerned with or wasn’t legislated about. This has changed massively over the last few years (in the EU/UK), with arguably the biggest change being GDPR - General Data Protection Regulation. Introduced in 2016 this EU regulation put into place some extremely strong requirements around cookies, tracking and the right to be forgotten. This is the main reason when you hit a website hosted in the EU you are asked for explicit consent for cookies to be dropped onto your machine.
Tracking visitors
The main reason people want to drop a cookie onto your machine is to “track” your activity on their website, to see how many pages you look at, what content is engaged most with, how many people bounce etc. This is all really useful information for the marketing department or hell even someone like me, who does this stuff for shits and giggles. If I can work out what type of content people actually want to read, then I can write more content like that. (Or in my case, no one reads any of it, and I might as well write about what ever I want to :D)
Balancing user privacy with information gathering.
Firstly, I don’t need the full gamut of information something like Google Analytics can provide, and I’m also not interested in dropping Googles tracking cookies onto a visitors machine so that they (Google) can advertise to you more effectively, and as such I wanted to find a (preferably opensource) self hosted and privacy focused analytics package.
Introducing - Plausible
Plausible, is everything I could have hoped for. Its OpenSource, it provides a self hosting capability and most importantly of all its privacy focused.
Installing
The first step to using Plausible was to get it installed. As Plausible offers a paid for SaaS service I was expecting the installation of a self hosted option to be a second class citizen. Boy was I wrong, writing this blog post has actually taken longer than installing and correctly configuring Plausible. The engineering team at Plausible have taken the time to build out a set of containers, and a simple docker-compose file that makes installing Plausible in containers an absolute breeze.
Without re-writing their documentation these are the steps I took.
- Clone the git repo.
- Edit
plausible-conf.env
- Adding a secret key.
- Setting the base URL for the analytics site.
- Setting the SMTP relay settings.
- Ran
docker-compose up -d
. - Edited Caddy to proxy back to port 8000.
- Browsed to https://analytics.relf.co.
- Went through the user creation.
- Added the outputted script to relf.co html header.
And that was it.
All your metrics belong to us.
I was impressed that out of the box you get the following;
- Unique Visitors
- Total Visits
- Total Page Views
- Views per visit.
- Bounce Rate
- Visit Duration
- Top Sources
- Top Pages
- User devices
That information is enough for what I need, which is to see how (un)popular my content is and where it is mostly coming in from.
Pros
- Super Easy to setup.
- No cookies.
- A single 1-2kb script.
- Simple and concise dashboard for reporting.
- Ability to share dashboards with others/the public.
- Ability to import from Google Analytics if you decide to migrate.
Cons
- May lack some features Google Analytics power uses expect
Final thoughts.
All in all I have been impressed with the simplicity and ease of use of Plausible, and whilst this reads like an advertisement for them, its not, it was just a refreshing surprise to find an product that does exactly what it says on the tin, and meets all my current requirements.
If you want to see the dsahboard for relf.co, feel free to browse to analytics.relf.co
Until next time, Steve.