The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Google Analytics 4

Describes the integrations available for Google Analytics 4 and Optimizely Web Experimentation

Optimizely Web Experimentation lets you integrate with Google Analytics 4 (GA4) and Google Tag Manager (GTM). See Determine your GA4 implementation to know which integration to use.

Get started with Google Analytics 4

You can integrate with Google Analytics 4 to run, monitor, and analyze experiments across various channels and touchpoints. This integration gives you more insight into user behavior and experiment performance, providing data for decision-making.

There are two GA4 integrations supported by Optimizely Web Experimentation.

Analytics Integration

The GA4 Analytics Integration shares your visitor's experiment assignments with GA4 allowing you to build reports in GA4 with visitors from a specific experiment or variation. This integration has two functions.

See Integration Google Analytics 4 to configure the integration.

Experiment Assignments

Optimizely Web Experimentation sends a visitor's experiment assignments to GA4 by passing data from the Optimizely snippet on your site to the GA4 tag also on your site. The analytics integration passes data to your GA4 tag in the following two ways:

  • Custom dimension – In GA4, the events from Optimizely Web Experimentation display as optimizely_decision. If you want to create segments in GA4 (not required for Report Generation), you must set up custom dimensions using this event.
  • Pre-defined dimension – In GA4, the events from Optimizely Web Experimentation display as experience_impression. Using this event does not require you to set up custom dimensions to create segments in GA4. You can use the out-of-the-box Experience - variant ID dimension as your segment condition.

📘

Note

There is an option called Mask descriptive names in project code and third-party integrations in the Snippet Settings. Enabling this option hides experiment and variation names and only sends the ID to GA4. Although Optimizely Web Experimentation has this project setting enabled by default, you can disable it to see your experiment and variation names in GA4.

Experiment Assingments Data Freshness

It can take up to 48 hours for the data to be displayed in the GA4 Reports snapshot from the time it was collected and for the audiences in GA4 to reflect new users due to processing delays. You can verify and validate that the events are accurately sent through Realtime reports by monitoring the experience_impression and optimizely_decision events, which show events triggered within the last 30 minutes.

To get started See Determine your GA4 implementation to determine how your GA4 tag is implemented on your site.

Report Generation

You can use Report Generation to send experiment variations to GA4 as audiences, eliminating the need to manually create custom dimensions and segments. This lets you compare and contrast the performance of variations through custom reports on audiences.

These are examples of GA4 reports you can build with Report Generation:

See GA4 Report Generation to set up Report Generation.

Analytics Integration Limitations

  • Report Generation supports a single GA4 property.
  • The integration does not support more than 1 GA4 tag on your site when sharing experiment assignments.
  • The integration does not support multiple Google Tag Manager containers when sharing experiment assignments via Google Tag Manager.
  • The integration does not support Google Tag Manager dataLayer objects named anything other than dataLayer camel-cased.

Audiences Integration

You can use your Google Analytics 4 (GA4) audiences to act on insights gathered from experiment results with your GA4 integration. This lets you target experiments based on segments in GA4 without the need for custom development.

Using GA4 audiences unlocks new targeting capabilities within Web Experimentation. For example, GA4 has demographics-based audience creation (age and gender) and predictive audience identification for potential purchases within a specified timeframe.

See Integrate Google Analytics 4 audiences to configure the integration.

Determine your GA4 implementation

Before integrating Optimizely Web Experimentation with GA4, follow these steps to determine how your GA4 tag is currently implemented on your site..

  1. Open Google Tag Assistant or install and launch the Tag Assistant Companion Chrome Extension.

  2. Select Add domain and paste a URL from your site.

  3. Click Connect. Tag Assistant loads the URL you pasted in a new browser tab.

  4. Look for a GA4 tag in the Tag Assistant tab.

    1. If the Source of the Tag is On-page gtag('config'), your GA4 tag is implemented directly on the page. Go to Integrate Google Analytics 4.

    2. If the Source of the Tag is Tag in container GTM-[TAG ID], your GA4 tag is implemented with Google Tag Manager. Go to Integrate Google Analytics 4 with Google Tag Manager.