thegeeklab/hugo-geekblog

Google Analytics

Virtualizestuff opened this issue · 3 comments

Is it possible to add google analytics?

xoxys commented

I don't like trackers and I don't want to integrate it in the theme, sorry. But you should be able to simply add it on your own. You just need to overwrite a partial from the head section and add the Hugo internal analytics template. You could use the file https://github.com/xoxys/hugo-geekblog/blob/master/layouts/partials/head/microformats.html copy this file to your page layout folder. The file should look like this:

{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/google_analytics.html" . }}

For more details see https://gohugo.io/templates/partials/#partial-template-lookup-order and https://www.soberkoder.com/google-analytics-hugo/. Just make sure to overwrite the file in your page root layout folder. Don't manipulate files in the theme folder directly, this prevents future updates.

Awesome thank you for the quick response!

xoxys commented

Cool. Feel free to open another issue if you can't get it to work.