Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In

Integrate Google Analytics 4 (GA4)

Track your Optimizely Web Experimentation events in Google Analytics 4 (GA4), and with the optional beta features, view your experiment and variation data as audiences in GA4.

🚧

Important

Some of the features for the built-in Google Analytics 4 (GA4) integration are in beta and marked accordingly. Contact your Customer Success Manager for more information, or sign up for the beta program on the Optimizely beta signup page.

🚧

Important

Starting July 1, 2023, GA4 will replace standard Google Universal Analytics (UA), which will no longer process data. For more information, see Introducing Google Analytics 4 (GA4).

📘

Note

This articles describes our built-in GA4 integration option.

Use this integration to track your Optimizely Web Experimentation experiments in Google Analytics 4 (GA4). Below are some of the benefits of integrating with GA4:

  • Get a direct view of how Optimizely Web Experimentation experiments affect the metrics you track in GA4.
  • (Beta) See GA4 data for each variation in your experiment (or experience in a campaign).
  • (Beta) Create and manage GA4 audiences from your Optimizely Web Experimentation variations.
  • Filter your GA4 reporting by visitors successfully included in an Optimizely Web Experimentation experiment and exclude those not included.
  • Further analyze experiment data outside of the events within Optimizely Web Experimentation.
  • Segment GA4 funnel behavior on Optimizely Web Experimentation variations (for example, view the previous/next pages someone went to after seeing a page in an experiment).

Prerequisites

  • An existing account with GA4.
  • Create a new GA4 property, add a data stream, and set up data collection. See Google's documentation.

Transition from GA4 Event Tracking to GA4 Audience Mapping (beta)

GA4 Event Tracking was the first version of this integration, which did not include the ability to send specific variations to GA4 as audiences. GA4 Audience Mapping is the beta version of this integration, which now includes the ability to send specific variations to GA4 as audiences and to integrate with GA4 using GTM.

If you enabled the first version of this integration (GA4 Event Tracking), and you want to use the new GA4 Audience Mapping beta, you need to:

  1. Complete the second set of steps in the Enable the integration section below.
  2. Select the variations for each experiment that you want to send to GA4 as audiences.

How the data sends to GA4

While you transition from the first version of this integration (GA4 Event Tracking) to the beta version (GA4 Audience Mapping), Optimizely Web Experimentation sends data to GA4 in the following two ways:

📘

Note

This is temporary while transitioning from GA4 Event Tracking to the GA4 Audience Mapping beta. After September 30th, 2023, Optimizely will only send data through pre-defined dimensions.

  • Custom dimensions that you create – In GA4, the events from Optimizely Web Experimentation display as optimizely_decision.
  • Pre-defined dimensions Google provides – In GA4, the events from Optimizely Web Experimentation display as experience_impression.

Enable the integration

To enable the built-in GA4 integration in Optimizely Web Experimentation:

  1. Go to Settings > Integrations.
  2. Click Google Analytics 4.
  3. Toggle the integration On and click Accept.
  4. Select the corresponding checkbox to enable the built-in GA4 integration for all new experiments by default.
  5. Click Save.

If you are using the GA Audience Mapping beta, skip step 5 and continue as follows:

  1. Click Sign in with Google and enter the required information to connect Optimizely Web Experimentation with your Google account.
  2. Enter your Google Analytics Property ID. See Google's documentation for help locating this ID.
  3. Click Save.

Enable the integration with GTM (beta)

To enable this integration using Google Tag Manager (GTM), complete the steps above, then:

  1. Select the Use Google Tag Manager for this integration checkbox.

    📘

    Note

    Selecting this checkbox completes step 1 (add script in GTM) of the custom integration process.

  2. Complete steps 2 through 4 from the custom integration process (add user-defined variables, set up the configuration tag, and set up the event tag).

Add the GA4 integration to an experiment

When you enable the built-in GA4 integration in your account, it displays as an option on your experiments' Integrations page.

If you did not select to enable the built-in GA4 integration by default for new experiments, you must select the Tracked checkbox on each experiment for which you want to send data to GA4.

Send variations to GA4 (beta)

🚧

Important

This functionality is part of the GA4 Audience Mapping beta. To join the beta, contact your Customer Success Manager or sign up on the Optimizely beta signup page.

Now that you have enabled the GA4 integration for your account and desired experiments, select the variations that you want to send to GA4 as audiences:

🚧

Important

You must be an Editor (or above) in the GA4 property to send variations to GA4 as audiences.

  1. Go to Integrations in an experiment.
  2. Select up to 4 variations for the Variation Audiences you want to send to GA4.

    📘

    Note

    Optimizely Web Experimentation limits you to 4 variations per experiment because GA4 reports can include no more than 4 audiences.

  3. Click Save.
  4. Click Continue on the confirmation message that displays.

🚧

Important

Make all changes to your variations/audiences before publishing an experiment. GA4 does not retroactively add users to an audience, and Optimizely Web Experimentation does not recreate a deleted audience.

If you delete an audience while an experiment is active, it still displays in the GA4 report but only with data through the time you deleted it.

GA4 audience limits/requirements

The GA4 integration sends Optimizely Web Experimentation variations to GA4 as audiences. GA4 has the following limits for the number of audiences you can have, depending on your account:

  • GA4 standard allows up to 100 audiences
  • GA4 360 allows up to 400 audiences
  • Both versions of GA4 limit reports to include up to 4 audiences

Optimizely Web Experimentation tracks the number of audiences in your connected GA4 account and displays the number of remaining audiences in the Variation Audiences section of the experiment's Integrations page.

When you reach your GA4 audience limit, you can not send any additional variations to GA4. Optimizely Web Experimentation displays the following warning message if you try to send additional variations after you have reached your GA4 audience limit:

GA4 audience maintenance

Optimizely Web Experimentation deletes a GA4 audience for you when:

  • You archive an experiment that was sending variations to GA4.
  • You un-map a variation (deselect it on an experiment's Integrations page).

🚧

Important

If you delete an audience while an experiment is active, it will still display in the GA4 report, but only with data through the time you deleted it.

GA4 data freshness

GA4 audiences can take 24-48 hours to reflect new members. So, when viewing reports in GA4 for your Optimizely Web Experimentation experiments, allow up to 48 hours for accurate data reflection.

Create custom reports in GA4 (beta)

🚧

Important

This functionality is part of the GA4 Audience Mapping beta. To join the beta, contact your Customer Success Manager or sign up on the Optimizely beta signup page.

When you complete an experiment, you can create custom reports in GA4 to view the experiment results. For help with creating these reports, see Google's documentation.

📘

Note

Google allows 150 custom reports per GA4 property.

In Optimizely Web Experimentation, click the More Options icon (...) on the Experiment Results page, and select Create Google Analytics Report.

You can access that same link from the Experiments page. Again, click More Options and select Create Google Analytics Report.

GA4 reprocessing

In rare cases, you may notice data loss in GA4 due to reprocessing experience data, which can cause GA4 to remove the audience ID. For more information on reprocessing in GA4, see Google's documentation.

If this happens, there are a couple workarounds to find your data:

  • Use GA4 Explorations – Resurface the experience-variant ID. This displays all users that saw the experiment but is less granular due to Exploration limitations (cannot filter by date range). For more information, see Google's documentation on Explorations.
  • Export events using BigQuery – View all events and filter by date range. For more information, see Google's documentation on BigQuery.