https://gohugo.io/templates/internal/#google-analytics
site configuration
[services]
[services.googleAnalytics]
ID = 'G-MEASUREMENT_ID'
To create your own template, access the configured ID with
{{ site.Config.Services.GoogleAnalytics.ID }}
.