yet another programmer’s blog

18 Jan 2020

Adding Web Analytics

With my blog now up and running, I started to look at adding some analytics to the site. So, I know a bit more about my readers.

The web analytics I chose was GoatCounter. It was on HackerNews about a few days ago, and it sounded interesting. It describes itself as a privacy-aware and lightweight web analytics. Also, it’s open-source and free to use for non-commercial use.

Initially, I decided to add it into the Hugo theme I am using, and started to learn Hugo more in-depth. However, as I was doing research and also making tiny adjustments to my blog, I discover a little gem in Netlify. Netlify has a post-processing feature that inserts snippets of HTML before the closing tag. It’s perfect for adding web analytics. You can read all about this in the Netlify documentation: Snippet Injection.

Turning it on is simple. Under the site settings, open the “Build & deploy”, and you see the “Post-processing” sub-menu. When you click on it, it will scroll the page to post-processing section, and the first option is adding snippets. You can add the snippets before the closing or tag.

Adding Snippets in Netlify

After adding the HTML snippets, you will need to trigger another build and deploy from Netlify.

Deploying in Netlify

After a minute or less, you will have web analytics deployed to your site. If you are curious about this blog’s visitors, then have a look at the statistics here at

Thank you for reading.