In the process of getting this blog up and running, I stumbled on the need of have it integrated with Matomo to have statistics and visitor count from the site. Now, Hugo does have integration with a bunch of analytics sites, including Google Analytics, but I’m more fond of running my own thing and try to not give Google that many information. The thing is, Hugo lacks Matomo support builtin, so, I started googling and found this theme component by Florian Grässle: https://github.com/holehan/hugo-component-matomo

Now, the thing did work, but the last commit was somewhere around 2 years ago and Matomo kept going adding new features and stuff, some of them I’d really like to use to protect my users privacy. So I decided to write my own component (even not being a Web developer), instead of just patching using the one that already existed and then having to overload everything.

This was how my version of a theme component for Hugo that integrates with Matomo was born. The README file there tries to explain how to install it and use it on any Hugo website. On the feature side, I try to use all that the Matomo’s JavaScript API has to offer:

  • Matomo’s builtin Opt-out iframe;
  • Not using cookies to track;
  • I built a very basic Cookie Popup for when you’re actually using cookies so that the user knows what you’re doing;
  • It also includes a privacy (used on this very site) partial that displays the current status of the user’s tracking and gives him the ability to untrack himself.

All-in-all, I think it came out pretty well for a non-webdeveloper and I’ll all ears for any changes/suggestions needed.