Advanced Segments

Advanced Segments let you author more specific and maintainable segments than basic segments via the following features:
 
 * The ability to nest grouping logic
 * The ability to share query logic between segments
 * The ability to see how many users match a particular chunk of query logic 
 
 

Nested Grouping

The advanced segment editor provides a free form interface to create logical groupings. Unlike basic segments, which give you a single set of predefined logical groupings ( ALL / ANY / OR ), advanced segments let you create AND / OR / NOT groupings on the fly and nest groupings within groupings.
 
The freedom to compose grouping logic with arbitrary depth and breadth opens the door to a lot of complexity, so let's first review how the grouping logic works.
 
You can think of AND, NOT and OR groups as Venn diagrams of logic that match sets of users.
 
vendiagrams.002.jpeg
 
In the image above, the A, B and C circles each represent some unit of segmentation logic (e.g. a user attribute match, event match, messaging history match, another group, etc...). If you find yourself confused about number of users a particular grouping is matching, refer back to this diagram to orient yourself. It's important to note the following:
 
- The amount of matching users inside an AND group decreases as you add logic because the search criteria of who to include gets increasingly specific.
- The amount of matching users inside an OR group increases as you add logic because the search criteria of who to include gets increasingly broad.
- The amount of matching users inside a NOT group decreases as you add logic because the search criteria of who to exclude gets increasingly broad.
 
Groupings are completely isolated from each other, meaning a given grouping will always return the same set of matching users, regardless of its parent.
 

Segment References

Advanced segments can reference other advanced segments. This lets you share logic between segments and avoid repeating yourself when authoring queries. It also provides a way to manage complexity by providing a way to break down query logic into more smaller, more digestible and semantic units.
 
For example, you can create a segment to hold some commonly used exclusion criteria and then refer to that segment in all other segments which need that same logic.
 
The referencing system is completely dynamic, so when a segment is updated all segments referencing it will instantly pickup the changes.
 

Nested Grouping Walkthrough 

The following walks through an example of a segment that is not possible to build as a basic segment. In this example we'll create a segment to query for customers who browsed books related to East Asian Philosophy, but did not end up buying any.
 
Creating a segment for this sounds straightforward, but our hypothetical example account has a caveat: the taxonomy of its product catalog has no formal notion of an East Asian Philosophy as a category.
 
In this example 'East Asian Philosophy' means the product is either part of the  'Philosophy > Zen' or the 'Philosophy > Taoism' category. Thanks to the flexibility of nested grouping, it's possible to construct this meta category. Lets go build it out!
 
Step 1. Select "Create Advanced Segment" from the segment index.
0d34c54-Screen_Shot_2017-10-04_at_11.35.49_AM.png
 
 
Step 2. Enter a name and click Create Segment
ccdd20a-Screen_Shot_2018-01-19_at_4.20.08_PM.png
 
 
Step 3. Set the outer grouping to OR
988037d-Screen_Shot_2017-10-04_at_12.27.18_PM.png
 
The first thing we'll want to do is set the outer most grouping to OR since we want to match for users who abandoned browsing  **"Philosophy > Zen"** *or* abandoned browsing **"Philosophy > Taoism"**.
 
Step 4. Building Abandoned Browse of 'Philosophy > Zen'
 
Next we build out the query logic to match users who abandoned browsing the 'Philosophy > Zen' category. Since an abandoned browse is defined by two distinct Catalog Activity actions that must both be true, we'll first create an **AND** grouping by clicking the "Add Grouping" button within the outer **OR** grouping.
 
479a5ba-Screen_Shot_2017-10-04_at_12.39.24_PM.png
Now that we have an AND grouping, we define Catalog Activity conditions that match users who browsed but did not buy an item in 'Philosophy > Zen'.
 
Click Add Condition
13e997f-Screen_Shot_2017-10-04_at_12.44.14_PM.png
... and select Catalog Activity
 
5b5f9f1-Screen_Shot_2017-10-04_at_12.44.34_PM.png
 
Fill out the Catalog Activity condition to select customers who viewed an item in 'Philosophy > Zen' within the past 7 days.
 
c93f9eb-Screen_Shot_2017-10-04_at_12.43.52_PM.png
 
 
Now that we've matched customers who viewed 'Philosophy > Zen' we need to filter out users who already bought an item in 'Philosophy > Zen'.
 
To do that, we'll go ahead and add a new grouping within the same AND group that the first Catalog Activity condition is in:
 
175906b-Screen_Shot_2017-10-04_at_12.49.13_PM.png
 
... and change the newly created grouping to NOT
 
fcc50cd-Screen_Shot_2017-10-04_at_12.49.39_PM.png
 
Then we create a new Catalog Activity condition within that NOT group.
 
6769a92-Screen_Shot_2017-10-04_at_1.59.43_PM.png
 
... and configure that Catalog Activity condition to match for users who purchased 'Philosophy > Zen' within the past 7 days.
 
90b443c-Screen_Shot_2017-10-11_at_10.23.27_PM.png
 
At this point the segment matches for customers who abandoned 'Philosophy > Zen'. To complete the logic to match for users who abandoned browsing items related to East Asian Philosophy, we'll create a second AND grouping directly within the top level OR grouping. We'll use this second AND grouping to hold the logic to also match users who abandoned browsing 'Philosophy > Taoism'
 
Step 5. Matching for 'Philosophy > Taoism' Abandoned Browse as well
 
We'll start by creating a new AND group directly within our outermost OR grouping. 
 
The rest of this step is identical to building out the abandoned browse logic in STEP 4. The only difference being the category set to 'Philosophy > Taoism' instead of 'Philosophy > Zen'. 
 
Once the query logic for 'Philosophy > Taoism' Abandoned Browse has been added. Our Abandoned Browse East Asian Philosophy segment is complete and our form looks like this.
 
340f149-Screen_Shot_2017-10-04_at_4.00.15_PM.png
 
The right side of the segment editor has a query summary that now looks like this:
579f1fd-Screen_Shot_2018-01-22_at_12.41.40_PM.png

Scanning Users

The summary pane can scan for matching users in any chunk of logic by clicking on it and clicking the radar icon.
Screen_Shot_2018-05-31_at_4.51.48_PM.png
 
... and wait for the scan to finish.
Screen_Shot_2018-05-31_at_4.51.17_PM.png
... and Viola! We've got 155 users who viewed 'Philosophy > Taoist'
Screen_Shot_2018-05-31_at_4.54.52_PM.png
 
Here's the query with every chunk scanned for matching users:
 
Screen_Shot_2018-05-31_at_4.50.36_PM.png
Scanning individual chunks let's you make sense of the numbers from the bottom up. In this example 133 users abandoned browsing 'Philosophy > Taoist' and 43 users abandoned browsing 'Philosophy > Zen' which is why the grand total is 176 for users who abandoned our informal notion of an 'East Asian Philosophy' category.
Was this article helpful?
0 out of 0 found this helpful