Integrating experiences with Google Analytics

If you are using Google Analytics to track and analyze site data, you can also integrate experience interaction results as an additional touchpoint.

Once integrated, Qubit will send experience data automatically and seamlessly to your GA dashboard, which you can then use to:

  • Report on multiple metrics outside the goals measured in the Qubit platform
  • Track GA data for the experience control and any variations
  • Filter GA data by visitors that were served an experience and those that were not

INFO: When a visitor is served an experience, Qubit will send a single custom event and, for tags implemented via Google Tag Manager, a single GTM event. These events are only sent once per session when the visitor is served the experience.

INFO: To help you easily identify the experience control and variation in third-party integrations such as GA, we provide a method, via your prescript, to send a custom label rather than an Id. See our example for details.

Getting started

To send experience data to Google Analytics, you first need to enable GA integration.

To do this, select the Google Analytics integration toggle:

ga toggle

You can find more information about enabling GA integration in each of the articles covering configuring experiences.

Setting up Google Analytics (GA)

Once you have enabled GA integration for an experience, you must setup GA to receive the data sent by Qubit and process it into a standard format.

How you do this depends on how you have implemented the GA tag on your site.

Hard-coded Google Analytics tag

If the tag has been hard coded, you only need to set up a segment in Google Analytics and pass the experience Event action Id and Event Label Id as advanced conditions.

See Creating Segments in Google Analytics for more information.

Tag implemented via Google Tag Manager (GTM)

If the tag has been implemented via GTM, you will need to set up the trigger, variable, and tag in GTM.

See Setting up GTM to send data to Google Analytics for more information.

Further information

How is data passed to Google Analytics?

When a visitor is served an experience, either the control or a variation, Qubit will send a single custom event to Google Analytics and additionally a single GTM event. This approach ensures that the experience data can be sent to GA irrespective of how the GA tag has been implemented. It also allows us to track the serving of an experience as an event.

Following the example experience used in our other Google Analytics integration articles, the following examples show the JavaScript generated by the custom event that is sent to GA and the event that is sent to GTM:

ga event id

Example GA event:

ga('send', {
  hitType: 'event',
  eventLabel: 186039,
  eventAction: 1122508,
  nonInteraction: true
})

The custom event uses a send command and hitType event.

Example GTM event:

{
  "event": "qubit.experience",
  "qubitExperimentId": 1122508,
  "qubitVariationMasterId": 186039
}

Bounce rate

By specifying

{
  "nonInteraction": true
}

we can ensure that the event is sent as a non-interaction event and will not impact the bounce rate.

Last updated: October 2021
Did you find this article useful?