🗺️ Choosing a self-hosted web analytics solution
Recently I decided to finally get rid of Google Analytics in favor of a self-hosted solution. That’s how it went, a list of available options to migrate and why you need it too.
Why I decided to migrate
Initially this website and all my other projects were undoubtedly configured to use GA. And everything went well, actually, until I started to care about such things as GDPR, CCPA, PECR and so on. My website has no complaints, but it just disturbed me without an actual reason.
Making GA GDPR-compatible is a pain in the ass and you would eventually end up with that weird “Accept all cookies” banner. Moreover, you must then implement this logic for each of your projects, which is literally unacceptable.
Besides this, it’s worth noting the following arguments:
- The last time I checked GA’s JavaScript file was 377kb, which is usually larger than some actual projects nowadays.
- GA’s JS is blocked by default by most adblockers, which makes your analytics non-representative more or less depending on niche. And our niche of software development is probably the sweetest spot for adblock users.
- And, finally, regarding GA’s UI / UX: it’s just bad.
But besides all of these cons, I believe there are good use-cases for GA, so if it suits you well, then this article isn’t about you. Personally I think that if you’re going further with your blog, you eventually should migrate.
What options do we have
Next, let’s see where we can migrate. We will consider only self-hosted and GDPR-compatible options because in my opinion there is no truly free and good managed web analytics solution.
- milesmcc/shynet - written in Python, lightweight web analytics, which was targeted to be self-hosted from the very beginning. It requires really nothing to start, can be used with SQLite or PostgreSQL as a database. However, it’s probably too lightweight as it’s missing some essential features like custom events and utm tracking.
- piratepx/app - probably the most lightweight web analytics you have ever seen, written in JavaScript. Counts only visits and nothing more. Requires PostgreSQL to run. It also has a live demo.
- matomo-org/matomo - looks like the most mature and feature-complete self-hosted solution written in PHP. It requires MySQL to run and nothing else. Honestly, this probably would be the best solution to choose, but PHP + MySQL + their UI scares me away.
- plausible/analytics - another mature solution with nice UI / UX and enough features, written in Elixir. It requires the resource-intensive ClickHouse + PostgreSQL bundle, which is huge as for self-hosting.
- rybbit-io/rybbit - and the last, pretty good-looking major competitor to everything above. Written in JavaScript, also requires ClickHouse + PostgreSQL, and probably has more features than Plausible.
And it’s also worth mentioning such solutions as: posthog/posthog, arp242/goatcounter and explodingcamera/liwan. Many more exist on the market, but these are the most noticeable.
After a long testing and researching, I was struggling between Plausible and Rybbit as a result. Subjectively, I liked Plausible more. Rybbit is also great, and maybe even better overall, but there is something inside me that doesn’t like it 🤡
So, my personal subjective top is: Plausible, Rybbit, Matomo.
Conclusion
So, is it worth it or not? To start with what I can definitely say is that adblock is a real deal among my audience, as GA vs Self-Hosted Plausible unique visitors counters differ by x4-x5 times 🤡 That’s a really huge difference: for example, GA shows me 10 visitors, while Plausible shows 50.
And finally, I’m calm that everyone’s privacy is respected. And I’m glad that it was accomplished without implementing weird “Accept all cookies” banners.
Yes, hosting and managing ClickHouse hurts, as it requires at least 6GB RAM to run, which is usually too much for self-hosting. But you should just accept it and then it feels better. On the other hand, now I have it running and I can try some things which I refused to configure due to my reluctance to install ClickHouse.
So, summing everything up, I think it’s worth it. Do it once and be at peace.
Thank you for reading this little article, I hope it will be useful to someone. Feel free to reach me if you have something to say.
And also take a look on the posts on similar topics: