How to Integrate Monetate with Google Analytics


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:


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:



Becky is a Data Scientist at LunaMetrics. She started deriving equations and building calculators in high school and ended up with a Masters in math from Georgia Tech. Her experience in data analysis and reporting has given her a great appreciation for data-driven decision making. Becky enjoys swimming, working on puzzles, and spending time with her husband Jonathan.

  • Phil Pearce

    Hi Becky

    Its important to mention to users that the native Monetate GA integration will send a non-interactive hit to ALL ga id`s that are declared on the page (i.e classicTracker, universalParellelTracker, errorTracker) so… it will result in a 2x increase in hits, which gets expensive!

    The work-around is to rename the universal object for “ga” to “ga2” for universalParellelTracker & errorTracker within GTM.

    More details here…

    Minor script suggestion, why not output the customDimensions in the script…

    if(campaigns) {
    for (var i = 0; i < campaigns.length; i++) {
    window.dataLayer = window.dataLayer || [];
    "eventCategory": "Monetate",
    "eventAction": campaigns[i].key,
    "eventLabel": campaigns[i].split,
    "eventValue": undefined,
    "eventNonInteractive": true,
    "eventId": undefined,
    "monetateCampaignTestId": campaigns[i].id, // Session level CustomDimension
    "monetateCampaignTestKey": campaigns[i].key, // Session level CustomDimension
    "monetateCampaignTestLabel": campaigns[i].split, // Session level CustomDimension
    "event": "monetate"



    • Becky West

      Thanks for your comments Phil! The point about increasing your hits is particularly important so I’m glad you called that out. Adding these events could drastically increase your hit count, which may put you closer to your hit limits in the free version of GA, or increase the cost of your 360 Suite contact. If you are concerned about hits, you may want to use the custom dimension route instead.

      Thanks also for the suggested code modification. That will work great if you have a “generic” event tag set up in Google Analytics. While the generic event tag route works well in some cases (and is even the only reasonable solution on some sites), I like to stay away from the generic event tags when possible. In general, I think it’s easier to go back and review my tags if the event category, action, and label are descriptively named right in the tag. But it does create extra variables in your container, so there are certainly pros and cons.

      • Ken

        Hi Becky. Great post! I noticed a spelling error in your custom monetate code for dataLayer push. Your instructions use “monetateCampaign”, but the code has “montetateCampaign”…

        Like Phil we output custom dimensions in our script. We removed all GA UA-XXXXXX references on our site. We are using GTM w/ dataLayer variables exclusively and have set up GTM to send the dataLayer variables to both Legacy GA and UA.

        We used Monetate’s GA feature to begin with, but now we’re looking for a solution to have Monetate submit via the dataLayer. I incorporated your solution, but nothing is triggering the monetateCampaign event. Did I miss a step?

        • Becky West

          Hi Ken,

          Thanks for catching that typo!

          Just to clarify, you are not seeing monetateCampaign show up in the dataLayer? (Event is an overused word in the world of Google Tag Manager 🙂 )

          If you don’t see this value in the dataLayer, it is likely that you either did not create the integration, or that you did not enable the integration on a live experience. Note that this integration will need to be enabled on all experiences that you want to track.

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187