Google Tag Manager
The same Google Tag Manager container receives all events from all environments and web apps.
We use the same Google Tag Manager (GTM) container ID across all environments.
GTM will observe at what's happening in the website (user clicks, page views, etc).
Then GTM will check what to do whenever an event happens
- We tell GTM what to do in tagmanager.google.com dashboard
In our case, we will send events FROM GTM to:
- Google Analytics and
- Google Ads
This means we don't need to add Google Analytics and Google Ads separate scripts in our frontend.
We just load the GTM script.
Mental Model
Imagine jodapp.com as a physical office building.
Google Tag Manager (GTM): The Receptionist.
-
She sits at the front desk. She doesn't "store" files or "run" ad campaigns.
-
Her only job is to watch who comes in and tell the other departments what is happening.
-
Example: A customer walks in. The Receptionist picks up the phone and says: "Hey Analytics department, write this down!" and "Hey Advertising department, this guy looks interested!"
Google Analytics 4 (GA4): The Filing Cabinet / Reports Department.
-
They sit in the back room. They don't see the customers directly; they only write down what the Receptionist (GTM) tells them.
-
They produce charts and graphs: "We had 500 visitors today, and 20 applied for jobs."
Google Ads: The Billboard Guy outside.
-
He spends your money to bring people to the office.
-
He needs to know if his billboards are working.
-
He waits for the Receptionist (GTM) to tell him: "Hey! That guy you sent in just bought something!" (This is a "Conversion").
Variables
RegEx Table as a "router" for events
We use a RegEx table to route events based on {{Page Hostname}} that is automatically sent with every event.
| Pattern | Output | Remarks |
|---|---|---|
| localhost | G-LOCAL-123 | single data stream |
| ^.+.jod.com.sg$ | G-QA-456 | current QA host name |
| ^(.*.)?jodapp.dev$ | G-QA-456 | future QA hor name, pointing to current GA4 QA data stream |
| ^(.*.)?jodapp.com$ | G-PROD-789 | production pointing to a single data stream |
Google Ads is not added in yet.
Default Value: G-QA-456
- if no domains match, we send it to QA to ensure we do not pollute Production data.
Tags
Google Tag - GA4
This is a "Tag" defined in Google Tag Manager Dashboard.
You can consider it the "Base Tag" that loads all the Google Analytics tags.

Notice that under "Triggering", the tag will be triggered whenever:
- History Changes (client side navigation)
- Initialization - All Pages (first page load, hard refresh)
Terminology
GTM = Google Tag Manager GA4 = Google Analytics 4 Measurement ID = Data Stream inside Google Analytics Property G-XXXXX GTM ID = Google Tag Manager ID which starts with GTM-XXXXX