---
title: Create segments for Google Analytics 4 (GA4)
slug: feature-experimentation/docs/create-segments-for-google-analytics-4
docTags: 
createdAt: 2026-08-05T20:39:57.000Z
---

:::hint{type="info"}
This is a third-party integration and is not an Optimizely subprocessor. See Optimizely's [Third-Party Add-Ons & Platform Integration Terms](https://www.optimizely.com/legal/third-party-add-ons-platform-integration-terms/).
:::

## Prerequisites

Before creating segments within GA4, you must configure an integration between Optimizely Feature Experimentation and Google Analytics 4 (GA4). For information on configuring this integration, see [Configure Google Analytics 4](docId\:oGZR-3lIJjDfKHlFWcbTj).

:::hint{type="info"}
It can take up to 48 hours before values become available in Google Analytics 4 (GA4) so that you can create dimensions and segments with them.
:::

## Create segments in GA4

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

### Create custom dimensions

1. Go to **Configure > Custom definitions > Create custom dimensions**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/hqKc_vGwWjnL5xvvDZeEZ_bd26c47-mceclip0.png)

2. 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**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/KjJVC6EILYJ6RkN25QaNl_2f412ad-microsoftteams-image-19.png)

3. Repeat steps one and two for **Rule**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/5O7YL4ltzxjsWj72ncshi_b878ab0-microsoftteams-image-20.png)

4. Repeat steps one and two again for **Variation**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/a-l0GTq7SRdPAedocZmmK_9c47623-microsoftteams-image-21.png)

### Create an exploration and add segments

1. Go to **Explore** and select an exploration type (for example, **Free form**).

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/yEvOgF2nNOFi-g9TSSjDC_4132b8e-free-form.png)

2. In the **Variables** panel, click **+**  for **SEGMENTS**.
3. On the **Build new segment** page, in the **Create a custom segment** section, click **User segment**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/9Ydttl_DZdozvdXOyh4iT_2df24a6-create-new-segment.png)

4. Enter the name of the segment (specifying the specific flag, rule, or variation for which you are creating this segment).
5. Expand the **Add new condition** drop-down list and click **Custom > Optimizely FS Flag**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/yVhYsJH_dIAb6CLvLbJ4R_d89d6b1-include-flags.png)

6. Click **ADD FILTER**.
7. Ensure the **Condition** is set to **contains** and then select the flag, rule, or variation for which you want to create the segment. The following image shows an example for **Optimizely FS Flag**:

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Rzs7VtB3M6gKfcZwrfqLT_373aa72-microsoftteams-image-22.png)

8. Click **SAVE AND APPLY**.
9. Repeat steps two through eight for **Rule**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/DSGXyvsXBbUEgBOZ0AmXM_d7f3211-microsoftteams-image-rule-25.png)

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/r-xjRddAZetpqY4B5ema0_9192cd9-microsoftteams-image-23.png)

10. Repeat steps two through eight for **Variation**.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/galVRAnO56le-GU7wwDw__2790694-add-variation.png)

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/jXH2lEBRdz0e8HA1cAooh_24c2791-microsoftteams-image-24.png)
