[GA4] Segment builder

Create subsets of users, sessions, and events.
A segment is a subset of your Analytics data that can be used in Explorations. For example, of your entire set of users, one segment might be users from a particular country or city. Another segment might be users who purchase a particular line of products or who visit a specific part of your site or trigger certain events in your app.

Video examples

Watch two short videos about how to create segments.

Create a custom segment from scratch.

Create a custom segment from a suggested segment.

In this article:

Create a segment

Segments you create or modify are only available in the exploration in which you define them.

To open the segment builder:

  1. Sign in to Google Analytics.
  2. On the left, click Explore.
  1. Select an existing exploration or create a new one. Show me how.
  2. On the left, in Tab Settings, in the Segments section, click the plus sign.

You have three options for creating a new segment:

  • Create a custom segment by defining all the parameters yourself.
  • Start with a suggested segment. These are based on common use cases and allow you to modify and adapt them to your specific needs.
  • Right-click a data point in your visualization to open the context menu, then select Create segment from selection.

Segment date range and condition time period

When you create a segment, one of the variables you can set is the date range for the data included in the segment (e.g., Last 7 days, Last 28 days, or a custom range).

Depending on the type of condition you create to define your segment, you can base the condition on the event_count metric, which gives you the option to specify that the condition must have been met within a certain time period (e.g., event_count > 5 in any 5-day period).

In order to get the results you expect, the condition time period should be less than or equal to the segment date range. It's possible to set the condition time period to be longer than the segment date range, but the segment can never include more data than what is included in the date range.

Create a custom segment

  1. In the top panel, select the type of segment you want to create (see below for more information on the types of segments you can create).
  2. Enter a name and description for the segment. This lets you identify the segment elsewhere in Analytics.
  3. Click Add new condition to specify the selection criteria for this segment. You can create conditions that evaluate dimensions or events. For example:
    1. Age is one of 18-24 or 25-34
    2. app_exception
  4. You can also create segments based on a sequence of steps taken by the user. See below for more information about conditions and sequences.
  5. In the upper right, click SAVE.
The SAVE button is grayed out until you enter at least one complete condition.

Modify a suggested segment

Suggested segments include pre-built and template segments you can use to get started quickly. Segments in the General tab can be used without modification (though you can change them if desired). Templates have conditions already included: you'll just need to provide the values for those conditions.

Types of segments you can create

User segments

User segments are subsets of users who engaged with your site or app: for example, users who have previously purchased; users who added items to their shopping carts, but didn’t complete a purchase.

Event segments

Event segments are subsets of events that were triggered on your site or app: for example, all purchase events made in a particular location; app_exception events that occurred on a specific operating system.

Session segments

Session segments are subsets of the sessions that occurred on your site or app: for example, all the sessions that originated from a particular advertising campaign.

Set up conditions

Conditions tell Analytics what data to include in or exclude from the segment. To define a condition, you select the data you want to evaluate, choose a comparison operator, then provide a value or range of values. For example, for a segment of users in North America, you'd create a user segment and select the Country ID dimension, use the is one of operator, then provide the values "US," "CA," and "MX."

Segment builder example

Types of conditions

You can create conditions that evaluate dimensions, metrics, and events.

Dimension conditions

Dimension conditions let you build segments based on evaluating dimension values related to your users, such as demographics, geography, and technology.

Metric conditions

Metric conditions let you create segments based on predictive metrics, for example, In-app purchase probability is above 90th percentile.

Event conditions

Event conditions let you create segments based on particular details about one or more events. You can include any event parameters sent with the event when it is logged. For example, you can evaluate a level_start event's “level number” or “level name” parameters. (Learn more about Google Analytics 4 events in the gtag.js reference).

Sequence conditions

User-scoped segments support the definition of a sequence condition where you can include or exclude users who have performed a specific sequence of events, from a segment. The definition of the sequence of events can specify:

  • Directly followed: The next event needs to be immediately after the previous one
  • Indirectly followed: There can be other events between the 2 steps, and the time between one step and the next

Each step can be defined by a simple event like add_to_cart or by a more complex condition like add_to_cart AND item_category = shoes.

Note: While defining a sequence, there might be small differences in user counts between the same sequence definition across Google Analytics, for example, across pathing, funnels, segments, and audiences each have optimizations that might not perfectly match.

Use custom event parameters in segments

To use a custom event parameter in a segment, you must first create a custom dimension to hold that parameter's value. You can do this through the Admin > Data display > Custom definitions interface or by entering the custom parameter name in the segment builder, then clicking register.
Registering a custom parameter.

Condition scope

A condition's scope determines how broadly or narrowly the conditions are applied.

For user and session segments, you can select:

  • Within the same event: all conditions must be met within the same event.
  • Within the same session: all conditions must be met within the same session.
  • Across all sessions: all conditions must be met during the lifetime of the user. Learn more about how sessions are calculated.

Conditions for event segments must all occur within the same event.

Dynamic evaluation

By default, user segments with dimension-based conditions include users when they currently meet the condition and then remove them when they no longer meet the condition.

You can override this behavior by selecting the At any point option. This includes users if they ever met the condition during the report or exploration time period, even if they don't currently satisfy the condition criteria.

Here's an example:

Let's say one of your users visited Brazil 2 months ago but is now currently in a different location. Adding a segment with a condition "Country = Brazil" and a time period of the previous 3 months will evaluate as follows:

  • With At any point selected, this condition will still be true today, and that user will be in the segment.
  • With At any point unselected, this condition will be false today, and that user will not be in the segment.

Condition groups

You can build segments that contain multiple conditions and arrange those into condition groups. Within a condition group, each condition can be evaluated with AND or OR logic. Using multiple condition groups lets you make a single evaluation of conditions that use different scopes. For example, you can mix conditions "within the same event" and "across all sessions."

Click Add condition group to add a new group to your segment definition. Condition groups are evaluated with AND logic.

To remove a condition group, hover over each condition in the group, then on the right, click X.

Segment builder example

Set up sequential conditions for user segments

For user segments, click Add sequence to define conditions that occur in a specific order. For example, these events must happen in the order listed:

  1. Step 1: first_open
  2. Step 2: in_app_purchase.

Optionally, you can require that the steps be completed within a specific time period:

  1. On the right, click Time Constraint.
  2. Click the toggle, then define the time period in which the whole sequence must occur (for example 30 Minutes).

Click Add step for each additional step you want to include in the sequence.

TIP: Condition groups always appear above sequences. If you add a condition following a sequence and it seems to disappear, scroll up to find it again.

Exclude conditions

By default, the conditions you define are "include" conditions: they define the users or events you want to include in your exploration. Click Add condition group to create a condition that excludes users or events.

Select Temporarily exclude users when to exclude users from the segment for the periods of time when they meet the condition.

Select Permanently exclude users when to exclude users from the segment if they've ever met the condition.

Segments first evaluate all your inclusion conditions, then apply any exclusion conditions you've defined.

A segment can have multiple exclude groups.

Differences between segments in Universal Analytics vs. Google Analytics 4 properties

You can use segments in both Universal Analytics and Google Analytics 4 properties. Fundamentally, segments work the same way in both products. However segments appear in different places, and have a few different features depending upon which kind of property you're using them in.

For Google Analytics 4 properties, segments are only available in Explorations. (If you need to see subsets of data in your reports, you can use comparisons, which also let you focus on subsets of your data.)

You can create segments in Analytics based on sessions or users. In the new Explorations, segments can be based on users, events, or sessions.

Finally, segments in Universal Analytics properties are subject to certain limits that don't apply in Google Analytics 4 properties. Learn more about segments in Universal Analytics properties.

Limits of the segment builder

  • You can create up to 10 segments per exploration.
  • You can apply up to four segments to an individual exploration technique at one time.

Was this helpful?

How can we improve it?
Clear search
Close search
Google apps
Main menu