Code Syntax Used in the Segment Expression Editor
Segment Builder lets you build trait rules for a segment using a code editor. Click the Segment Expressions (Code View) tab in the Traits panel to access this feature.
Expression Builder Code Syntax
You can add trait rules to a segment with code instead of using drag and drop features. When coding, replace italicized elements in the example with an actual expression or value. The base code uses following syntax:
FREQUENCY([<traitID1>T,<traitID2>T]<Recency Operator><Numeric Value>D)
<Frequency Operator><Numeric Value>
Join Segments with Boolean Operators
To build groups of segments, wrap the frequency function in parenthesis and set the relationship between each expression with a Boolean operator (AND, OR, and NOT).
Parameters
FREQUENCY
[
<traitID
>T]
T
. Separate multiple traits with a comma. For example, [123T, 456T]
.<Recency Operator><Numeric Value>D
D
indicates recency in days.<Frequency Operator><Numeric Value>
Allowed Recency and Frequency Operators
Set recency and frequency intervals with a comparison operator and an integer. Segment Builder uses standard expressions like < (less than), > (greater than), == (equal), etc. However, the types of allowed operators vary when you set recency or frequency. The table below lists the allowed recency/frequency operators.
- >= (greater than/equal to)
- <= (less than/equal to)
- >= (greater than/equal to)
- <= (less than/equal to)
- == (equal to)