What is Google Analytics?

Google Analytics is a web analytics service that provides statistics and basic analytical tools for search engine optimization (SEO) and marketing purposes. The service is part of the Google Marketing Platform and is available for free to anyone with a Google account.

How to add google analytics to Hugo site?

Step 1: Create a google account

Step 2: Go to google analytics site

Step 3: Set up your site details in google analytics

Step 4: Get your site google analytics ID

Step 5: Set up your Hugo config.yml

Add googleAnalytics: G-MEASUREMENT_ID in your config.yml file.

Step 6: Add google analytics template in your Hugo theme

Add {{ template "_internal/google_analytics.html" . }} in your theme’s head.html file <head> section

References

DEFINITION Google Analytics

Google Analytics

Internal Templates | Hugo