How To Integrate Monetate With Google Analytics

November 03, 2016
By Becky West

In today’s online world, data is king. You likely have many different services running on your website with different reporting tools for each one. Tying this data together, although sometimes difficult and time consuming, can yield more nuanced and high level insights than any single reporting tool in isolation. In this post, we will show how to integrate Monetate data into Google Analytics. However, if you are using a different A/B testing tool, similar methods will apply.

There are two main ways to bring experiment information into Google Analytics: events and custom dimensions. Which method you choose will depend on how many experiments you plan to run, how many custom dimensions you have available, and how you want to report on your data.

Below are instructions for implementing each method using Google Tag Manager.

Method 1: Events

One method of bringing in experiment data is to send an event when the page loads for each experiment that is running on the page. This method makes it easier to track multiple experiments but you will need to use a segment to report on the success of your experiments. Additionally, adding these events may put you closer to your hit limits.

Send Data From Monetate to Google Tag Manager

Create A New Integration

First, we need to configure Monetate to send our experience data to Google Tag Manager. (Note, this is the step that will differ for each A/B testing platform.) We can set this up under Analytics -> Integration:


Click Add Report:


Give the report a title (like Google Analytics or Google Tag Manager). Then copy paste in the following code into the JavaScript box:

var dataLayer = window.dataLayer = window.dataLayer || [];
for (var i = 0; i 


Enable Integration

You will now need to enable this integration for all of your experiences. You can do this by viewing the experience you want to track and clicking on Third-Party Analytics:

Then turn the integration with Google Tag Manager / Google Analytics on:
Note that the Report Label represents how the experience will show up in your Google Analytics data.

Create GTM Trigger

Create a trigger that will fire an event for each experience that is live on the page. This should be a Trigger of type "Custom Event" and the Event name should be "monetateCampaign":


Create Variables for Campaign and Variant

Create (2) Data Layer Variables in Google Tag Manager to capture the monetate campaign and variation. The Data Layer Variable Names are experiment.campaign and experiment.variant:


Add Event Tag

Finally, create the event tag for the Google Analytics event. Note that this event tag should use the same version of Google Analytics (Classic or Universal) that you have on the rest of site.

The Category field should be set to "Monetate Experience", the Action should be set to {{dlv - Monetate Experiment Campaign}} and the Label should be set to {{dlv - Monetate Experiment Variant}}. The Non-Interaction Hit option should be set to "True". All other custom configurations (Fields to set, custom dimensions and metrics) should be consistent with the other pageview and event tracking on your site.


Test and Publish!

Use the preview mode in Google Tag Manager to test this event before publishing.

You should see Monetate events in the Top Events report in Google Analytics. You can use these events to create segments of traffic that viewed a specific version of your experience.

Method 2: Custom Dimension

You can also use custom dimensions to track which variant of the Monetate experience is shown to the user. You will need a different custom dimension slot for each live experience. Also, each time a new experience is added, you will need to make updates to Google Tag Manager and to the Google Analytics Admin settings. (These updates are not required for the events solution.) However, reporting around these experiences can easily be configured in custom reports and dashboards without requiring a new segment to be added.

Create Dimension in Google Analytics

First, you will need to configure Google Analytics to accept the Monetate data in a custom dimension. You will need Edit permissions at the Property level to make this update. You should go to the Admin tab under Custom Definitions -> Custom Dimensions. Then click + New Custom Dimension. Name the custom dimension according to the name of your Monetate Experience. Set the scope to Session and click Create.

Click Done on the next page and then make a note of the Index associate with that new dimension.

How to Send Data From Monetate to Google Tag Manager

If you have not done so already, follow the steps above to integrate Monetate with Google Tag Manager.

Create Variables for Campaign and Variant

If you have not done so already, create dataLayer variables in Google Tag Manager for the experience campaign and variant using the instructions above.

Create A Campaign "Key" Variable

Create a Constant Variable in Google Tag Manager that identifies the experience campaign that you would like to track using a custom dimension. If you would like to track multiple experiences in custom dimensions in Google Analytics, you will need to create a Constant Variable for each experience.

In the Value field, enter the name that was in the Report Label when you enabled the integration in Monetate:


Create A Variant "Value" Variable

Create a Lookup Table Variable in Google Tag Manager that will identify the variant of the campaign that you want to track in the custom dimension. If you would like to track multiple experiences in custom dimensions in Google Analytics, you will need to create a Lookup Table Variable for each experience.


Add Custom Dimension to Tags

Add the Monetate Variant variable to the appropriate Custom Dimension slot in your Google Analytics tag (under More Settings). If the Monetate experiences on your website consistently loads before your pageview tag fires, you may add them to the pageview tag. Otherwise, you will need to create a Monetate event using the instructions above. Then you can add the custom dimension to that event.


Test and Publish!

Use the preview mode in Google Tag Manager to test this event before publishing. You should see the custom dimension populated with the correct experiment variation.

Using Other A/B Testing Tools

You can use a similar method for integrating other A/B testing tools. Below are links to resources for a few of the many other platforms out there: