Create segments for Optimizely Web in Google Analytics 4 (GA4)

  • Updated
Use Google Analytics 4 (GA4) to capture and analyze traffic data across your websites and applications. 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).

You must set up an integration between Optimizely Web Experimentation and GA4 to create segments for Optimizely Web within GA4. For information on setting up this integration, see the following articles:

Once your integration between Optimizely Web and GA4 is set up, you can create segments for Optimizely Web within GA4.

It can take up to 48 hours before values become available in Google Analytics 4 (GA4) so that you can create dimensions/segments with them.


Create segments in GA4

Complete the following steps to create segments for Optimizely Web in GA4:

Step 1. Create custom dimensions

  1. Go to Configure > Custom definitions > Create custom dimensions.
  2. Complete the following fields on the New custom dimension page:
    1. Dimension name - Enter your desired name (such as Optimizely experiment).
    2. Scope - Ensure this is set to Event.
    3. Description - Enter an optional description.
    4. Event parameter - Select optimizely_experiment.
  3. Repeat steps 1 and 2 for optimizely_variant.

Step 2. Create an exploration and add segments

  1. Go to Explore and select an exploration type (for example, Free form).
  2. In the Variables pane on the left, click the plus icon next to SEGMENTS.
  3. On the Build new segment page, in the Create a custom segment section, click User segment.
  4. Enter the name of the segment (specifying the specific experiment/variant for which you are creating this segment).
  5. Expand the Add new condition dropdown list and click Custom > Optimizely experiment.
  6. Click ADD FILTER.
  7. Ensure the Condition is set to contains and then select the experiment/variant for which you want to create the segment. The picture below is an example for Optimizely experiment.
  8. Click SAVE AND APPLY.
  9. Repeat step 2 through step 8 for Optimizely variant.