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
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 / NONE), 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.
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.
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.
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.
Step 2. Enter a name and click Create Segment
Step 3. Set the outer grouping to OR
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.
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
... and select Catalog Activity
Fill out the Catalog Activity condition to select customers who viewed an item in 'Philosophy > Zen' within the past 7 days.
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:
... and change the newly created grouping to NOT
Then we create a new Catalog Activity condition within that NOT group.
... and configure that Catalog Activity condition to match for users who purchased 'Philosophy > Zen' within the past 7 days.
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.
The right side of the segment editor has a query summary that now looks like this:
The summary pane can scan for matching users in any chunk of logic by clicking on it and clicking the radar icon.
... and wait for the scan to finish.
... and Viola! We've got 155 users who viewed 'Philosophy > Taoist'
Here's the query with every chunk scanned for matching users:
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.