A segment is a subset of your Analytics data. 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.
Create a segment
To open the segment builder:
- Sign in to Google Analytics.
- Navigate to your property.
- In the bottom left, click Analysis Analysis Hub.
- Select an existing analysis or create a new one. Show me how..
- 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.
- Use 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 custom segment
- 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).
- Enter a name and description for the segment. This lets you identify the segment elsewhere in Analytics.
- 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
- You can also create segments based on a sequence of steps taken by the user. See below for more information about conditions and sequences.
- In the upper right, click SAVE.
Create 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 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 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.
Sessions 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 and sequences
Conditions tell Analytics what data to include in or exclude from the segment. Sequences are conditions that must occur in a given order. To define a condition or sequence, you select a dimension, metric, or event 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."
Types of conditions
You can create conditions that evaluate dimensions, metrics, or events.
Dimension conditions let you build segments based on evaluating dimension values related to your users, such as demographics, geography, and technology.
Metric conditions are currently limited to evaluating your users' LTV.
Event conditions allow you to 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 logging events in this Firebase article).
You can create conditions for event segments based on the event_count parameter. This can optionally include a time window. This lets you filter the segments for events that exceed a certain threshold. Note that currently, you can only filter using the greater than operator (>).
Conditions that use the event_count parameter can't use any other parameters, and vice versa.
Before you can use custom parameters, you must register them for custom-parameter reporting. You can do this in the Firebase console, or in the segment builder using the Register option when specifying the custom parameter.
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 in Firebase are calculated.
Conditions for event segments must all occur within the same event.
By default, User segments with metric-based conditions include users in the segment if they meet the condition at least once in the specified time period for the analysis.
Apply a time window: You can override this behavior by selecting the in any N day period option. When you select this option, users will be included in the segment if they meet the condition within a specified period in the past.
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, even if they don't currently satisfy the condition criteria.
Here's an example:
Let's say one of your users visited Brazil in 2014 but is now currently in a different location. A segment with a condition for "Country = Brazil" 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.
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 evaluate other conditions using a different scope. 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.
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:
- Step 1: first_open
- Step 2: in_app_purchase.
Optionally, you can require that the steps be completed within a specific time period:
- On the right, click Time Constraint.
- 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.
By default, the conditions you define are "include" conditions: they define the users or events you want to include in your analysis. Click ADD EXCLUDE GROUP to create a condition that excludes users or events.
Select Temporarily exclude users when to exclude users from the segment during periods 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 only one exclude group.
Differences between segments in Web vs. App + Web properties
You can use segments in both Web and App + Web 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 App + Web properties, segments are only available in Analysis. (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 Analysis, segments can be based on users, events, or sessions.
Finally, segments in Web properties are subject to certain limits that don't apply in App + Web properties. Learn more about segments in Web properties.
Limits of the segment builder
- You can create up to 10 segments per analysis.
- You can apply up to four segments to an individual analysis technique at one time.
- Dimension segments are limited to user dimensions.
- Segment data is sampled. The sample size used is 100,000,000 rows.