Sequential segments are created by using the THEN operator, instead of AND or OR. THEN implies that one segment criteria occurs, followed by another. By default, a sequential segment identifies all matching data, showing the filter “Include Everyone”. Sequential segments can be further filtered to a subset of matching hits using the “Only Before Sequence” and “Only After Sequence” options.
Additionally, you can constrain sequential segments to a specific duration of time, granularity, and counts between checkpoints using the After and Within operators.
Here is a video on sequential segmentation:
When creating a segment where “Include Everyone” is set, the segment identifies paths that match the given pattern as a whole. This is an example of a basic sequence segment looking for one hit (Page A) followed by another (Page B) as visited by the same visitor. The segment is set to Include Everyone.
If result… | Sequence |
---|---|
Matches | A then B A then (in a different visit) B A then D then B |
Does not Match | B then A |
The options Only Before Sequence and Only After Sequence filter the segment to a subset of data before or after the specified sequence.
For example, consider a sequence of B -> D. The three filters would identify hits as follows:
Example 1: B then D appears once
Example | A | B | C | D | E | F |
---|---|---|---|---|---|---|
Include Everyone | A | B | C | D | E | F |
Only Before Sequence | A | B | ||||
Only After Sequence | D | E | F |
Example 2: B then D appears multiple times
Example | A | B | C | D | B | C | D | E |
---|---|---|---|---|---|---|---|---|
Include Everyone | A | B | C | D | B | C | D | E |
Only Before Sequence | A | B | C | D | B | |||
Only After Sequence | D | B | C | D | E |
Let’s also frame this concept with the Hit Depth dimension.
Example 3: Hit Depth 3 then 5
In a “within” clause, in between THEN statements, you can add, for example, “within 1 search keyword instance”, “within 1 eVar 47 instance”. This constrains the segment to within one instance of a dimension.
Setting a ‘Within Dimension’ clause between rules allows a segment to restrict data to sequences where that clause is satisfied. See the example below, where the constraint is set to “Within 1 page”:
If result… | Sequence |
---|---|
Matches | A then B |
Does not Match | A then C then B (because B was not within 1 page of A) Note: If the dimension restriction is taken out, “A then B” and “A then C then B” would both match. |
Identify visitors who viewed a page and then viewed another page. The hit-level data will filter this sequence irrespective of previous, past, or interim visit sessions or the time or number of page views occurring between.
Example: Visitor viewed page A, then viewed page B in the same or another visit.
Use cases
The following are examples of how the segment can be used.
Create this segment
You nest two page rules within a top-level Visitor container and sequence the page hits using the THEN operator.
Identify those visitors who fell out of a campaign but then returned to the sequence of page views in another session.
Example: Visitor viewed page A in one visit, then viewed page B in another visit.
Use Cases
The following are examples of how this type of segment can be used:
Create this Segment
This example nests two Visit containers within the top-level Visitor container and sequences the segment using the THEN operator.
Identify visitors who view two pages across an undetermined number of visits, but then view a third page in a separate visit.
Example: Visitors visit page A and then page B in one or more visits, followed by a visit to page C in a separate visit.
Use Cases
The following are examples of how this type of segment can be used:
Create this segment
Adding multiple Hit containers within a Visitor container lets you employ the appropriate operators between the same type of containers, and to use rules and dimensions such as Page and Visit Number to define the page view and provide a sequence dimension within the Hit container. Applying logic at the Hit-level lets you constrain and combine matches at a same-level of hits within the Visitor container to build a variety of segment types.
Example: Visitors visited page A after the first hit in the sequence of page views (page D in the example), then visited either page B or page C without regard to the number of visits.
Use Cases
The following are examples of how this type of segment can be used:
Create this segment
Select the Visitor container as the top-level container.
Add two Hit-level containers—a dimension with an appropriate numerical dimension joined at the same Hit level by the AND and OR operator.
Within the Visit container, add another Hit container and nest two additional Hit containers joined with an OR or AND operator.
Sequence these nested Hit containers with the THEN operator.
By placing checkpoints at both the Visit and Hit level, you can constrain the segment to meet requirements within a specific visit as well as a specific hit.
Example: Visitor visited page A then visited page B in the same visit. In a new visit, the visitor then went to page C.
Create this segment
Segment rules include all data unless you specifically exclude Visitor, Visit, or Hit data using the Exclude rule. It allows you to dismiss common data and create segments with more focus. Or it allows you to create segments excluding found groups to identify the remaining data set, such as creating a rule that includes successful visitors who placed orders and then excluding them to identify “non-purchasers.” However, in most cases it is better to create rules that exclude broad values rather than trying to use the Exclude rule to target specific include values.
For example:
Home Page
) from a report, create a Hit rule where the page equals “Home Page,” and then exclude it. This rule automatically includes all values except the Home Page.The Exclude operator can be employed to identify a sequence where specific visits or hits are not performed by the visitor. Exclude Checkpoints can also be included within a Logic Group.
Enforce logic to segment visitors where a checkpoint did not explicitly occur between two other checkpoints.
Example: Visitors that visited page A and then visited page C—but did not visit page B.
Use Cases
The following are examples of how this type of segment can be used:
Create this segment
Create a segment as you would for a simple, mixed-level, or nested sequential segment and then set the EXCLUDE operator for the container element. The example below is an aggregate segment where the three Hit containers are dragged to the canvas, the THEN operator assigned to join the container logic, then exclude the middle page view container to include only visitors that went from page A to Page C in the sequence.
If the exclude checkpoint is at the beginning of a sequential segment, then it ensures that an excluded page view did not occur before the first non-excluded hit.
For example, A restaurant wants to see inveterate users who avoid the main landing page and go directly to the Order Out page. This example can be simplified to a visitor avoiding visiting page A and going straight to page B.
Create this segment
Create two separate Hit containers within a top-level Visitor container. Then set the EXCLUDE operator for the first container.
If the exclude checkpoint is at the end of a sequence, then it ensures that the checkpoint did not happen between the last non-excluded checkpoint and the end of the visitor sequence.
For example, a clothing store wants to see all visitors that viewed a product page but never visited their shopping cart afterward. This example can be simplified to a visitor going to page A then never going to page B in current or subsequent visits.
Create this segment
Build a simple sequence segment by dragging two Hit containers to the canvas and connecting them using the THEN operator. Then assign the EXCLUDE operator to the second Hit container in the sequence.
Logic Group containers are required to group conditions into a single sequential segment checkpoint. The special Logic Group container is available only in sequential segmentation, to ensure its conditions are met after any prior sequential checkpoint and before any following sequential checkpoint. The conditions within the Logic Group checkpoint itself may be met in any order. By contrast, non-sequential containers (hit, visit, visitor) do not require their conditions to be met within the overall sequence, producing unintuitive results if used with a THEN operator.
The Logic Group container was designed to treat several checkpoints as a group, without any ordering among the grouped checkpoints. In other words, we don’t care about the order of the checkpoints within that group. For example, you can’t nest a Visitor container within a Visitor container. But instead, you can nest a Logic Group container within a Visitor container with specific Visit-level and Hit-level checkpoints.
A Logic Group can only be defined in a sequential segment, meaning that the THEN operator is used within the expression.
Container Hierarchy | Illustration | Definition |
---|---|---|
Standard Container Hierarchy | ![]() |
Within the Visitor container, the Visit and Hit containers are nested in sequence to extract segments based on hits, the number of visits, and the visitor. |
Logic Container Hierarchy | ![]() |
The standard container hierarchy is also required outside of the Logic Group container. But inside the Logic Group container, the checkpoints do not require an established order or hierarchy—these checkpoints simply need to be met by the visitor in any order. |
Logic groups may seem daunting - here are some best practices on how to use them:
Logic Group or Hit/Visit container?
If you want to group sequential checkpoints, then your “container” is Logic Group. However, if those sequential checkpoints must occur within a single hit or visit scope, then a ‘hit’ or a ‘visit’ containers are required. (Of course, ‘hit’ does not make sense for a group of sequential checkpoints, when one hit may credit no more than one checkpoint).
Do Logic Groups simplify building sequential segments?
Yes, they can. Let’s assume you are trying to identify this segment of visitors: Visitors that viewed page A, then viewed each of the pages of B, C, and D
You can build this segment without a Logic Group container, but it’s complex and laborious. You must specify every sequence of pages that the visitor could view:
Visitor Container [Page A THEN Page B THEN Page C THEN Page D] or
Visitor Container [Page A THEN Page B THEN Page D THEN Page C] or
Visitor Container [Page A THEN Page C THEN Page B THEN Page D] or
Visitor Container [Page A THEN Page C THEN Page D THEN Page B] or
Visitor Container [Page A THEN Page D THEN Page B THEN Page C] or
Visitor Container [Page A THEN Page D THEN Page C THEN Page B]
A Logic Group container greatly simplifies building this segment, as shown here:
Like other containers, Logic Group containers can be built in multiple ways within the Segment Builder. Here is a preferred way to nest Logic Group containers:
Using the Logic Group lets you meet conditions within that group that reside outside of the sequence. This allows you to build segments where a Visit or Hit container happens irrespective of the normal hierarchy.
Example: Visitors who visited page A, then visited page B and page C in any order.
Create this segment
Page B and C are nested in a Logic Group container within the outer Visitor container. The Hit container for A is then followed by the Logic Group container with B and C identified using the AND operator. Because it is in the Logic Group, the sequence is not defined and hitting both page B and C in any order makes the argument true.
Another example: Visitors who visited page B or page C, then visited page A:
The segment must match at lease one of the logic group’s checkpoints (B or C). Also, logic group conditions may be met in the same hit or across multiple hits.
Using the Logic Group lets you meet conditions within that group that reside outside of the sequence. In this unordered first match segment, the Logic Group rules are identified first to be either a page view of page B or page C, then the required view of page A.
Example: Visitors that visited either page B or page C, then visited page A.
Create this segment
Page B and page C dimensions are grouped within a Logic Group container with the OR operator selected, then the Hitcontainer identifying a page view of page A as the value.
Build segments using the Logic Group where multiple page views are aggregated to define what pages were necessary to be hit while other pages were specifically missed. ****
Example: Visitor visited Page A, then explicitly did not visit page B or C, but hit page D.
Create this segment
Build this segment by dragging Dimensions, Events, and pre-built Segments from the left panes. See Building a Logic Group Segment.
After nesting the values within the Logic Group, click the Exclude button within the Logic Group container.
Build segments using the Logic Group where multiple page views are aggregated to define what pages were necessary to be hit while other pages were specifically missed.
Example: Visitors that visited page A, but did not visit either Page B or Page C before Page A.
Create this segment
The initial B and C pages are identified in a Logic Group container that is excluded, and then followed by a hit to page A by the visitor.
Build this segment by dragging Dimensions, Events, and pre-built Segments from the left panes.
After nesting the values within the Logic Group, click the Exclude button within the Logic Group container.
Use the Within and After operators built in to the header of each container to define the time, events, and count.
You can limit matching to a specified duration of time by using the Within and After containers and specifying a granularity and count. The Within operator is used to specify a max limit on the amount of time between two checkpoints. The After operator is used to specify a minimum limit on the amount of time between two checkpoints.
The duration is specified by a single uppercase letter representing the granularity followed by a number representing the repetition count of the granularity.
Within includes the endpoint (less than or equal to).
After does not include the endpoint (greater than).
Operators | Description |
---|---|
AFTER | The After operator is used to specify a minimum limit on the amount of time between two checkpoints… When setting the After values, the time limit will begin when the segment is applied. For example, if the After operator is set on a container to identify visitors who visit page A but don’t return to visit page B until after one day, then that day will begin when the visitor leaves page A. For the visitor to be included in the segment, a minimum of 1440 minutes (one day) must transpire after leaving page A to viewing page B. |
WITHIN | The Within operator is used to specify a maximum limit on the amount of time between two checkpoints. For example, if the Within operator is set on a container to identify visitors who visit page A and then returned to visit page B within one day, then that day will begin when the visitor leaves page A. To be included in the segment, the visitor will have a maximum time of one day before opening page B. For the visitor to be included in the segment, the visit to page B must occur within a maximum of 1440 minutes (one day) after leaving page A to viewing page B. |
AFTER/WITHIN | When using both the After and Within operators, it’s important to understand that both operators will begin and end in parallel, not sequentially. For example, if you build a segment with the container set to:After = 1 Week(s) and Within = 2 Week(s) Then the conditions to identify visitors in the segment are met only between 1 and 2 weeks. Both conditions are enforced from the time of the first page hit. |
Example: Visitors that visited page A then visited page B only after 2 weeks.****
Create the Segment: This segment is created by adding a Visitor container with two Hit containers. You can then set the THEN operator, and open the AFTER operator drop down and set the number of weeks.
Matches
When given “After 2 weeks”, if a hit to page A happens on June 1 2019, at 00:01, then a following hit to page B will match as long as it comes before June 15 2019 00:01 (14 days later).
Hit A | Hit B | Matching |
---|---|---|
A hit: June 1, 2019 00:01 | B hit: Jun 15, 2019 00:01 | Matches: This time constraint matches because it is After June 1, 2019 (two weeks). |
A hit: June 1, 2019 00:01 | B hit: June 8, 2019 00:01 B hit: June 15, 2019 00:01 | Does not match: The first hit on page B does not match because it conflicts with the constraint requiring it after two weeks. |
In a “within” clause, in between THEN statements, you can add, for example, “within 1 search keyword instance”, “within 1 eVar 47 instance”. This constrains the segment to within one instance of a dimension.
Example: Visitors who visited page A then visited page B within 5 minutes.
Create the segment: This segment is created by adding a Visitor container, then dragging with two Hit containers. You can then set the THEN operator, and open the AFTER operator drop down and set the interval: hits, page views, visits, minutes, hours, days, weeks, months, quarters, or years.
Matches
Matches must occur within the time limit. For the expression , if a visitor hits page A happens at 00:01, then a following hit to page B will match as long as it comes on or before 00:06 (five minutes later, including the same minute). Hits within the same minute will also match.
Use Within and After to provide a maximum and minimum endpoint at both ends of a segment.
Example: Visitors that visited page A then visited page B after 2 weeks but within 1 month.
Create the Segment: Create the segment by sequencing two Hit containers within a Visitor container. Then set the After and Within operators.
Matches
Any visitors hitting page A on June 1, 2019 are returning after June 15, 2019 00:01, but before July 1, 2019 are included in the segment. Compare with Time Between Exclusions.
The After and Within operators can be used together to define a sequential segment.
This example depicts a second visit to hit page B after two weeks but within a month.