Self-hosted website analytics

May 15, 2021

In this post, we talk about self-hosted alternatives to Google Analytics, why you should be using them instead and how you'd go about deploying them on Railway!

Let's face it, you probably shouldn't be using Google Analytics. It is a bloated script that slows down your site. The recommended installation method adds ~45kb to your page size compared to ~2kb (which is the size most self-hosted options come at). On top of that, it collects personal data and also uses cookies which means you must obtain cookie consent and also disclose to the users of your site that you are using GA to remain GDPR compliant.

If that wasn't enough, most ad-blockers and several browsers also block the GA tracking script. Which means that a portion of your analytics data will probably be inaccurate!

Why self-host

In the intro above, we briefly talked about the issues with Google Analytics. In this section, we will cover the benefits of using an open source analytics provider and self-hosting it.

Data ownership + GDPR

If you self-host your analytics, you own all the data and none of it goes to any third party. This way, you're also protecting the privacy of your users. On top of that, most self-hosted solutions do not set cookies or track any personal data which means you don't have to show any cookie consent banners and your site remains GDPR compliant.

Open-source

Another major advantage of self-hosting an open-source analytics solution is that you are completely aware of what it is doing. If you can't code yourself, you can get a friend (or hire someone) to look at it. This way, you can be confident that nothing sneaky is going on behind the scenes with your and your users data.

Faster page loads

Most self-hosted solutions are between 10-20 times smaller than the Google Analytics script and upto 40-50 times smaller if you install GA using the Google Tag Manager. Because these scripts are smaller, the weight of your pages is reduced and your site loads faster providing your users with a better experience.

Bypass ad-blockers

Most ad-blockers and several browsers block the Google Analytics script. If you self-host your analytics solution under your own domain, you can reliably avoid these ad-blockers and accurately track your analytics.

Deploying on Railway

Self-hosting generally is a painful and cumbersome task which is why most people opt for readymade solutions. That's not the case with us, listed below are the self-hosted analytics starters you can deploy on Railway with the click of a button.

Ackee

Ackee dashboard
Ackee dashboard

Ackee is a self-hosted, Node.js based analytics tool for those who care about privacy. Ackee runs on your own server, analyzes the traffic of your websites and provides useful statistics in a minimal interface.

You can deploy your own instance of Ackee on Railway with just one click. We will automagically provision a MongoDB database for you which Ackee uses to store the data. All you need to do is set a username and a password and hit deploy!

For the curious ones, you can view a live demo of Ackee or peek the source code that we deploy for you.

Umami

Umami dashboard
Umami dashboard

Umami is a simple, easy to use, self-hosted web analytics solution. The goal is to provide you with a friendlier, privacy-focused alternative to Google Analytics and a free, open-sourced alternative to paid solutions. Umami collects only the metrics you care about and everything fits on a single page.

To deploy your own self-hosted instance of Umami on Railway, you can use our starter template. Umami uses Postgres internally which we deploy automagically for you and we also run the necessary migrations to set up both the database and the admin user for you.

You should be able to log in to the dashboard with the username admin and the password umami. Make sure you change the password on your first login. You can view a live demo of Umami or take a look at the source code we deploy for you.

Closing

As of right now, those are the two starters that you can deploy on Railway and have your own self-hosted analytics set up with the click of a button. Once we add more self-hosted analytics starters, we'll update this post and them here as well.

If you have suggestions for more open source analytics starters that you'd like to see, reach out to us on Twitter or Discord. Or even better, submit a pull request to our starters repository on Github.