GTM Managed, Server Container
(Data Flow version Fully GTM Managed, using GTM Web Container) (Part 2 of 3)
Setting up GTM Server Container¶
In this step you will set up Google Tag Manager to trigger sending data to Google Analytics. The Server Container and the Web Container will have a shared "variable" with which they pass data. This data sharing occurs while respecting the visitors' consent.
For this step we will:
- Configure the GTM Client from the Server Container.
- Add a "variable" for the two containers to share Event Consent data.
- Add a "trigger" that checks if the variable has the 'Google Analytics value' which determines whether a visitor has given consents.
- Add a "tag" for GA4 (Google Analytics) that fires only if the trigger condition is true.
1. Configure the GTM Client from the Server Container.¶
Go to Google Tag Manager.
Ensure Correct GTM View: Server Container
- We want to be on the Server Container
- Make sure you are in the correct Google Tag Manager VIEW for this next step.
- We want to make sure that we are in the "All Accounts" view of Google Tag Manager
- click on the "Tag Manager" icon on the top-left of the screen
- Next to the "Tag Manager" icon, you should see "All Accounts"
(If you see "Web Browser Container" you are in the WRONG view for this next step...)
Click "Clients" in the left sidebar
Click "New"
Click "Choose a client type to begin setup..."
"Choose client type" - Click "Google Tag Manager: Web Container"
"Client Configuration" - click "Add Container ID"
"Allowed Container IDs" - Paste Web Browser Container ID
Locate your Web Browser Container ID
Reminder: to find your Web Browser Container ID, navigate to Web Browser Container ID.
Uncheck Region Specific Settings
Rename "Untitled Client" as "GTM Client"
This needs to be exact. You can copy from here:
GTM Client
Click "Save"
2. Add a "variable" for the two containers to share Event Consent data.¶
Click "Variables" in the left sidebar
Under "User-Defined Variables, "click "New"
Under "Variable Configuration," click "Choose a variable type to begin setup..."
Select "Event Data"
In "Key Path" type in "UcConsentAllowedDps"
This needs to be exact. You can copy from here:
UcConsentAllowedDps
Rename to "Event Data Consent Value"
Event Data Consent Value
Click "Save"
3. Add a "trigger" that checks if the variable has the 'Google Analytics value' which determines whether a visitor has given consents.¶
Click "Triggers" on left sidebar
Under "Triggers" - click "New"
"Trigger Configuration" - "Choose a trigger type to begin setup..."
"Choose trigger type" - click "Custom"
Click "Trigger Configuration"
- Clicking makes it expand with more options...
Click "Some Events"
Click "Event Name" to expand the dropdown and select "Choose Built-In Variable..."
Select "Choose Built-In Variable" - select "Client Name"
Select "equals" from the second input menu
Type in "GA4" into the third input
This needs to be exact. You can copy from here:
GA4
Click on "+" to add another Event row
Select "Choose Built-In Variable"
You can now select "Event Data Consent Value"
Select "contains" from the second input menu
Paste "Google Analytics," (<= INCLUDE the Comma) into the third input
This needs to be exact. You can copy from here:
Google Analytics,
Rename "Untitled Trigger" to "GA4 Trigger" and click "Save"
4. Add a "tag" for GA4 (Google Analytics) that fires only if the trigger condition is true.¶
Click "Tags" on left sidebar
Under "Tags," click "New"
You'll see an "Untitled Tag" page.
Under "Tag Configuration" click "Choose a tag type to begin setup..."
Under "Choose tag type," click "Google Analytics"
Under "Google Analytics," click "Google Analytics: GA4"
Under "Measurement ID," paste Measurement ID info from Analytics
Locate your Measurement ID
Reminder: to find your Measurement ID, go to Web Stream, follow these directions to navigate to Web Stream, and "Web stream details" page.
Under "Untitled Tag"
In "Triggering" section, click "Choose a trigger to make this tag fire"
Select "GA4 Trigger"
Click "Save" and name your tag "Google Analytics GA4"
Google Analytics GA4
Click "Submit"
Under Version Name, enter "Added GA4 Tag and Trigger" or something meaningful to you
Added GA4 Tag and Trigger
Click "Publish"