Sessions and segments in GA4

Now that Universal Analytics will be officially shut down in 2023, most of its users will have to migrate to Google’s newer version GA4. However, there are noticeable differences between the two setups. For starters, you won’t see the different hit types that you were accustomed to in UA’s version (a hit could be an event, social interaction, transaction, etc.). In GA4, it is all event-based. This article will give you an overview on how sessions work in GA4, an in-depth look at segments and how to create them.

How are GA4 sessions calculated?

A session is technically a collection of events that occur in a specific timeframe.

It is interesting to note that UA and GA4 sessions are not tracked the same way and thus are not fully comparable when doing a migration. It is important to understand the difference for analytical purposes: When you migrate to the newer version and want to compare the numbers to confirm a successful migration, you will notice that GA4 recorded sessions will be lower than those recorded in UA. And we will explore why this is by looking at this example below:

Let’s say you landed on our website after a Google search. Then 10 minutes later, you see a kemb ad on Facebook and are redirected to a different page on our website. And finally, after having read the page, you kept it open but were inactive for 60 minutes; you then refresh the page or go to another page on the website.

Well, in Universal Analytics, many factors can start a new session, like a traffic source change, reaching midnight, and inactivity for 30 minutes (default session timeout period, which can be adjusted).
So here is how the sessions of the example above will be counted in UA:

  • One session will be counted for the first pageview

  • One session will be counted for the pageview from Facebook Ads (because the source that got you to the website has changed)

  • One session will be counted for the last pageview because the time difference between activities exceeded the default limit of 30 mins

So in total Universal Analytics will count 3 sessions for the example above.

However, in GA4, the only factor that affects a session is the timeout period.
By default it’s 30 minutes, but this can be modified in the admin settings of your GA4 account (Just go to Admin, in your property select Data streams —> More tagging settings —> Adjust session timeout)

Following the same example above, here’s now how GA4 will count the sessions:

  • One session will be counted for the first pageview

  • The second pageview will be counted as an event within the same session because, as previously mentioned, only the timeout period affects the count. And since the time elapsed between the two pageviews is less than 30 minutes it is still recorded as one session. This session is attributed to Google search and will not reflect an interaction with facebook ads.

  • One session will be counted for the last pageview

So, in total, Google Analytics 4 will count two sessions.

Note to remember

When you are auditing your migration process, comparing the number of sessions between UA and GA4 shouldn’t be a definitive indicator of migration success. Rather, you could focus on other metrics like pageviews, events, and conversions. Usually the difference between metrics should not ideally exceed 20%

Now, Let’s dive in a little bit deeper.

Understanding Segments

You need to understand how sessions are calculated differently between the two versions of Analytics, to be able to have a firm grip on how to configure segments when migrating to GA4.
Segments allow you to choose a certain group of visitors to your website and analyse their behaviour. In GA4, segments are only available in explorations. However you can build an audience out of a segment and use it in GA4 reports and in Google Ads, if you have a linked account. This is regularly done to reach engaged users in remarketing.
User segments and session segments can be configured in both versions, however event-based segments were added in GA4. When working with segments, you need to ask the right questions. This might sound very generic, however if you don’t know what you really want to track, this might lead to some confusion when setting up different types of segments. Take the time to investigate what it is exactly that you want to keep an eye on.

Let’s look at the following example of a user completing the following sessions: 

Say a user lands on your page, then a few minutes later checks another page and finally proceeds to click on a certain product.

Then, the same user returns a couple of hours later, views the item, adds it to his cart and begins his checkout process.

Assume you want to track all the users of your website who decided to begin a checkout process at some point. This would have to be configured as a user segment. So following the example above, the two sessions above alongside ALL the events that occurred inside those sessions would be tracked. Remember, you are tracking a user here which is a uniquely identified visitor of your website. You are asking GA4 to create a segment of people who have initiated a checkout at some point. That means if a user initiated just one checkout in the timeframe you chose to do your analysis in, all the sessions and events they made on your website will be recorded.

If you would like to track the sessions where a checkout was initiated then you would create a session segment. Following up on the example above, only session 2 (along with all the events in the session) will be recorded. In session 1, we don’t see any checkout event and therefore nothing of that session will be recorded in your segment. The segment will thus contain the same individual, as they did a checkout, however will contain only events from what they did in a session with that type of event and not all their sessions.

However if you would like to just track the event itself, then you opt for an event segment. And this segment will only contain this particular event.

Create segments

Head to the explore section in your GA4 interface, choose any exploration you would like to work on and let’s get started. 

In the variable column to the left, first choose the timeframe. Then, in the segments section, click the + icon 

Explorations- Segments

You will be redirected to the following screen.

Here you can see the three types of segments we discussed earlier. To follow up on our example, we will create the segment of users who have initiated a checkout

Custom segments 

After clicking on the user segment, you will be redirected to this window. Let’s discuss the highlighted fields in the picture below.

Create Segment- User interface

  • We start with naming our segment. Always make sure to have a clear naming convention not to confuse multiple segments.

  •  When you click on this dropdown item, you will find this important field called Condition scoping. This is the scope under which your segment will be tracked. By default, when you select a user segment, it will be tracked across all sessions. This makes sense. As explained earlier, we are tracking users who have initiated a checkout at some point. This means that we track the users across all the sessions they have made. Similarly, you can expect that the default scopes of session and event segments will be “within the same session”, and “within same event” respectively.

  • This is the field where you specify the conditions that need to be met in order to place the users you want to track in that segment. For user segments, GA4 will ask you to “include users when” they perform the condition you choose. Similarly for session and event segments, GA4 will ask you to “include sessions when” and “include events when” respectively.

    Important to note: You notice the “begin_checkout” event. We specify that we want only the users who have completed this step. However, GA4 is not able to automatically detect E-commerce related events. This event was manually configured, pushed to the data layer, and forwarded to GA4. We will not dive into the technical details in this article, however If you’d like to know more about how to create events with GA4 (we insert here a link that leads to the events article)

  • Remember that segments are only available in explorations. However they can be used to create audiences. And you can do that by just ticking the “Build an audience” box.

    Important to note: Audiences can be used in all GA4 reports (unlike segments) by comparing different audiences you have configured to analyse the behaviour they show on your website. Moreover, if you have a linked Google Ads account, your GA4 audience will be immediately forwarded there, where it can be used for marketing purposes. Be aware that audiences are not retroactive (unlike segments) which means that audiences will only be tracked after they have been configured.

And finally, after you set up all the necessary fields, press “Save and Apply”.

Putting words into action

For the purposes of this example, we have just created a user segment. However, we want to show you how the three segments would differ in real practice. In the free form exploration below, we have configured the three segments we discussed, and created a table to see how the number of events change from one segment to the other.

Final notes on the results we have:

  • We notice that there’s a significant difference in the number of pageview, user engagement, and other events between the first and second segments. This is expected. It makes sense that if I create a segment that tracks users across all sessions, it will contain all the events of those users, contrary to what we see in the session segments that will only contain the events of the sessions where a checkout initiation was done.

  • Even though the last segment contains mostly zeros, this is what we expect. The last segment only tracks the begin_checkout event so it is expected that we will not see any other events recorded in the segment.

We did not dive into the interface components of this exploration. This was meant only to show you the difference between the 3 segments, and give you a better understanding of the outcome of each one.

We hope this article will help you a little further in understanding Google Analytics 4 and provide some more clarity on segments and how to set them up. The definite replacement will already take place in the summer of 2023. Take this opportunity to get familiar with the new setup. We will be happy to support you with any questions and carry out the migration for you.

Latest Posts

Are you facing similar challenges?

We would be happy to discuss ways we can best assist you. Do not hesitate to book a free consultation at a date of your choice!