This Article Will Help You:
- Understand GTM Data Layer
- Add Tracking Codes
- Push Convert Data to GTM Data Layer
- Use GTM Data Layer to send Convert data to GA
- Create the Custom Dimension in GA
- Enable the GA integration
- Create the Experiment ID Data Layer variable in GTM
- Create the Dimension Data Layer variable in GTM
- Create the Variation Name Data Layer variable in GTM
- Create a new GTM Tag
- Create a Custom Report in GA
- View Data in your GA Events report
Understand GTM Data Layer
The Data Layer is one of the key concepts in the world of Google Tag Manager (GTM). It ensures maximum flexibility, portability, and ease of implementation.
A data layer is like a spreadsheet of information you want to capture about the pages and activities that your users are viewing and performing. You collect all of the information in a data layer and send it along to other tools like Google Analytics through Google Tag Manager.
Add Tracking Codes
Make sure both Convert Tracking code and Google Tag Manager code are added on your page.
Push Convert Data to GTM Data Layer
Convert Experiments fired on pages are pushed into the Google Tag Manager default dataLayer object for further processing inside GTM. Below are the 4 keys of the Convert object pushed to GTM dataLayer:
- "event" - has as value "convert-trigger-experiment-{experiment_id}" where experiment_id is the ID of the fired experiment inside Convert Experiences app;
- "experiment_id" - has as value the experiment id of the fired experiment inside Convert Experiences app;
- "variation_name" - has the value variation name of the selected variation, as found inside Convert Experiences app
- "gadimension" - if the Google Analytics integration has been enabled and a dimension chosen then it has the value for the dimension set in the google analytics integration.
Example:
dataLayer.push({ "event":"convert-trigger-experiment-1234", "experiment_id":"1234", "variation_name":"test variation", "gadimension":"1" });
If you use Google Chrome console and you have activated the Convert Debugger extension, this is how it looks like when Convert pushes data to GTM data layer:
Inside Google Tag Manager, this data can be used and sent forward to other services that are supported.
Use GTM Data Layer to send Convert data to GA
Let's analyze how we would send the variation triggered to Google Analytics (Universal Analytics analytics.js or Global Site Tag gtag.js) through a Custom Dimension. To send data over to Google Analytics we will use a Custom Event.
Each time that you create an experiment you will have to assign it a Custom Dimension in GA. If you have not created it, you will need to do before launching the experiment.
Create the Custom Dimension in GA
Go to Admin section and under property you will find Custom Dimensions:
Create a new Custom Dimension of User scope and remember the index value:
Enable the GA integration
Go to your specific experience summary page and from the Add/Edit integrations enable the GA integration:
Create the Experiment ID Data Layer variable in GTM
The Experiment ID Data layer Variable will store the Convert experiment_id values and we will use it every time we need to call this value.
Open Google Tag Manager and go to variables:
Create a new User Defined variable:
Give it a descriptive name, assign the type Data Layer Variable and fill in experiment_id in the Data Layer Variable name:
Create the Dimension Data Layer variable in GTM
The Dimension Data layer Variable will store the Convert gadimension values and we will use it every time we need to call this value.
Go to variables and create a new User Defined variable:
Give it a descriptive name and assign as type the Data Layer Variable. Specify its Data Layer Variable name and hit Save:
Create the Variation Name Data Layer variable in GTM
The Variation Name Data layer Variable will store the Convert variation_name values and we will use it every time we need to call this value.
Go to variables and create a new User Defined variable:
Give it a descriptive name and assign as type the Data Layer Variable. Specify its Data Layer Variable name and hit Save:
Create a new GTM Tag
Go to tags and create a new tag:
Give it a descriptive name and select as Tag Type Universal Analytics and as Track Type Event. Fill in all relevant fields as presented below:
Select your GA account and add the Custom Dimension as it is shown below, then just use the GA Dimension GTM Variable we created earlier:
Select the triggering rule to fire the tag. Create a new trigger, give it a descriptive name, select Custom Event and fill in relevant fields as it is shown below:
Please note that this rule will fire the tag every time an experiment will be fired.
Create a Custom Report in GA
- Go back to Google Analytics
- Go to "Customisation"
- Create a new "Custom Report"
- Select the relevant Custom Dimension as the drill down dimension
- Configure any filters
- Save
View Data in your GA Events report
You can also see the Convert data we sent as an event through Behaviour-Events: