Security, Privacy, AI and CSR information for all Piano products now lives in one place. Explore our Compliance Center.
Audience
English French
English French

Segment Composition

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, or segmentMatchCount. A segmentMatchCount must be the whole tree.

Name

Type

Description

segmentId

String

Segment id

and

List of Node Objects

Combination of nodes that all must match for the Composition to match

or

List of Node Objects

Combination of nodes where 1 must match for the Composition to match

not

Node Object

Negates the matching of a node

segmentMatchCount

SegmentMatchCount Object

Matches users who are in at least min of the segments

SegmentMatchCount

Name

Type

Description

segmentIds

List of String

The segments to count, without duplicates, at most 20, and no combined segments

min

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:

JSON
{"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.

Last updated: