This document will familiarize you with the Google Analytics user model and the fundamentals of creating segments.
Google Analytics User Model
Reviewing the Google Analytics User Model first will help you conceptualize how segments work.There are three major components to the Google Analytics user model:
- Users — At the basic level you have users.
- Sessions — A user arrives at and interacts with your property. All of these user interactions are grouped into what is referred to as a session.
- Hit — During a session the user interacts with your property. Each interaction is referred to as a Hit. Example hits include pageviews, events, transactions, etc.
Segments Examples
To create a segment you define the condition and the dimensions and metrics values you’re interested.For each example below there is a segment description, the equivalent API Syntax for the segment parameter, and a user model representation.
Conditions
Use conditions to select users or sessions based on dimensions and metrics values.Dimensions
Select users or sessions based on dimension values.Users
Select users who came from Canada.users::condition::ga:country==CanadaSessions
Select sessions that came from Canada.sessions::condition::ga:country==CanadaMetrics
Select users or sessions based on single or totaled metric values.Users
Select users whose total revenue in a single transaction was greater than $100.users::condition::perHit::ga:transactionRevenue>100Excluding Conditions
NOT Operator
Use the! character to negate a condition and exclude the sessions matching that condition.Exclude sessions where the exit page exactly matches the root page path.
sessions::condition::!ga:exitPagePath==/Combining Conditions
AND Operator
Use the; character to combine conditions using the AND operator.Select users who came from Canada AND whose total revenue across all transactions in the date range was greater than $100.
users::condition::ga:country==Canada;users::condition::perUser::ga:transactionRevenue>100OR Operator
Use the, character to combine filters using the OR operator.Select users who came from Canada OR who came from Mexico.
users::condition::ga:country==Canada,users::condition::ga:country==MexicoSequences
Use sequences to select users or sessions based on sequential conditions.Select users who visited on mobile immediately followed by a visit on desktop.
users::sequence::ga:deviceCategory==mobile;–>ga:deviceCategory==desktopCombining Users and Sessions
You can select users and sessions to create a segment. Users will be selected first and sessions will be selected from the subset of users.Select sessions where total revenue in a single transaction was greater than $100 from users who visited on mobile followed by a visit on desktop.
users::sequence::ga:deviceCategory==mobile;->>ga:deviceCategory==desktop;sessions::condition::perHit::ga:transactionRevenue>100
0 comments:
Post a Comment