As an alternative to Google Analytics, you can use the open source GoatCounter hosted analytics solution. Setting it up is fast and easy. You can find instructions on their website, but here are some tips specific to Hugo.
Create an account on GoatCounter
Create an account on the sign-up page. It’s free for non-commercial use.
If you set the
googleAnalyticsparameter in your
config.tomlfile, comment it out or remove it.
Override your theme’s analytics partial by creating a
<script data-goatcounter="https://YOURSITENAME.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
Rebuild and republish your site. This step requires no mental energy if you deploy on Netlify.
Analytics collection begins immediately.