Reference segments are segments that you use in other segments. You can define a basic criteria in a segment and then reuse that criteria in other segments.
- With reference segments, you can share logic between segments and avoid repetition when creating queries.
- By reusing segments you can reduce any errors that might occur while recreating the same logic in multiple segments.
- They also provide a way to manage complexity by providing a way to break down query logic into smaller, more digestible and semantic units.
- The referencing is dynamic and hence when a segment is updated, all segments that reference it are updated instantly.
Reference segments can be used in both Basic and Advanced segments. For example, you can create a segment for users in the loyalty program and then use it in a segment for loyalty program users residing in a particular area.
Reference Segments in Basic Segments
Reference Segments in Advanced Segments
Nesting of reference segments
When a segment is updated, all segments that reference it are updated instantly. If there are nested segments, the computations are even more complicated. To keep computations efficient, nesting upto only 3 levels breadth and 2 levels depth is accepted.
Breadth of 3 means that a segment cannot have more than 3 reference segments in the segment criteria. For example, If segment A has segments B, C, and D in its criteria, then it has a breadth of 3.
Depth of 2 means that a segment cannot have more than 2 reference segments in the criteria, even if it is not directly referencing these segments. Consider the following examples.