Google Analytics 4 & Google Tag Manager Installation Guide

Prerequisites

Before starting, ensure:

  • βœ” You have a Google account with access to Google Analytics and Google Tag Manager

  • βœ” You have admin access to your web application’s codebase

  • βœ” (Optional, for dashboards) Access to Looker Studio


Part 1: Google Analytics 4 (GA4) Setup

Step 1: Create a GA4 Property

  1. Visit analytics.google.com and sign in

  2. Click Admin β†’ Create Property

  3. Enter:

    • Property name (e.g., DIGIT Portal - Production)

    • Reporting time zone & Currency

  4. Click Next, specify business info β†’ Create

Step 2: Create a Data Stream

  1. Select Web

  2. Enter Website URL (example: https://your-domain.gov.in)

  3. Set Stream name (example: Main Website)

  4. Keep Enhanced Measurement enabled

  5. Click Create Stream

Step 3: Note Your Measurement ID

Format: G-XXXXXXXXXX β†’ You'll need this for integration


Part 2: Google Tag Manager (GTM) Setup

Step 1: Create GTM Account + Container

  1. Visit tagmanager.google.com β†’ Create Account

  2. Add:

    • Account name = Organization name

    • Country

  3. Container name = Website URL

  4. Target platform = Web

  5. Accept Terms of Service

Step 2: Embed GTM Snippets

Insert into your web app:

Inside <head>

Right after <body> open

Container ID format: GTM-XXXXXXX


Part 3: Web Application Integration (Workbench UI)

We are enabling analytics for workbench-ui using Nginx-based custom JavaScript injection as part of the Helm configuration. In the hcm-demo-latest environment, the following configuration injects external analytics scripts into the application at runtime:

The injected file analytics.js (hosted at https://hcm-demo-assets.s3.ap-south-1.amazonaws.com/analytics/analytics.js) contains everything required for analytics, including loading Google Tag Manager and custom Google Analytics scripts.

Example expected content of analytics.js:

Reference

Devops changes

Analytics Script


Step 2: Configure GA4 Tag in GTM

  1. In GTM: Tags β†’ New

  2. Name: GA4 Configuration

  3. Select:

    • Tag Configuration β†’ Google Analytics: GA4 Configuration

  4. Enter Measurement ID

  5. Trigger β†’ All Pages

  6. Save

Step 3: Publish Container

πŸ“Œ GTM β†’ Submit β†’ Version name + Publish


Part 4: Verification & Debugging

πŸ” Debug Options

Tool
Usage

GA4 DebugView

Shows events in real-time

GTM Preview Mode

Validates tag triggers on live site

GA4 Realtime Report

Live users + active pages

Enable Debug Mode Manually

Data Retention

GA4 β†’ Admin β†’ Data Settings β†’ Data Retention Set according to compliance needs


Part 5: Looker Studio (Dashboarding & Reporting)

🎯 Purpose: Create custom analytics dashboards using GA4 data

Step 1: Open Looker Studio

Go to: https://lookerstudio.google.com/

Click Create β†’ Report

Step 2: Connect GA4 Data Source

  1. Under Select a data source

  2. Choose: β†’ Google Analytics

  3. Select your GA4 property & data stream

  4. Click Add β†’ Add to Report

Step 3: Build Dashboards

You can now: βœ” Add charts (Time series, tables, geo maps, funnels) βœ” Customize filters (e.g., Application Module, Page Type) βœ” Create KPIs like:

Step 4: Apply Filters for Govt Use-Cases

Example recommended filters:

Filter
Purpose

Tenant ID

City/ULB performance

Service Module

eGov product usage

Page Name

Screen-level visibility

Device Category

Web/Mobile split

Step 5: Sharing & Publishing

You can:

  • Share internally with view/edit permissions

  • Embed dashboard inside DIGIT admin panels (iframe)

  • Schedule PDF email reports to stakeholders

Last updated

Was this helpful?