Segment Composition
A segment composition is a collection of segments combined via boolean operators (and, or, not).
When used for lookups, it combines the results of different segments to give a final result. For instance, if you combine a "Sports Lovers" user segment with a "Cooking articles" contextual segment with an "and" operator, the segment composition will only match when a sports lover user visits a cooking article. If they're combined using "or", only one of the two criteria has to be true.
Using it does not result in additional evaluation of segments as the results of the existing segment evaluation is simply combined using the boolean operators defined.
The composition object is defined as:
Composition
Can only provide one of
and,or,not,segmentId, orsegmentMatchCount. AsegmentMatchCountmust be the whole tree.
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
Segment id |
|
|
List of |
Combination of nodes that all must match for the Composition to match |
|
|
List of |
Combination of nodes where 1 must match for the Composition to match |
|
|
|
Negates the matching of a node |
|
|
|
Matches users who are in at least |
SegmentMatchCount
|
Name |
Type |
Description |
|---|---|---|
|
|
List of String |
The segments to count, without duplicates, at most 20, and no combined segments |
|
|
Integer |
The least number of the segments the user must be in, from 1 to the number of segments |
For example, this matches users in at least 3 of the 5 segments:
{"segmentMatchCount": {"segmentIds": ["id1", "id2", "id3", "id4", "id5"], "min": 3}}
The count uses each segment's members as of its latest update, so a contextual segment counts when the user has read a page in it, not only when the current page is in it. In traffic queries, all events of these users in the query period count.