From c9c616059c9f605111ddadebea2bac4c2ec68c4e Mon Sep 17 00:00:00 2001 From: Gayathri625 Date: Mon, 29 Jul 2024 22:19:31 +0530 Subject: [PATCH] Add setup instructions for GA and GTM to README (#1332) * add setup for ga and gtm to readme * instruction to set hugo env to production * update readme --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 42d6d3a..6a87940 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,33 @@ To locally serve the site at [localhost:8888][], run the following command: $ npm run serve ``` +## Setup Google Analytics (GA) and Google Tag Manager (GTM) + +1. **Google Analytics (GA):** + - Follow the [GA setup guide](https://support.google.com/analytics/answer/9304153) to create your account, property, and data stream. + - Update `config.yaml` with your GA Measurement ID: + + ```yaml + params: + googleAnalytics: "G-XXXXXXXXXX" # Replace with your GA Measurement ID + ``` + Verify GA setup using real-time reports to ensure data from your website is being tracked. + +2. **Google Tag Manager (GTM):** + - Follow the [GTM setup guide](https://developers.google.com/tag-platform/tag-manager/web) to create your account and container. + - Update `config.yaml` with your GTM ID: + + ```yaml + params: + gtmID: "GTM-XXXXXXXX" # Replace with your GTM ID + ``` + Check GTM setup using Preview mode and verify that Tag Assistant displays "Connected" for your website URL. + +Build the site by setting Hugo environment to production to make sure GA and GTM work. +```console +$ HUGO_ENV=production npm run serve +``` + ## Site deploys and PR previews If you submit a PR, Netlify will create a [deploy preview][] so that you can