User, Session, and Hit Scopes
The three most common scopes in Google Analytics: user, session, and hit. There is also product scope but is not a topic relevant to this article. These scopes allow us to sum and aggregate metrics according to our reporting needs.
Your boss asks, “How many users clicked on a button in the last week?”
There are two scopes being requested: user and hit. The sum() of users in the given time requires that there be a single database record for users. For users that “clicked on a button” we would return the sum() of GA event hits that fired on the button click.
If we were to answer this with pseudo SQL code then the query would look like this:
SELECT COUNT(DISTINCT ga.user_ID) as Users, SUM(ga.hit_eventcategory) as Button_Clicks FROM GoogleAnalytics as ga WHERE ga.date BETWEEN "2017-01-01" AND "2017-01-07" AND ga.hit_eventcategory = "Button Click"
GA counted 15 unique user IDs in the user scope, and within the hit scope of those users GA summed 231 total events where the category was “Button Click.” Blending scopes is common when using this data to answer business questions. Small errors in the scope can cascade into large discrepancies, so be on the lookout and mind your scopes!
The concept of Joe as a user is important and it is equally important that we preserve the integrity of Joe. There are complications: different devices have different cookie IDs, so Joe could be fragmented across your user data. The cookie could be destroyed or the domain becomes an issue, either way solving for those problems are for a different topic! The main take away is to preserve Joe by being mindful of the client ID and _ga cookies.
When we measure Joe in GA, we’re measuring counts and sums of Joe and his behaviors, in aggregate. Joe’s behavior is counted, summed, and pivoted using his cookie ID, alongside all other users in the database.
We will now review session scope. This scope represents a collection of behaviors that occur within a given criteria. We can expand on that criteria in a moment but, for now, focus on the session aggregation:
Joe, the User, has visited our site three times. He visited once on Monday and twice on Tuesday. Those visits created three session IDs in Google Analytics. If I were to ask Google how many visits or sessions occurred in a period of time, Google would count the number of unique session IDs that exist in the database for that time period.
Session scope is subject to corruption. A session could be fragmented, leading to inflated session metrics.You can imagine a series of cascading scope errors that lead to large discrepancies between reality and what is showing up in your GA reports! We’re going to examine one of those common corruption problems in a moment, but we’ll first review the final scope.
Finally, we have our hit scope. This scope contains the clickstream of behaviors, or hits, that occur on our website. There are a variety of hit types in GA: pageview, event, transaction, social, timing, and error. Primarily, pageview and events are what we measure in GA.
With pageview and event hits in our clickstream, we have good visibility into user behaviors on the website. The hits are generating metrics in GA data and they can be summed or averaged using any or all of the three scopes available to us in the database.
The clickstream of hits give us insight into the flow of behaviors across the site, and how those behaviors can change over time. This insight is possible in large part due to the scopes in GA and how they are used to aggregate and calculate metrics in the reports. We’re able to:
- Aggregate behaviors individually
- Group those hits into sessions, and
- Link that back to a single user.
That allows us to answer complex questions like, “On average, how many visits occur before mobile users targeted by my email campaign convert an abandoned-cart order?”
We want your data to be as actionable as possible in Google Analytics. We would love to be the resource to help you and your team along the way. Please reach out to us to learn more. Stay in touch on Twitter (@Adswerveinc) and let us know about your thoughts on scope in Google Analytics!