HUGO

Is Base Template the correct place to add a non-Google Analytics script for analytics?

I am trying to use a analytics service that is not Google and found SimpleAnalytics(https://simpleanalytics.com) which looks like it’s a good option. But I need to add their script to my pages, before the closing tag (https://docs.simpleanalytics.com/script).

Looking through the documentation, it looks like Base Template is where I would add this. Is that correct? If so, do I just add the script as-is in a block or do I need to do anything different?

Yes, this will work if all your layout templates use the baseof template (i.e. they all start with {{ define "main" }}).

For some sites, you may want to have certain pages which don’t use the Base template, in which case you’d need to include the code somewhere else.