A segment is a set of visits that share specific characteristics. One way to define a segment is to specify a path or partial path that all visits in the segment follow.
Segmentation using the (A) path attribute allows the user to:
- find visits with Section and Action events that happened in a specific order.
- find visits with more then one occurrence of the same Section or Action event
Segmentation using paths is performed by specifying the (A) path attribute for the segment using a special syntax.
Syntax of Path Attribute
Every visit has a (A) path attribute which starts and ends with ^^ (double caret). Steps on a path are separated with ^ (single caret). For example:
(A) path=^^landing-pages/black-friday^account/register^Submitted form: form#register^account/success^^
To better understand the syntax, you may read the double caret ^^ as “start”, single carets ^ between steps as “then”, and the double caret ^^ at the end of a path as “exit”:
- start landing-pages/black-friday
- then account/register
- then Submitted form: form#register
- then account/success
The steps themselves are values of all (M) Section and (M) Action meta events tracked in the course of a visit. Read the Paths Report article to learn more about how paths are formed.
Writing a Path Query
To define a segment, you can write a path query which consists of one or more steps. These steps can be separated with a ^ character (caret) to indicate that each succeeding step must follow directly the preceding one:
or with ^* (a caret followed by an asterisk) to indicate that other steps are allowed in between the two specified steps:
The * characters (asterisks) wrapping a query are wildcards, which means that the specified steps can occur in any part of a path.
Wildcards are a powerful tool, but they do have some limitations. For a discussion of these limitations see the Limitations of Using Wildcards in Path Queries article.
To indicate that a path must start with a certain step, the first step in the query must be preceded with ^^ (a double caret):
To indicate that a path must end with a certain step, the query must end with ^^ (a double caret):
For a variety of examples of path queries see the Examples of Path Queries article.
Defining a New Segment using the Paths Report
The most convenient way to define a new segment by a path is to use the Paths Report.
Next to each step on a Path Report, there is a small magnifying glass icon which you can click to create a new segment of visits in which that path was followed.
- 1) clicking the icon on the first step would create a query
path=^^landing-pages/black-friday^*returning visits starting in that section.
- 2) clicking the icon on the second step would create a query
path=^^landing-pages/black-friday^account/registration^*returning visits in which users moved directly from black-friday to registration.
- 3) clicking the icon next to EXIT on the third step would create a query
path=^^landing-pages/black-friday^account/registration^^returning visits in which users moved directly from black-friday to registration and left the website there (without submitting the form).
Once you click the icon, the segment editor will appear:
- 1) The “path” attribute will be automatically selected.
- 2) The value field will be populated with a path selected in the report. Note, that unless you set path trimming, the selected path will start with “^^” (double caret) which means that it will return only visits starting at that step. You can edit the value to replace part(s) of the path with “*” wildcards (asterisk).
- Once you click 3) the [apply] button a new segment will be added in the tree as a subsegment of the segment selected in 4) the dropdown labeled “AND PLACE IT UNDER:”
Defining a Segment by Path from a Segments Tree
To create a segment definition using a (A) path from a segment tree, click + on a branch you want to add a new segment to. Then select (A) data point type, select path from the the Attribute Key dropdown that will show up and enter a path into the Value field.
If you already have a path query written that starts with path=, for example:
you can just paste it into the KEY/VALUE field.