Setting up GTM to send data to Google Analytics

If you have implemented the GA tag on your site via Google Tag Manager, you need to set up the trigger, variables, and GA tag so that the GTM event can be correctly routed to Google Analytics.

INFO: When a visitor is served an experience, Qubit will send a single custom event to GA and, for tags implemented via Google Tag Manager, a single GTM event. These events are only sent once per session when the visitor is served the experience.

WARNING: These events are only sent for published experiences.

Setting up the trigger

To get started, log in to your Google Tag Manager account.

Creating the trigger

We'll start by creating a trigger to detect when the GTM event is sent by Qubit.

Step 1

Select Triggers from the side menu

Step 2

Select New and enter a name for the trigger

Configuring the trigger

Once you have created the trigger, you need to configure it by defining the event that will cause it to fire.

Step 1

Select anywhere in the Trigger Configuration panel and scroll down and select Custom Event

Step 2

Enter qubit.experience in Event name and select Some Custom Events from This triggers fires on

Step 3

Define the following trigger conditions: Event > equals > qubit.experience and select Save to finish

Setting up variables

In this step, we will set up the variables that will be passed to the GA tag. You will need to create and configure a variable to pass the experience Id and a second variable to pass the experience variation Id.

Setting up the Experience Id variable

Step 1

Select Variables from the side menu

Step 2

Select New to create a user-defined variable and enter Qubit Experiment Id as the variable name

Step 3

Select anywhere in the Variable Configuration panel, select Data Layer Variable as the variable type and enter qubitExperimentId in Data Layer Variable Name

Step 4

Select Version 2 from Data Layer Version combo box and select Save

Setting up the Variation Id variable

Create and configure a second variable, repeating the steps above, and enter Qubit Variation Master Id as the variable name and qubitVariationMasterId as the Data Layer Variable Name

Setting up the GA tag

In this final step, we need to create and configure the GA tag that will fire when the trigger is activated.

Step 1

Select Tags from the side menu

Step 2

Select New and enter a name for the tag

Step 3

Select anywhere in the Tag Configuration panel and select UA tag from the slideout menu

Step 4

Select Event from Track Type and enter Qubit Experience in Category. In Action, select add action and then Qubit Experiment Id from the slideout

Step 5

In Label, select add action and then Qubit Variation Master Id from the slideout

Step 6

In Value, select add action and then Qubit Variation Master Id from the slideout

Step 7

Select True from Non-interaction Hit and select the variable that you use to store your tracking Id from Google Analytics Settings

TIP: If you don't know your tracking Id, see Find your tracking ID and tracking code snippet.


If you haven't already created a variable to store your tracking Id, you will need to do this. Select New Variable from Google Analytics Settings. Enter a name for your variable and enter your tracking Id in the field provided. You can leave the other fields in their default state.


Step 8

Scroll down and select anywhere in the Triggering panel. Select the trigger you created earlier and select Save

Last updated: January 2023
Did you find this article useful?