[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 analysis. For example, a segment could be users from a particular country or city. Another segment could be users who purchase a particular line of products, who visit a specific part of your site, or trigger certain events in your app.

Using Segments in Google Analytics

For subtitles in your language, turn on YouTube captions. Select the settings icon Image of YouTube settings icon at the bottom of the video player, then select "Subtitles/CC" and choose your language.


 
In this article:

Create, save, and use segments

Segments are available only within the Explore module. They can be local, saved within the single exploration where they have been created, or saved at the property level (by Editor and above user roles), and available to everyone in the property to apply to their own explorations.

Create a local segment

Local segments can be created by every user role, however they're available only to the user who created them and only within the exploration where they were created. Sharing an exploration to the property has no effect on the segments included in that exploration.

  1. In Explore, select an existing exploration or create a new one. Learn more about Explorations.
    Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Analyst or above to create an exploration.
  2. Click the plus symbol beside “Segments”.

You'll 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.

Create a property level segment

Property level segments can only be created and edited by users with Editor or above permissions. Once created, property level segments are available for all users of that property to use in their explorations.

  1. In your exploration report, click the plus symbol beside “Segments”.
  2. Click Create a new segment.
  3. Select the scope of the segment (user, session, or event) or one of the suggested segments.
  4. Create the segment with the condition builder and click Save to Property.

A property level segment can also be created by navigating to Admin > Data Display > Segments and clicking on New segment.

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 such as 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 (for example, 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:
    • Age is one of 18-24 or 25-34
    • 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 Apply or Save to property.
The Apply and Save to property buttons are 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 and 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 or 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 or 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 a reasonable time period in which the whole sequence must occur such as a few days, for it to include user traffic.

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, to exclude groups based on multiple conditions - you should use an OR statement.

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.
  • You can save up to 50 segments per standard property, or up to 200 segments per 360 property.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
12304661622448060163
true
Search Help Center
true
true
true
true
true
69256
true
false