Skip to content
  • There are no suggestions because the search field is empty.

Use GTM Data Layer to integrate Convert with GA

Send Convert Experiment & Variation Data to Google Analytics via GTM Data Layer

THIS ARTICLE WILL HELP YOU:

 

Looking to use GTM dataLayer events to fire Convert goals instead?

This article covers pushing Convert experiment data into Google Analytics. If you want to trigger a Convert goal from an existing GTM dataLayer event, see Creating a Convert Goal from a GTM Data Layer Event instead.

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

⚠️ Important:

Convert experiments are automatically pushed into the GTM dataLayer whenever a visitor is bucketed into an experiment. This does not require the Google Analytics integration to be enabled.

The only field that depends on the Google Analytics integration is "gadimension", which is populated only when the integration is enabled and a dimension is selected.

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 GA4

Let's analyze how we would send the variation triggered to Google Analytics 4 (GA4) through a custom event and event parameters.

Each time that you create an experiment you will have to assign it a Custom Dimension in GA4.

Create the Custom Dimension in GA4

Go to Admin → Custom Definitions. 

Create a new Custom Dimension and register the event parameter that will hold your variation information (for example exp_variant_string).

Save the Custom Dimension.

Enable the GA integration 

Go to your specific experience summary page and from the Add/Edit integrations enable the GA integration:

⚠️ Important

Convert can send experiment impression data directly to Google Analytics through the integration.

Convert also exposes experiment data through the GTM dataLayer.

Do not use both methods to send the same experiment impression data to the same GA4 property, as this will result in duplicate events being recorded.

Choose one approach:

Option A – Direct Integration

  • Enable the GA integration
  • Allow Convert to send impression data directly to GA4
  • Do not create a GTM tag that sends the same impression data

Option B – GTM Data Layer

  • Use the dataLayer variables described below
  • Create your own GA4 Event tag in GTM
  • Do not send the same impression data through the direct 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 Tag Type: Google Analytics: GA4 Event. Select your GA4 Configuration Tag and configure the event parameters as required.


Map the Experiment ID, Variation Name and/or exp_variant_string parameters using the GTM variables created above.
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. 

View Data in GA4 Reports

You can analyze experiment data in GA4 using Reports, Explorations, Audiences, and Custom Definitions built from the event parameters sent through GTM or the direct Convert integration.

 

📒 Note:

Convert's direct GA4 integration already sends experiment impression data as an experience_impression event and includes an exp_variant_string value in the format:

If you are using the direct integration, you may not need the GTM implementation described in this article.