Skip to content

Google Analytics integration

Google Analytics integration involves embedding tracking scripts into a website to collect and analyze user traffic data.^[600-developer-frontend-google-google.md]

Implementation

To enable tracking, a specific Tracking ID (e.g., UA-126790141-1) is generated and configured within the global site tag script.^[600-developer-frontend-google-google.md] This script utilizes the Google tag (gtag.js) framework to send data to the Google Analytics servers^[600-developer-frontend-google-google.md].

File Placement

For websites using theme engines, such as Hexo with the Landscape theme, the tracking script is typically added to the site's footer to ensure it loads with the page content.^[600-developer-frontend-google-google.md] A common location for this integration is within the partial layout files, specifically themes/landscape/layout/_partial/after-footer.ejs^[600-developer-frontend-google-google.md].

  • [[AdSense integration]]
  • [[Frontend development]]
  • [[Data layer]]

Sources

^[600-developer-frontend-google-google.md]