Table of Contents
I just posted about how I migrated from WordPress to Hugo here:
and there I noted about wanting to remove Google Analytics in favor of something less …evil.
After seeing how simple it was to accomplish, I went ahead and did it. Here’s how:
Adding GoatCounter to Hugo #
Sign Up For GoatCounter or Selfhost #
I have signed up at the time of writing, but if I like it enough I will move this to a self-hosted solution. This will allow me to get around adblockers that are already blocking
gc.zgo.at which is used by the GoatCounter hosted service.
If I should be getting around people blocking my analytics is another topic, but this one is pretty reasonable in my opinion.
Add GoatCounter #
<script data-goatcounter="https://<YOUR-CODE-HERE>.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
Place this in
layouts/partials/analytics.html. You can overwrite your old one or
.old it as I did.
googleAnalytics = in
Commit & Build #
Save all changes, commit your site, and let it rebuild, and you should now have data in GoatCounter, assuming you’re not adblocking it.
So far this seems like exactly what I wanted. Views on my pages, basic stats and referrer. Cool.