Dev guideAPI Reference
Dev guideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Create segments for Google Analytics 4 (GA4)

Use Google Analytics 4 (GA4) to capture and analyze traffic data across your websites and applications.

πŸ“˜

Note

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).

Prerequisites

⚠

️ Important

You must set up an integration between Optimizely Feature Experimentation and Google Analytics 4 (GA4) before creating segments within GA4. For information on setting up this integration, see Set up Google Analytics 4.

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

πŸ“˜

Note

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 Feature Experimentation in GA4:

Step 1. Create custom dimensions

  1. Go to Configure > Custom definitions > Create custom dimensions.
create custom dimensions
  1. Complete the following fields on the New custom dimension page:
    a) Dimension name - Enter your desired name (such as Optimizely FS Flag).
    b) Scope - Ensure this is set to Event.
    c) Description - Enter an optional description.
    d) Event parameter - Select Flag.
configure custom dimension
  1. Repeat steps 1 and 2 for Rule.
configured rule dimension
  1. Repeat steps 1 and 2 again for Variation.
configure variation dimension

Step 2. Create an exploration and add segments

  1. Go to Explore and select an exploration type (for example, Free form).
select exploration type
  1. In the Variables pane on the left, click the plus icon next to SEGMENTS.
  2. On the Build new segment page, in the Create a custom segment section, click User segment.
create user segment
  1. Enter the name of the segment (specifying the specific flag, rule or variation for which you are creating this segment).
  2. Expand the Add new condition dropdown list and click Custom > Optimizely FS Flag.
add new condition
  1. Click ADD FILTER.
  2. Ensure the Condition is set to contains and then select the flag, rule or variation for which you want to create the segment. The picture below is an example for Optimizely FS Flag.
set contains condition
  1. Click SAVE AND APPLY.
  2. Repeat step 2 through step 8 for Rule.
set contains condition for rule
set contains condition for rule
  1. Repeat step 2 through step 8 again for Variation.
set contains condition for variation
set contains condition set variation condition