Enable Google Analytics 4 integration

This is for:

Developer

This article explains how to set up the Coveo Experimentation Hub to send Google Analytics 4 (GA4) Impression events and shows the structure of these events.

Warning

The Coveo Experimentation Hub doesn’t send events to Google Universal Analytics (Google UA) and Google Analytics 4 (GA4) if any or both of the following are true:

  • the qb_dnt cookie is set to 1 or 2

  • the qb_dnt_ext cookie is set to ga

Prerequisites

Make sure that you have:

Features

Similarly to the integration with Google Analytics, the integration with GA4 allows you to send events from an Experimentation Hub property to GA4.

Also, this integration lets you use the roll-up property in GA4 for analysis. This means that in GA4, you can have one roll-up property for many of your brands and send all events from your Experimentation Hub property to that roll-up property.

Note

The Coveo Experimentation Hub can send events to both GA and GA4, it depends on what versions of GA are set up on your site.

Enable GA4 integration

You can enable the integration for any invidual experience in your property.

  1. Open the side bar and select Experiences.

  2. Click the experience you want to enable the integration for.

  3. Switch to the Settings tab.

  4. Scroll down to the Google Analytics GA4 integration section.

  5. Turn on the toggle. The changes are saved automatically.

Important

From now, the integration is active and will send Impression events to GA4.

When the integration is enabled, the Google Analytics GA4 integration section shows the following information:

  • Experience (shared parameters) — experience parameters common for all variations of this experience.

    • experience_id

    • experience_name

  • For each variation, its name followed by these parameters (see Event payload):

    • variation_master_id

    • variation_name

    • is_control

Event payload

To find relevant events in GA4, you need to know what exact event data the Experimentation Hub sends to GA4. That data may help you in creating reports and segments in GA4.

Under the hood, the Experimentation Hub checks if the window.gtag() method is available on the site. If it’s available, the Experimentation Hub uses it to send the following payload to GA4:

{
  "name": "experience_name",
  "params": {
    "experience_id": "174681", 1
    "experience_name": "Impressions Count Banner 1", 2
    "variation_master_id": "238", 3
    "variation_name": "GA4 Impressions Count Banner 1, 2023", 4
    "is_control": "no", 5
  }
}
1 The experience’s unique identifier.
2 The human-readable experience name.
3 The variation’s unique identifier.
4 The human-readable variation name.
5 Shows whether it’s a CONTROL variation or not. Possible values are: yes, no.