Skip to content

How to add Google Analytics? #899

Answered by CaiJimmy
HilkopterBob asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it's bundled in the theme. You need to add the following code to your config file:

https://gohugo.io/templates/internal/#configure-google-analytics

(I assume you are using the latest version of Hugo, which changed the field used to config Google Analytics.)

I see that you are using the starter template. You can past the following code into config/_default/config.toml and it should work:

[services]
  [services.googleAnalytics]
    googleAnalytics = 'G-MEASUREMENT_ID'

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by HilkopterBob
Comment options

You must be logged in to vote
1 reply
@fnsne
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants