Goodbye Google Analytics, hello Umami

After removing Google Adsense from my website, I kick Google Analytics to the curb and replace it with a self-hosted, open-source alternative.

Goodbye Google Analytics, hello Umami

When I outlined my reasons for leaving Google Adsense, number 4 on my list of grievances was the invasive nature of its tracking cookies, and the privacy concerns that raises as adverts follow readers around the web. However, I can’t exactly crow about the privacy of my readers while also using Google Analytics.

What are analytics, and why do I use them?

In the context of websites, analytics is software that helps website owners to understand how visitors spend their time on the site. Basically, whenever someone arrives at a site, the software records data about their visit, and typically aggregates that data into a report.

In an ideal world, I wouldn’t use any analytics, but in truth, they help me make decisions about my site, including what I write about, how I structure my site, and how I monetise it. For example, I know my drive-by traffic brings readers who are more interested in my technical articles than my books and world-building. I know my biggest readership is from the United States, so I focus on Amazon.com as my affiliate program of choice. I know that my bounce rate goes down when I include more internal links in my posts.

So, in summary, I collect analytics to help me improve my site and make it more relevant to my readers.

What’s wrong with Google Analytics?

Well, nothing, or everything, depending on your point of view. Google Analytics is a powerful analytics service that harvests an eye-watering amount of data. Honestly, I don’t know the full extent of what it collects, nor do I know how many websites around the world use it. The best estimates I’ve seen are upwards of 56.4% of all websites in the world.

All the data they’ve hoovered isn’t just for the website owners. Rather, it is fed to Google’s servers, becoming yet another slice of the Big Data pie controlled by the tech behemoths. And the data they collect is their data, not ours. Sure, they give me a bewildering array of reports generated from that data, but the raw records are out of my control.

Privacy aside, I dislike Google Analytics because it’s overly complicated to use, has a lot of unwanted noise, attracts spambots, while adding performance and bandwidth overhead to my website.

So, I’ve decided to remove Google Analytics from my website, and self-host an open-source solution.

Enter Umami

I only learnt about Umami yesterday, after searching for an open-source, self-hosted Google Analytics replacement. It topped my list because it is free, only records the data I am interested in, and has a very clean and minimal interface. Importantly, Umami does not collect any personally identifiable information and anonymises all data collected. I have verified this by reviewing both the code and the session data stored in the database — ah, the joy that is open-source software.

In fact, it only collects the bare minimum of what I need: referrals, page views, visit time, country of origin, bounce rates, operating system and browsers, and device types. No names, no IP address, no Advertising IDs — none of that stuff.

The report dashboard is incredibly clean and simple, with everything I need presented on a single page. Here’s a screenshot of the dashboard after running for about 18 hours on my site.

Compared to Google Analytics, Umami is a joy to use, and it’s just as accurate. I left both software running on my site for about 18 hours before switching off GA. Yes, I should probably leave it a week to get a more complete comparison, but in truth I was eager to kick Google to the curb.

Technical details

I don’t feel the need to write a full tutorial on how I installed Umami, as the official guides are good enough. However, here are some considerations if you decide to follow in my footsteps.

Umami is a Node/Javascript app requiring Node12. You can’t just drop into a folder of your typical PHP-powered web host, and it expect it to work. It also requires a database server with MariaDB/MySQL and Postgres supported.

I run Umami on a DigitalOcean droplet, behind Apache2 using ModProxy — the same way I host my website. This works for me, but I like to live dangerously, and I know Apache better than the alternatives. The developer’s guide recommends using Nginx instead of Apache, which you should probably do if you decide to self-host.

There’s an official guide to running Umami on Vercel, but I couldn’t make it work, mostly because I found Vercel to be a bit clunky. You could probably get the UI to run on Netlify easily enough. In either case, Vercel or Netlify, you still need a database server, and at that point you might as well run everything on the same VPS as I’ve done.

One tip though, if your database password contains symbols (and it should), make sure you escape these characters as a URL-safe string, otherwise Umami will report an unhelpful error about an incorrect database port.

Concluding thoughts

I feel like I can finally walk the walk, not simply talk it with some vaguely worded promise to honour my readers’ privacy. I don’t know what the hell Google or other tech giants do with our data, but I sure as hell don’t want my website being part of their global dragnet.