Convert Experiences and Google Tag Manager dataLayer

Integrate Google Tag Manager

Experiments fired on page by Convert Experiences are pushed into the Google Tag Manager default dataLayer object for further processing inside GTM. Below are the keys of the object pushed to 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 the variation name of the selected variation,  as found inside Convert Experiences app

Example: 

dataLayer.push({ "event":"convert-trigger-experiment-1234", "experiment_id":"1234", "variation_name":"test variation" });

Inside Google Tag Manager, this data can be used and sent forward to other services that are supported; Let's analyze how we would send the variation triggered to Google Analytics Universal through a custom dimension. To send data over to google analytics we will use a non interactive event.

  • First, you need to have a certain dimension already defined in your Google Analytics account. It needs to be a User scope custom dimentsions. Let's say it's the Custom Dimension whose index is 1(one).
  • Than, inside Google Tag Manager, we need to define at least one variable that captures the variation name. One could also capture experiment ID through a macro for more creative firing/tracking scenarios but that's outside the scope of this presentation. Below is the screenshot of how to define a variable that captures the variation name:



  • Once the variable is saved we can go ahead and create a new tag as follows:




  • When creating the tag, we need to also specify the custom dimension to use and the value for it. We'll use the custom dimension index 1 and place as value the variation name:




  • The only thing missing after this is a rule to fire the tag. We'll define it as below:









Please note that this rule will fire the tag every time an experiment will be fired. If you have multiple experiments running on site at the same time, you do not want to send them all to the same custom dimension since only one would be recorded. For that, you could either create a macro that reads the experiment ID and than, another macro, that, based on the previous macro value, defines the dimension index used. Instead of hard coding the dimension in the previous step, you would use this macro.

 Important: if you send variations to google analytics through google tag manager you might want to disable automatic send of variation through the "on-page" google analytics tag in convert experiments app (if used):



Have more questions? Submit a request

Comments