Piping Convert Data into GA or GTM

Summary

Convert provides different options to send data to GA. One of them is to send data as a string into GA (pipe) for the user to manipulate it and insert it into GA as you please.

Extracting the Data from your page and sending it to GA

The data will be sent in the following format as a string in the chose dimension to GA, depending of the number of experiments the user is bucketed on:

e:experimentid1=v:correspondingvariationid,e:experimentid2=v:correspondingvariationid,e:experimentid3=v:correspondingvariationid

First, you will need to place some code in the Convert app in Project Settings > Global Project Javascript.

To send the data to Google Analytics insert this:

/* Push Convert data to GA as Pipe */
setTimeout(function(){
if (ga){
var dimension = 'dimension1'; // Set this to the dimension you want to send the data to
var exp = convert.currentData.experiments;
var number_of_experiments = Object.keys(exp).length;
var loop_counter = 0;
var reporting_string = '';
for (var expID in exp){
reporting_string = reporting_string + 'e:' + expID + '=' + 'v:' + exp[expID].variation_id;
if (loop_counter < (number_of_experiments - 1)) {
reporting_string = reporting_string + '|';
}
loop_counter++

var trackername = window.ga.getAll()[0].get("name");
ga(trackername+'.send', 'pageview' ,{dimension: reporting_string})
}
},1000);
/* End of code*/

To send the data through GTM. This article does not cover how to move the information from GTM to GA. However, still provides value on how to send the data via GTM via this format.

 

/* Push Convert data to GTM as Pipe */
setTimeout(function(){
if (window.dataLayer){
var dimension = 'dimension1' // Set this to the dimension you want to send the data to
var exp = convert.currentData.experiments;
var number_of_experiments = Object.keys(exp).length;
var loop_counter = 0;
var reporting_string = '';
for (var expID in exp){
reporting_string = reporting_string + 'e:' + expID + '=' + 'v:' + exp[expID].variation_id;
if (loop_counter < (number_of_experiments - 1)) {
reporting_string = reporting_string + '|';
}
loop_counter++
}
window.dataLayer.push({'ConvertExperiments':reporting_string,'dimension':dimension});
}
},1000);
/* End of code*/

From here, you can choose how to insert the data into GA. 

If using the GA option you will need to create the Custom Dimension in GA and address the index in the code as commented.

blobid0.png

blobid1.png

Name the dimension. Select Session as the Scope, and Save it.

blobid2.png

Lookup the dimension index, and use it in your code for setting it as instructed in the GA code comments.

blobid3.png

In this, we would use 'dimension18' in the code.

Now, you will be able to use the data in GA and GTM as you wish. 

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments