SEO | Add Google Analytics To Your Hugo Blog
Google Analytics can help understand your audience and improve your content. Here’s a simple guide to help you get started with effective analytics.
1. Create Google Analytics Account
Fisrt you have to go to Google Analytics and sign up for an account.
Create a new property for your blog and link to your url.
Once done, you’ll get a measurement id which you have to add to your hugo configuration.
2. Configure Your Hugo Blog
Add your measurement id to your hugo configuration. If you’re using toml, just add as following.
1[services]
2 [services.googleAnalytics]
3 ID = 'G-MEASUREMENT_ID'
Insert following code to your header file as hugo has aldready included an embedded template supporting Google Analytics.
1{{ template "_internal/google_analytics.html" . }}
You can access the configured ID with this value:{{ Site.Config.Services.GoogleAnalytics.ID }}
.
3. Deploy and Monitor
Deploy your site to apply the tracking code. Then you can monitor your data in Google Analytics Dashboard.
More About SEO
How To Set Up Google Search Console