Enable Google Analytics 4 (GA4) integration

This article explains how to set up Coveo Merchandising Hub (CMH) to send Google Analytics 4 (GA4) View and clickthrough events, and shows the structure of these events.

Warning

CMH 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 a CMH 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 CMH property to that roll-up property.

Note

This is a property-wide setting that you can’t configure at the individual campaign level. If you turn on the integration, CMH will send View and Clickthrough events for all the experiences in your campaigns.

Enable GA4 integration

To enable GA4 in your property:

  1. Open the side bar and select Property settings.

  2. Switch to the Integrations tab.

  3. In the Google Analytics 4 card, turn on the toggle.

    If that’s the first time you enable the integration, the modal window will open automatically.

    Note

    If you have already set up the integration in the past, you need to click the Edit button below the Google Analytics 4 card to open a modal window.

  4. In the modal window, paste your Measurement ID and API secret in the corresponding fields.

  5. Click the Save button to save the credentials and close the modal window.

From now on, the integration is active and will send View and Clickthrough events to GA4.

To test if the integration works, use the Send test event button.

Event parameters sent to GA4

To find relevant events in GA4, you need to know what exact event data CMH sends to GA4.

  1. In the left menu, select Campaigns.

  2. Select the campaign whose events you would like to find in GA4.

  3. On the campaign results page, switch to the Integrations tab.

Here, you can see the event parameters that CMH sends to your GA4 account. The data displayed in this tab may help you in creating reports and segments in GA4.

Parameter Description

campaign_id

The campaign’s unique identifier.

Example: abc123-def456

campaign_name

The human-readable campaign name.

Example: Recommendations test for North-American users

is_preview

Shows if the event came from the campaign previews.

Possible values are:

  • 0—event did not come from a campaign preview.

  • 1—event came from a campaign preview.

Example: 1

placement_id

The Placement’s unique identifier.

Example: 8IJM-mEsQKodgvBbb1S_wg

placement_name

The human-readable Placement name.

Example: you-may-like carousel

variant_type

Possible values are:

  • BASELINE—use it to replace CONTROL and test it against a TEST variant.

  • TEST—use it to test campaign changes against BASELINE or CONTROL.

  • CONTROL—use it to show users the site default, without changes.

Under the hood, CMH sends the following payload to GA4’s endpoint https://www.google-analytics.com/mp/collect:

{
  "client_id": "X",
  "events": [
    {
      "name": "cmh_campaign_view", 1
      "params": {
        "campaign_id": "abc123-def456"
        "campaign_name": "Recommendations test for North-American users",
        "is_preview": "1",
        "placement_id": "8IJM-mEsQKodgvBbb1S_wg",
        "placement_name": "you-may-like carousel",
        "variant_type": "CONTROL"
      }
    }
  ]
}
1 Specifies the event type. Possible values are: cmh_campaign_view, cmh_campaign_clickthrough.