KKIMS on-site docs
Google services

Google Tag Manager (optional)

If KIMS uses Google Tag Manager (and GA4 through it), create or find the container and put its ID in the site build settings, then check the built site loads it.

Note

Optional. With no container ID the website carries no Tag Manager code at all: no snippet, no dataLayer. Ask KIMS whether they want analytics before spending time here.

#How the code uses it

#One setting on the site build

Fact Value
Setting GTM_ID, a line in the environment's kims-site-env Jenkins secret file. Not a Helm value: the CMS pods never read it
Read by The site build, which passes it to the website build as NEXT_PUBLIC_GTM_ID
Format GTM- followed by 4 to 10 capital letters or digits, for example GTM-AB12CD3
A wrong value Is treated as "no container": the pages carry no tag, and the build does not fail. Check the output (Check the built site)
What is added Google's standard head snippet, loading https://www.googletagmanager.com/gtm.js?id=<GTM_ID>, with dataLayer set up first
What is not added Google's <noscript> iframe, deliberately: it would load Tag Manager for visitors without JavaScript with no consent check
When it changes Only at the next site build. Changing GTM_ID needs a rebuild of the live version

GA4 is not configured in the code. If KIMS wants GA4, they add a Google tag (GA4 configuration) inside their Tag Manager container. Consent, tags and triggers are managed in Tag Manager by KIMS's marketing team, not in KIMS v2.

#Get a container ID

#KIMS already has one

Ask KIMS's marketing or web team for the Web container ID used by the old site. It is shown at the top of the container's workspace in Tag Manager, next to the container name, as GTM-XXXXXXX. Use one container for production. For UAT, use either no container (recommended, so test visits do not pollute their analytics) or a separate test container.

#Create a new container

Done by a KIMS person who will own it:

  1. Open https://tagmanager.google.com/ and sign in with a KIMS Google account.
  2. Click Create Account.
  3. Account Name: KIMS Hospitals. Country: India.
  4. Container name: the website host, for example www.kimshospitals.com. Target platform: Web.
  5. Click Create, read and accept the Google Tag Manager Terms of Service (the KIMS owner does this, not the engineer).
  6. A dialog shows the install snippet. Close it: KIMS v2 adds the snippet itself.
  7. Copy the container ID shown at the top of the workspace, GTM-XXXXXXX.
  8. In Admin > User Management, add a second KIMS administrator so the container is not owned by one person.

Tags inside the container (GA4 and so on) are added in Tag Manager and only take effect after KIMS clicks Submit > Publish there. No KIMS v2 build is needed for that.

#Put the ID in the site build settings

#Edit kims-site-env

The site build reads its settings from the Jenkins secret file credential kims-site-env in the environment's folder (jenkins/credentials). It is a list of NAME=value lines; the example files carry the line commented out:

text
# Google Tag Manager container, if any:
# GTM_ID=GTM-XXXXXXX
  1. Open your filled-in copy of site-env-production.example (outside Git).
  2. Replace the commented line with GTM_ID=GTM-AB12CD3 (the real ID, no spaces, no quotes).
  3. In Jenkins, open the folder (kims-production), Credentials, the kims-site-env credential, Update, and upload the edited file. Save.
  4. Run kims-production/kims-site-build with Build with Parameters: PUBLISH_VERSION the live version (the CMS Builds screen shows it), CAUSE rebuild.

For UAT, do the same in the kims-uat folder only if KIMS wants UAT tracked.

#Check the built site

#Look for the snippet in the home page

bash
curl -s https://<SITE_HOST>/ | grep -o "googletagmanager.com/gtm.js?id=[^'\"&]*\|GTM-[A-Z0-9]*" | sort -u
bash
curl -s https://<SITE_HOST>/ | grep -o "googletagmanager.com/gtm.js?id=[^'\"&]*\|GTM-[A-Z0-9]*" | sort -u
powershell
(Invoke-WebRequest -UseBasicParsing https://<SITE_HOST>/).Content | Select-String -Pattern "GTM-[A-Z0-9]+" -AllMatches | ForEach-Object { $_.Matches.Value } | Sort-Object -Unique

Expected with a container: the container ID, for example GTM-AB12CD3 (on Linux and macOS also the googletagmanager.com/gtm.js?id= text). Expected without one: nothing at all.

#Check in the browser

  1. Open the website in Chrome, with developer tools (F12) on the Network tab.
  2. Reload. Filter by gtm.js.

You should see one request to www.googletagmanager.com/gtm.js?id=GTM-... with status 200. In Tag Manager, Preview mode (Tag Assistant) can then connect to the site.

#If it does not appear

What you see Cause Fix
No GTM- in the page GTM_ID missing, commented out, or not matching GTM- plus 4 to 10 capitals and digits (lower case, spaces or a pasted URL count as "no container") Fix the line in kims-site-env, rebuild
The ID is in the page but gtm.js is blocked in the browser console A Content Security Policy on the distribution (a CloudFront response headers policy) does not allow Google's hosts KIMS adds https://www.googletagmanager.com to script-src and connect-src, plus the hosts their tags use (for GA4: https://*.google-analytics.com, https://*.analytics.google.com)
Still the old page The build did not run, or CloudFront served a cached page Check the build on the CMS Builds screen; the build invalidates CloudFront

#UAT and production

UAT Production
GTM_ID Usually none, or a test container KIMS's live container
Where kims-uat folder, kims-site-env kims-production folder, kims-site-env

#Sources

Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.