Push Convert data to GA with Event Tracking

Push Convert data to GA using Custom Dimensions

If you want to push Convert data to Google Analytics using Custom Dimensions, you can do it with two different ways:

  1. Integrate Convert with GA: Use the Experiment Settings and enable the integration with GA by assigning a specific GA Custom Dimension.
  2. Use GTM datalayer to push Convert data to GA: Create a GTM tag and define the appropriate variables and dimensions to push Convert data to a specific GA Custom Dimension.

Then you can view Convert data inside GA through Customisation > Custom Reports.

Push Convert data to GA using Event Tracking

However, there might be a case where you do not want to touch your GA Custom Dimensions. In that scenario, you can use GA Event Tracking. Depending on the version of GA that you use, find some useful documentation here on the commands that you should use:

  1. Event Tracking in GA Legacy (ga.js): https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
  2. Event Tracking in Universal Analytics (analytics.js): https://developers.google.com/analytics/devguides/collection/analyticsjs/events
  3. Event Tracking in GTAG (gtag.js): https://developers.google.com/analytics/devguides/collection/gtagjs/migration#track_events

Then you can view Convert data inside GA through Behaviour > Events.

Below we describe how this is possible.

Add Global Project Javascript

Go to your Convert Project settings and add this code:

/* Push Convert data to GA with Event Tracking */
//Make an empty variable for experiment ID
var experimentId = xxxxxxxx;
//if Convert object exists AND an experiment with a specific experiment ID is running
if (typeof(convert) != "undefined" &&
convert.currentData.experiments.hasOwnProperty(experimentId)) {
//Send a non-interaction event to Google Analytics each time the experiment is displayed. That event has a Category of “Convert,” an Action that is the experiment ID, and a Label that is the variation ID of the experiment that was displayed.
window.ga = window.ga || [];
ga('create', 'UA-xxxxxxx-y', 'auto');
ga('send', 'event', 'Convert', convert.data['experiments'][experimentId].id, convert.currentData.experiments[experimentId].variation_id, true)
/* End of code*/
  • If you use ga.js, then you have to use _gaq.push.
  • If you use analytics.js, you need to use ga('send'...) like in the code example above.
  • If you use gtag.js you should use the new syntax with gtag('event'...). 

The methods are not interchangeable, they belong to three different versions of the Google Analytics tracking code.

You can also use a loop function if you run multiple experiments in the same page, like this:

for(var experiment_id in convert.currentData['experiments']) {
if(!convert.currentData['experiments'].hasOwnProperty(experiment_id)) continue;

View Convert Data in GA

Once the experiment runs, you can go to GA > Behaviour > Events > Overview (or Real Time Events) and see the Convert data:

Have more questions? Submit a request