January 1, 2022
Google Analytics 4 Segments: The Guide
Segments are a great way to slice and dice your data to get better insights. Instead of looking at aggregated numbers (like total users or all conversions), you should drill down in your reports to find patterns, identify the most valuable users.
In Universal Analytics, this was done with Advanced Segments. In GA4, segments are also available, but they are different in some parts.
In this blog post, I will explain Google Analytics 4 segments, what they are, where/how can you use them, and will share several examples.
Table of Contents
+ Show table of contents +
- What are segments?
- How to create segments?
- 3 types of segments
- Google Analytics 4 Segment Builder
- Condition scoping
- Sequence segments in Google Analytics 4
- Excluding data in segments
- Suggested segments
- Different segment types = different features/content
- Differences between Universal Analytics and GA4 segments
- Ideas for Google Analytics 4 segments
- Final words
If you prefer video content, take a look at this tutorial from my Youtube channel.
What are segments?
A segment is a subset (read “a portion”) of data that you can analyze. Instead of analyzing the data coming from all users, you might want to compare how all users compare to the traffic that is coming from the US.
Why is that useful? Because you might identify that for your business, the US traffic is more valuable and generates the largest part of your revenue. Consequently, you might want to target your marketing towards that audience (if you aren’t already doing that).
Other examples of fairly basic segments could be mobile traffic, desktop traffic, segment based on gender, age, level of engagement, etc.
How to create segments?
In Universal Analytics, you could find segments in most of the standard and custom reports. At the top of the interface, you could add additional segments and compare them while jumping between various reports.
As you navigate from one report to another, the segments persist (which is super useful and convenient).
In Google Analytics 4, things are different. Even though you can technically compare different data subsets (by using comparisons), segments that I explain in this blog post can be created/used only in exploration reports, such as Free Form, Funnel Explorations, etc.
To do that, go to Explore (on the left sidebar) and then choose Free Form. Segments can also be used in other exploration techniques, but this time, let’s focus on Free Form. By the way, if you want to learn more about how to work with Free Form Explorations, read this guide.
On the left column (Variables) you will find all the components/items that you can use in the analysis, segments, dimensions, metrics, and more. The default list is not very comprehensive but that does not mean you are limited. If you want, you can create and add more segments by clicking the plus icon.
You can either build segments from scratch (by choosing Custom Segments) or you can choose one of the suggested segments. You can learn more about suggested segments in this chapter.
First, let’s select any of the custom segments and I will do a quick overview of the interface. Later in this blog post, I will explain what are the differences between the 3 types of segments.
In my case, I clicked the User Segment. This will open the segment builder. It is split into two parts. On the left side, you will be entering the conditions of your segment (which users/events/sessions to include/exclude).
On the right side, you will see the Summary (preview of how many users/sessions/events will be included in this segment). Also, you can choose to build an audience based on this segment.
When you’re done editing the segment, you can click Save and Apply. Later in this blog post, I will focus more on each feature but before that, first, we need to understand the difference between each type of segment.
3 types of segments
When you start creating a new custom segment, you get 3 options:
In Universal Analytics, there were two options (User and Session segments). Now (finally!) we have the 3rd option (that Adobe Analytics users were bragging about for a long time), Event Segments.
User segment is a segment that will include all events of users if they meet certain criteria.
Session segment will include all events but only of those sessions that match the criteria.
Event segment will show only particular events that meet the criteria.
Sounds confusing? Let me illustrate this.
Let’s say that we have a user who did two sessions on our website. The first session consisted of two page_view events and one click. The second session: one page_view, one add_to_cart, one checkout.
Let’s create a User segment where a user did add_to_cart (or in other words, added at least one product to a cart). What kind of data will be included in the segment? All six events. Why? Because this user meets the requirement of at least one add_to_cart event. This means that the user segment will include all events of that user in your selected date range.
Now, let’s move to session segments. Let’s say that I want to create a session segment where the event name is add_to_cart. In other words, “show data of all sessions where at least one add_to_cart event occurred“. What kind of data will the segment contain?
All events of the 2nd session because that session had one add_to_cart event. The first session didn’t.
Finally, let’s look at the event segment. If you create a segment where the event name is add_to_cart, it means that only those events that match the criteria will be included. In the session segment, we still get other events like page_view or checkout (because they are a part of the 2nd session). In the event segment, we would get only one event, add_to_cart. No other event will be included.
I hope this made things clearer:
- User segments include all data of users that match the criteria
- Session segments include data of particular sessions that meet the criteria
- Event segments include only particular events that meet the criteria
And now, let’s go back to the segment builder.
Google Analytics 4 Segment Builder
In the segment builder, you can configure conditions that will include certain users, sessions, or events. You can also add a set of conditions to exclude certain data. Data exclusion is explained in greater detail here.
When you add new conditions, they can be connected with AND, OR, or condition groups.
To add new conditions, you can click on Add new condition and then start looking for dimensions that you are interested in.
Just start typing what you want to find and then the search will present organized results based on their type.
Want to include users who have done a certain event? Just enter the event name.
Looking for users who have completed two events (regardless of their order)? Then add another condition by clicking the AND button.
Now you have just learned how to combine two conditions with AND. If you are looking for users who have visited one page or another, enter the first condition, click OR, and enter the second condition.
Voilà! You now have used the OR operator too.
But what about the condition groups? What is the difference between the condition groups and using the AND?
In general, they are fairly similar. If you have one condition group with two conditions and they are connected with AND, this is the same thing as if you had two separate condition groups with just a single condition.
However, condition groups are useful if you want to have different scopes in separate condition groups. Enter Condition Scoping.
Condition scoping allows you set different scopes in separate condition groups. And it can be managed by clicking this icon in each condition group.
The available options here will differ depending on the segment type that you have chosen). Possible options are:
- Across all sessions
- Within the same session
- Within the same event
If you choose Across all sessions and you have multiple conditions in the same condition group, then it does not matter whether conditions A and B happened in the same session or the same event. If condition A happened in session 1 while condition B in session 2, the user’s data will still be included in the segment. Conditions under this scope must be met during the lifetime of the user.
If you choose within the same session, it means that conditions A and condition B must happen within the same session (even if you are creating a user segment).
If you choose the within the same event scope, then all conditions in the same condition group must be met in a single event.
Confusing? That’s ok. The best way to explain condition scoping is by showing an example. Let’s say that we want to see data of all users who match the following criteria:
- Subscribed to a newsletter at any time in the past (event name: generate_lead)
- Also, at any point in the past saw a particular promotion (event name: view_promotion) and made a purchase (event name purchase) during the same session.
To create this kind of segment, we would need to create two condition groups. The first one would look like this:
The scope of this condition group is set to Across all sessions. We don’t care whether the generate_lead event happened during the same session with the purchase or not.
The 2nd condition group would look like this. I added it by clicking “Add condition group”.
Here we are using sequences because I want to see those users who have purchased after seeing a particular promotion. Let’s take a closer look.
Sequence segments in Google Analytics 4
If you are familiar with advanced segments in Universal Analytics, you probably already remember the possibility to include users or sessions where events occur in a particular order.
The same thing is possible in GA4 as well, however, only in user segments (while in UA, it was possible to use sequences in session segments too).
If you have a segment like this (view_promotion and purchase)…
…it will show data from all users who have seen at least one promotion and made a purchase. But the order does not matter here. If a visitor first made a purchase and only later viewed a promotion, that user would still be included in this segment.
With sequence segment, we can specifically tell GA4 that we are interested only if a purchase happens after the view_promotion. To do that, click Add sequence in the condition group.
Then remove the initial Condition group (if you only want to use sequence in the segment). Click the trash icon.
Now create all steps. Explore all the features based on what you have already learned in this blog post. However, I have several additional things to mention.
You can set the scope for the entire sequence. Or if it makes sense to you, you can set different scopes on every sequence step.
Another cool thing is to include time constraints in your sequences (for example, show me users who viewed promotion and then purchase within the next 24 hours). This is a very welcome addition that was not available in Universal Analytics.
To add new steps, click the Add Step.
Excluding data in segments
All condition groups are designed to include data. But what if you want to exclude something (for example users who have already purchased from you)? Use exclusion groups.
To add it, click Add group to exclude and a new group (with red color) will appear. There is one (fairly mysterious) setting called Temporarily exclude vs Permanently exclude. I am still investigating this because Google’s documentation is vague on this and I still have too many questions.
From what I’ve learned so far, the temporary exclusion might be a good option if you create an audience from this segment. Let’s say that you have an audience with a 30-day membership. You want to include people who have visited a particular page on your site but you want to exclude those who recently purchased. That way, your segment could look like this.
From what I understand, if a visitor purchased in the last 30 days, it will be temporarily excluded from the audience. But once 30 days (after the last purchase) pass, the visitor will reenter the audience (once he/she revisits the page used in the segment’s settings). This is a great use case for retargeting campaigns where you can start showing ads to those who haven’t purchased in a while.
But again, some parts of this feature are still unclear to me. Hopefully, I will update this part once I learn more.
The other example could be this. You have a visitor who made a purchase 60 days ago. And you create a segment that excludes people who bought something.
You have now applied the segment to your exploration report and you are now analyzing the data of the last 30 days. Remember, that user purchased 60 days ago.
If your exclusion group uses “Temporarily exclude”, then the visitor will be included in your current analysis. Why? Because the purchase happened 60 days ago and you are analyzing last 30 days.
If your exclusion group uses “Permanently exclude”, then the user will not be included in your current analysis. Why? Because even though you analyze the last 30 days, the user has made a purchase at some point in the past, hence the “permanent exclusion”.
As I have said before, there are still some things that are unclear to me. For example, how does the permanent exclusion work with event segments? Does it mean that if at any point in the past the event contained a certain parameter, it will not be included in the segment? This is still unclear and I did not have a chance to investigate this deeper. If you know something, feel free to let me know in the comments.
In the previous chapters, we were working with custom segments. Now, let’s take a look at the suggested segments.
Currently, there are three types of suggested segments:
If you choose one of them, they will either prefill some conditions in your segment or their layout will look different. For example, if you select Purchasers, it will add to conditions to the segment:
- Event is in_app_purchase
- or event is ecommerce_purchase (which is a bug knowing that the recommended event for GA4 e-commerce purchase tracking is just “purchase”). If you see purchase instead, it means that the bug was eventually fixed.
If you choose one of the segments in the Templates tab, the layout of the segment builder will change. You will get a bunch of predefined dimensions that you can use (or leave them blank). Here’s an example of the Demographics template.
You cannot add additional dimensions/conditions. But in general, you can also use Custom user segments to build the same segments (but it might require a bit more time to select/configure every condition).
The last group of suggested segments (as of the moment of writing this blog post) is Predictive. These are using the machine learning capabilities of GA4. Based on your current data, GA4 tries to predict which users will likely convert soon (or churn).
But this is not for every business. You need to have a solid volume of conversions in order to benefit from this. For example, according to Google, you would need to have at least 1000 users who have purchased over a 7-day period in the last 28 days. These numbers are not possible for small businesses.
Different segment types = different features/content
In the previous chapter, I mentioned that the content/layout of the segment builder differs depending on what kind of segment do you choose. The demographics segment will differ from the Acquisition or Purchasers segment.
But these are not the only differences. Some features are available only in certain segments. For example:
- Sequences (at the moment of writing this blog post) are available only in the User segment
- The availability of condition scopes also differs. But this is logical. User segments support Across all sessions, within the same session, and within the same event scopes. Session segments support within the same session and within the same event scopes. Naturally, the event segment supports only within the same event.
Differences between Universal Analytics and GA4 segments
In several places of this blog post, I have compared Universal Analytics segments vs Google Analytics 4 segments. In this chapter, let’s sum everything up (and add new details).
#1. In Universal Analytics segments are applied to almost all reports you are viewing (except reports like Multi-channel funnels). In GA4, segments apply only to a single exploration. An exploration can contain multiple tabs (e.g. one with funnel analysis, the other one with free form exploration), so the segment applies to all tabs of the single exploration. But that’s about it. If you want to use the same segment in a completely different exploration, you will have to manually create that segment once again.
#2. You can build audiences from segments in GA4. You can also build retargeting audiences from segments in Universal Analytics.
#3. In Universal Analytics, you can create segment and/or user segments. GA4 allows you to create user, session, and event segments.
#4. There are some limits in Universal Analytics that do not apply to GA4 properties.
#5. In both versions of GA, segments are retroactive. When you create one, it shows filtered data that you have already collected.
Ideas for Google Analytics 4 segments
In this section, I wanted to give you several ideas of what kind of segments can you benefit from. Maybe this will inspire some new analysis.
Users who made more than 5 page_view events. You could create a segment for that, then build an audience, and then show ads to it.
Exclude users who have logged in. If you are analyzing conversions, you should exclude those who have already converted a long time ago. Most likely, they are coming back to your site to log in to their account. By excluding them, you will have more accurate data of visitors who can potentially convert in the future.
Technology segments (e.g. mobile vs desktop). Create two separate segments and then compare how they perform conversion-or-revenue-wise.
Users who abandoned a cart. Create a segment where the event is add_to_cart (to have this event, you would need to implement GA4 e-commerce tracking. I teach how to do it in very great detail here) and exclude users who have purchased. Now you can use this segment, say, in the Funnel report to see where they fail in the checkout process.
Google Analytics 4 segments: Final words
Segmentation is a powerful way to slice your data and analyze a particular subset of it. In Universal Analytics, you could apply the segment to almost any custom or standard report in GA.
In GA4, you are limited only to explorations. If you want to apply some filters to standard reports, you would have to use Comparisons. But they are way less powerful/flexible compared to segments. For example, you cannot create sequences in comparisons.
Nevertheless, GA4 introduced some very welcome features like event segments and time constraints in sequences.