Set up Google Tag Manager to send data to Google Universal Analytics
Set up Google Tag Manager to send data to Google Universal Analytics
This is for:
Developer
Google Universal Analytics is subject to deprecation in 2023. |
If you have implemented the Google Universal Analytics (Google UA) tag on your site via Google Tag Manager, you need to set up the trigger, variables, and a Google UA tag so that the Coveo Experimentation Hub can send the GTM event to Google UA.
The Coveo Experimentation Hub doesn’t send events to Google Universal Analytics (Google UA) and Google Analytics 4 (GA4) if any or both of the following are true:
|
Note
When a visitor is served an experience, the Experimentation Hub sends a single custom event to Google UA and a single GTM event (for tags implemented via GTM). The Experimentation Hub send these only once per session, when the visitor is served the experience. |
These events are only sent for published experiences. |
Set up the trigger
You need to create a trigger to detect when the Experimentation Hub sends the GTM event.
-
Log in to your GTM account.
-
From the left menu, select Triggers.
-
Click the New button.
The trigger card appears.
-
At the top of the card, enter a trigger name.
-
In the Trigger Configuration panel, click anywhere to open the Choose trigger type pane.
-
Select Custom Event.
The Trigger Configuration panel now shows trigger fields and settings.
-
Specify the following:
-
In the Event name field, enter
qubit.experience
. -
Select the Some Custom Events option.
-
Define the following trigger conditions: Event > equals > qubit.experience.
-
-
Click the Save button.
Set up variables
Next, you need to create and set up variables for the experience ID and variation ID. GTM will send these variables to your Google UA tag.
-
From the left menu, select Variables.
-
In the User-Defined Variables section, click the New button.
The variable card appears.
-
Enter
CEH experience ID
as the variable name. -
In the Variable Configuration panel, click anywhere to open the Choose variable type pane.
-
Select Data Layer Variable.
The Variable Configuration panel now shows variable fields and settings.
-
Specify the following:
-
In the Data Layer Variable Name, enter
cehExperienceId
. -
In the Data Layer Version menu, select Version 2.
-
-
Click the Save button.
You created a CEH Experience ID
to store the experience ID.
Repeat these steps to create a variable for the variation ID, but use the following values for a new variable:
-
CEH variation main ID
as the variable name. -
cehVariationMainId
as the Data Layer Variable Name.
Set up the Google UA tag
Now you need to create and configure the Google UA tag that will send the GTM event to Google UA when the trigger is activated.
-
From the left menu, select Tags.
-
Click the New button.
The tag card appears.
-
At the top of the card, enter a trigger name.
-
In the Tag Configuration panel, click anywhere to open the Choose tag type pane.
-
Select Google Analytics: Universal Analytics.
The Tag Configuration panel now shows tag fields and settings.
-
Specify the following:
-
In the Track type menu, select Event.
-
In the Category field, enter
CEH Experience
. -
In the Action field, click the button to the right and select the CEH experience ID variable.
-
In the Label field, click the button to the right and select the CEH variation main ID variable.
-
In the Value field, click the button to the right and select the CEH variation main ID variable.
-
In the Non-Interaction Hit menu, select true.
-
In the Google Analytics Settings menu, select the variable that you use to store your tracking ID from
Google Analytics Settings
.If you haven’t already created a variable to store your tracking ID, you need to do it now.
-
In the Google Analytics Settings menu, select New Variable to open the variable card.
-
At the top of the card, enter a variable name.
-
In the Tracking ID field, paste your tracking ID. If you don’t know your tracking ID, see Find your tracking ID and tracking code snippet.
You can leave the other fields in their default state.
-
-
-
In the Triggering panel, click anywhere to open the Choose a trigger pane.
-
Select the trigger you created earlier.
-
Click the Save button.