







In Analytics, Segmentation equals success - Justin Cutroni





If there is anything that is most important and at the same time most confusing in Google Analytics, without any doubt it's Advanced Segments.





In this post, you will learn about the Google analytics data model and how changing the scopes ( User, session & Hits) of the segments can dramatically change the meaning of the segment and screw your analysis if you don't pay close attention to it. We will look at lots of examples and illustrate it visually to make your understanding more concrete.





Post you might also like -

1. The Ultimate guide to Remarketing with Google analytics.





Let's get started.









1. Google analytics Data model -









What is Users, Sessions & Hits and How they are organized inside Google Analytics?





A. Hits -

On a basic level, a Hit is simply a pageview but it can also be an Event or a Custom Variable (if the scope is set to "Hit level").





As soon as the first page of a website/App starts to load, the Javascript code of your web analytics tool sends a hit to it's server. And as you browse through the website, every time you interact with it like see a product page, add something to cart, play a video, purchase something etc, the javascript code keep sending these hits to the analytics server.





So during your single visit to a website, a lots of hits are sent to the web analytics tool.





In the above figure, it's the light blue boxes.





B. Sessions/visits -

A session is simply a collection of all these Hits from the same user from the start and exit of the website or leaving the website open for 29 minutes of inactivity.





In the figure, it's the Green Boxes.





C. Users/visitors -

Users are just an anonymous cookies that the analytics tool sets when the first time a person visited a website. Then this cookie or identifier persists until it expires or gets deleted.





This identifier is sent to the analytics tool with every hit of data. Then the analytics tool group these hits into sessions and finally into Users using the identifier sent with the hits.





Important Things to Remember -





1. The Above Google analytics data model pic.

2. Second thing to remember is that A user can have multiple sessions and each sessions can have multiple hits. This is what the above pic is telling.





Now, let's see how things started to get messed up once we start creating segments.













2. Conditions in Advanced Segments -





A. AND Conditions -





1. One of the most common thing that People wanted to know - the sessions/visits where a user came from Google or Facebook or any other sources and what are they doing once they visited the website.





How do you create this segment in Google analytics -













1. First, you will click on traffic source.

2. Then filter by Sessions at the top.

3. You will then select Source > Exactly matches > Google





If you look at the right of the above pic, you can see the summary of this segment. How many users and sessions and their percentage out of the total are included in this segment and also all the conditions that you have applied at the bottom.





You can see that there are -





Users - 9,726

Sessions - 11,092





This is a Session Scoped segment as you can see at the top I have filtered by Session for this segment.





But what If I changed it to a User scoped segment ?









To do that, all I have to do is change the filter from sessions to Users at the top and everything else will be same.





But, Now if you look at the Summary box in the above pic -





Users - 9,726

Sessions - 11,873





You can see that the number of users is same as we saw earlier but the number of sessions has increased from 11,092 to 11,873





So, What is going on here?

The reason for this is when the segment was Session Scoped, Goggle analytics is only looking for all the sessions/visits where a user came from Google. In this case, 2 sessions and 3 hits from the 1st user and one session and one hit from the 2nd user.









But when the segment is User Scoped, Google Analytics is looking for all the users who have at least one session from Google during this time frame, So it selected both the users but it also selected the other sessions of the 1st and 2nd user even it wasn't from Google because It is a User Scoped segment, we are looking at the user level that's why the number of sessions get increased.





So, as you can see that depending upon what scope you choose in your segment, you can get a very different result.









So, always visualize the Google analytics data model pic when creating segments, it will help you to understand what is actually happening.





You can also create this exact same segment in the Advanced section.









just click on the conditions in the Advanced section in the left and select the sessions at the top.





Now, you can save this segment and apply on almost every report in your google analytics.













Now, you can understand how this segment of users are behaving compare to the other segments.

At a time, you can apply 4 segments in Google Analytics.





2. Second type of most common question people have - sessions/visits where a user came from a particular source/medium but also visited a particular page in the same session.





As you can see that it is a session scoped segment, so Google analytics will look for all the sessions where medium was organic and the page title contains Accessories.





So every time someone will come from organic and goes to this page, they will be included in this segment.





Users -1,319

Sessions - 1,385





But let's say you want to know about users who did both these two things but not necessarily in the same session.





So, you might just want to turn this segment into a user scoped segment. Let's see what happens if we do that.









Users - 1,319

Sessions - 1,862





You can see that the number of users is same but the number of sessions get increased as we saw earlier.





What this segment is actually doing is it is looking for all the users where the medium was organic and the page title was Accessories simultaneously.





But this is not we are actually trying to do.





We want to know about users who satisfied both these conditions but not necessarily in the same session.





To do that, we will add another separate filter for the second condition.

You can see that I have created two separate filters for each conditions and applied the scope at the user level.





Users -1,387

Sessions - 2,084

Now, you can see that both the users and sessions numbers has increased and the reason for this is that now we are looking for users who came from organic medium at some point and at some another point they went to a page containing Accessories but not necessarily in the same session.





Let's illustrate this visually.

Session scope segment -

If we apply a session scoped filter and both these conditions happen in the same session, then the number of users and sessions will be -





Users - 2 (1st user and the 2nd one)

sessions - 2





User scope segment -

If we apply a user scoped filter and look for both these conditions happen in the same session, then the number of users and sessions will be -





Users - 2( 1st and 2nd)

sessions - 6





User scope segment but conditions met not necessarily in the same session -





Users - 3 (all the users)

sessions - 9





Let's look at one more example to understand how session and User scoped segments are get evaluated in Google analytics.













Here, we want to include all the sessions where a user visited the Nest-USA page as well as Bags page during the same session.





Users - 180

Sessions - 182





Now let's see what happened if we try to change it to a user scoped segment.





users - 0

sessions - 0





The reason this happened because when we apply a session scoped segment, Google analytics evaluates over all of the hits in that session but when we apply a segment on User level, Google analytics looks for individual hits where all of the conditions are true. So, in this example there is no single hit where the page title simultaneously matches Nest_USA as well as Bags.





So the question is why does the analytics team did this?





The reason is sometimes we might want to know about users who viewed the Nest-USA page and bought a product that happens to be a Nest product. If they don't do it than a user might have seen the Nest-USA page but bought a completely different product . So, this allows us to say no I want these two to happen in the same hit and only give me users who satisfy this conditions.









B. OR conditions -





We can also apply OR conditions in advanced segments.





This example basically says give me all the sessions of users where the medium was either referral or Organic or both.





Users - 13, 169

sessions - 15,804









If we look it visually, we will have -

users -2

sessions - 3





And if we turned this to a User scoped segment, then we have









Users - 13,169

Sessions - 16,476





And as we saw earlier, the number of users will be same but the number of sessions will increase because there might be some sessions which are not from either referral and organic but will be included because we are looking at a user level.





C. Exclude conditions -





Like include conditions, we can also have exclude conditions.





In this example, we are saying that exclude every session where a user saw the Nest-USA page as well as the Bags page in the same session.





Users - 16,823

sessions - 20,973

So, these number are indicating the users and sessions where a user didn't saw the Nest_USA and Bags page in the same session because we are applying an Exclude filter that is why the number are higher. These numbers are what is left after throwing out all the sessions and users who saw these two pages during the same session.





D. Sequence segments -





Sequence segments are very helpful when the order of hits matters or the way it happens matters.





Suppose, you are interested to know, in a session how many users added a product to the cart, started the checkout process but didn't completed the purchase. When you want to analyze these kinds of process, sequence segments are best. let's see how to do that.

















Few things to notice, you can see that I have chosen a session scoped segment because I want to analyze these things to happens during a single session. Second I have chosen "Any user Interaction" at the top right. you also have an option for First user interaction(see above). First user interaction means that a user did a particular thing first before anything else happen. And between step1 and step 2, I have chosen "is followed by", you also have an option for "Is immediately followed by" means I want these two steps to happens immediately one after another, nothing in between them.

Let's see what am I trying to do step by step.









In the step 1, I am trying to include all the sessions in which a user added a product to the cart. With "Any user interaction" I am trying to say that users come to the website via any page or channel, they browse the website, like any item and then added it to the cart.





Before the second step, I am using " is followed by " because there are chances that after adding a product to the cart, the user might did little bit of browsing or anything else. Here I am trying to be less restrictive, but it totally depends what are you trying to do.





Then in the second step the checkout process started and in the 3rd step I used transactions per session less than 1, means the user did not buy the product.





So, you can see that there are 323 sessions where a user added something to the cart, started the checkout process but didn't completed the purchase.





Many customers didn't purchase products in a single sessions. so, It could happen that these above events takes place in multiple sessions. So if you are interested in this then you will use the user scoped segment by simply changing the sessions to user at the top.













E. Recap ( users, sessions and hits ) -





Let's look at one last time how advanced segments works in google analytics to clear out any confusions between users, sessions and hits.





If you look closely, you can see that all these 3 users have purchased products which worth $200. Somebody spent it in a single session and somebody in a multiple session. Let's see how thing will change depending upon the scope of the segment..





1. User scoped segment -





Here, I am saying give me all the users who spent more than or equal to $100 on my website. It will give me all the 3 users and all of their sessions and hits because it's a user scoped segment. Totally fair.





2. Session scoped segment -





Here I am saying, give me all the sessions where a user spent more than or equal to $100. So if we look at pic,





This segment will only include user 1 and user 2 and completely ignores the 3rd user :) The reason is there isn't a single session where this user spend >= $100 even he/she spent more than this in multiple sessions. Depending upon what scope you use, you will get very different results. So, only user 1 and user 2 will included in the segment with 1 session of user 1 and two sessions of user 2.





3. Hit scoped segment -













Here, i am saying give me all the sessions where in a single hit the amount of money spent by a user is more than or equal to $100.





That mean this segment will only include the 2nd user :) both the 1st and the 3rd users will be thrown out. Because these two users doesn't have a session where in a single hit they spend >= $100.





F***ing crazy right?









F. So what is the solution? -





The scope of the segment you will choose is completely depends upon what are you trying to do. But if you could, use this way -





First go for the User scoped because as we see in our previous example, using user scoped segment selects all 3 high-value users. It doesn't matter if they spent it on a single session or in a multiple session, $200 is still $200. After user, go for sessions and at last hits. Again it totally depends on the thing that you are trying to accomplish.





Always remember, this GA data model when creating segments, It will guide you and help you to recognize your mistakes.









3. What to do next ? -





1. In the next post on advanced segments, I will actually build and explain some of the most useful advanced segments in google analytics. So, if you want to read as soon as it gets published then click here to subscribe to our blog or use the subscribe form below.











