GoatCounter, a simple Google Analytics alternative
When I finished Reel Time, I stumbled upon a problem I had already had a while ago, when I finished small web experiments such as Philippe Marmotte or Lorraine Ipsum back in 2019. I wanted to know if my friends were actually checking them out when I sent them the link. That’s pretty much it.
I didn’t need conversion funnels, audience segmentation, complex reports or 25 different charts about user acquisition. I just wanted to know: did anyone visit this thing I spent way too much time making?
Of course, I was barely out of school at the time, and we had had Google Analytics classes, so I naturally installed this enormously complicated solution on websites weighing less than 100 KB.
It worked. But it was a bit like building an airport control tower to count how many goats entered your garden shed. I am confused.
Looking for something smaller
It’s not 2019 anymore, so this time I went on a relatively deep dive into alternative analytics solutions, preferably open source and free.
There are actually quite a few of them. Plausible looks great. Umami does too. Both are open source and can be free if you self-host them. Which I don’t want to do. At least not yet.
My projects are deliberately very simple. Reel Time, for example, is basically HTML, CSS, JavaScript and a bunch of video files. There is no server-side application, no database and no infrastructure I particularly want to maintain. Adding a server just to know that twelve people visited my weird movie clock would somehow defeat the point, if there were any.
That’s when I found GoatCounter.
What is GoatCounter?
GoatCounter is an open-source web analytics tool created by a gentleman named Martin Tournoij, aka arp242.
There is also something I really like about the philosophy behind GoatCounter. It’s mostly the work of one developer, arp242, building and maintaining a useful tool without turning it into another startup trying to track everything, raise millions and conquer the world.
I have a soft spot for projects like this: someone building something in their corner of the internet, making it genuinely useful, keeping it open and trying to make a living from it without compromising too much on their values.
Maybe because, somewhere in the back of my mind, that’s a bit of an unacknowledged dream of mine too. Build small things. Make them useful. Make enough to keep building them.
Anyway. Back to counting goats.
It positions itself as a simpler, privacy-friendly alternative to tools such as Google Analytics and Matomo.
And “simple” here actually means simple. You get page views, referring websites, browsers, operating systems, screen sizes, locations and a few other useful pieces of information.
That’s exactly what I wanted.
It doesn’t try to reconstruct the entire life of the person who opened your website. GoatCounter doesn’t use cookies or persistent unique identifiers to track people, and is designed to collect useful statistics without storing personal data persistently.
The entire project is open source, and the source code is available on GitHub. It’s also accessible.
You can self-host it if you want complete control over it, but, and this is the part that got my attention, you don’t have to.
It’s web hosted and free
GoatCounter provides a hosted version on goatcounter.com which is currently free for reasonable public usage. “Reasonable” is important here. This isn’t a magical free analytics infrastructure intended for websites receiving millions of page views every day. The project explicitly says that personal websites and small-to-medium businesses are fine, while very high-traffic usage should probably be self-hosted.
The hosted service is supported by donations.
For the kind of websites I’m talking about here (portfolios, side projects, experiments and small websites) that’s pretty much perfect.
There is no trial period where your dashboard suddenly gets locked after 14 days, and I don’t need to maintain a server just for analytics. If I ever reach the point where Reel Time generates millions of page views per day, analytics infrastructure will probably be a very nice problem to have.
Installing GoatCounter
This might be my favourite part. After creating an account on GoatCounter, you choose a site code. Your analytics dashboard then lives at something like: https://YOURCODE.goatcounter.com
To start tracking your website, you add this:
<script
data-goatcounter="https://YOURCODE.goatcounter.com/count"
async
src="//gc.zgo.at/count.js">
</script>
That’s it!
No npm package.
No tag manager.
No ten-step configuration screen.
Put the script on your pages and GoatCounter starts receiving page views. The default count.js script is only around 3.5 KB, which feels much more appropriate on a tiny static website. And if loading a third-party JavaScript file bothers you, you can host count.js yourself.
You don’t even need JavaScript
Another detail I really like is that the JavaScript integration isn’t mandatory. GoatCounter can also receive analytics through an image-based tracking pixel. You can integrate it from your application’s backend or even import data from server log files.
For my projects, the JavaScript version is obviously the easiest solution, but I appreciate that the tool doesn’t assume every website needs to run an analytics SDK1.
It feels very much like a tool made by someone who actually likes the web.
What does it actually collect?
Despite being minimal, GoatCounter gives me most of the information I’m interested in:
- page views and paths;
- unique visits;
- referrers;
- browsers;
- operating systems;
- screen sizes;
- approximate locations;
- languages (optional);
- campaigns.
It can also track custom events, so you’re not limited to page views.
For example, if I want to know how many people click a specific button on one of my projects, GoatCounter supports click events directly through HTML attributes. That means there is still room to go further without immediately entering Google Analytics territory.
One small feature I particularly like is that you can also make your analytics dashboard public. So, instead of showing you screenshots, you can have a look at Reel Time’s actual GoatCounter dashboard and see what all of this looks like with real data. The numbers might be absolutely miserable.
A small technical detour
If you’re curious about what is running behind all of this, GoatCounter itself is written primarily in Go. When self-hosting it, it can use SQLite or PostgreSQL as its database. SQLite is the default and is suitable for smaller installations, while PostgreSQL is available when better performance is needed. Don’t quote me on that, I am not an expert.
The main GoatCounter code is distributed under a modified version of the European Union Public Licence (EUPL) 1.2, while count.js, the tiny script you put on your website, uses the more permissive ISC licence.
I don’t personally need any of this for my setup, I’m happily using the hosted version, but I like knowing that if GoatCounter disappears tomorrow, the software isn’t locked somewhere inside a company. I can take it and run it myself.
And what about privacy?
This was another reason I didn’t particularly want to put Google Analytics on these projects again.
GoatCounter is specifically designed to avoid tracking people across the web. It doesn’t use cookies or persistent identifiers to build user profiles.
According to GoatCounter’s documentation, its default setup doesn’t require a GDPR consent notice because it doesn’t track personal data.
Of course, privacy and GDPR compliance always depend on what you’re doing with a website and what else you’re running on it, so I wouldn’t treat “I use GoatCounter” as a magical legal checkbox.
But for a simple personal website, I much prefer starting from an analytics tool whose entire philosophy is collect as little as possible rather than trying to disable half the features of a much larger tracking platform.
It’s not Google Analytics (thank god)
Obviously, GoatCounter isn’t a replacement for Google Analytics in every situation.
If you’re running a large e-commerce website and need detailed conversion funnels, attribution models, audiences, advertising integrations and complex behavioural analysis, GoatCounter probably isn’t what you’re looking for.
But that’s precisely the mistake I made in 2019. I wasn’t running an e-commerce platform. I had made a Lorem Ipsum generator using names of towns in Lorraine. I didn’t need enterprise analytics.
For small websites, portfolios, side projects and weird experiments nobody asked for, I think GoatCounter sits in a very nice place between having absolutely no idea whether anyone visits your website and installing an analytics platform that requires its own course to understand.
Now when I send Reel Time to my friends, I can finally know whether they actually opened it.
- SDK (Software Development Kit): a set of tools and libraries that helps developers integrate a service or build applications for a platform.
Example: a payment SDK lets you accept payments without accidentally becoming a bank. ↩︎