GoatCounter is a great choice for simple, privacy respecting analytics. I had GC on my site for quite some time, but I removed it for two reasons, namely:
- Their domains were on all of the major adblock lists and therefore origin views didn’t match traffic that was hitting the edge
- There was a 6-month time limit for keeping pageviews, which was understandable due to running a service with a high number of users on the Free tier
Recently though, GoatCounter changed their pricing plans and solved the second problem — the Free plan now offers a maximum of 2.4M pageviews and doesn’t restrict the historical viewing of the data. For a personal site, this really adds value to the trends and spikes regardless of the retention period. The service even allows for deleting historical pageviews, effectively pruning the logs to make room for newer entries.
Regarding the first problem, I discovered that they allow me to self-host the analytics script myself, while still being able to register views to my account’s endpoint. The self-hosted markup simply replaces gc.zgo.at
with my own origin:
Alternatively, the entire contents of count.js
can be included in the <script>
tags as long as the API endpoint is specified:
And of course the old-school tracking pixel for users with JavaScript disabled should be included. It’s fine if the goatcounter.com
origin is blocked since contextual views are out the window at this point:
The one caveat of self-hosting GoatCounter’s JS is that I won’t automatically get new feature updates since the script is being served from my domain.
However, their v1
API endpoint will remain active regardless of future updates; and therefore I can’t envision a scenario where I would be missing out on features that I already have. More importantly, this issue can easily be mitigated by including an NPM script that downloads GoatCounter’s count.js
file from their server (at build-time) and overwrites the version stored in my site’s repository.