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
Visit
analytics.google.comand sign inClick Admin β Create Property
Enter:
Property name (e.g., DIGIT Portal - Production)
Reporting time zone & Currency
Click Next, specify business info β Create
Step 2: Create a Data Stream
Select Web
Enter Website URL (example:
https://your-domain.gov.in)Set Stream name (example: Main Website)
Keep Enhanced Measurement enabled
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
Visit
tagmanager.google.comβ Create AccountAdd:
Account name = Organization name
Country
Container name = Website URL
Target platform = Web
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
In GTM: Tags β New
Name: GA4 Configuration
Select:
Tag Configuration β Google Analytics: GA4 Configuration
Enter Measurement ID
Trigger β All Pages
Save
Step 3: Publish Container
π GTM β Submit β Version name + Publish
Part 4: Verification & Debugging
π Debug Options
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
Under Select a data source
Choose: β Google Analytics
Select your GA4 property & data stream
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:
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?