ÃÛ¶¹ÊÓƵ

Code Syntax Used in the Segment Expression Editor 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>
NOTE
By default, Boolean OR conditions apply to multiple traits within an expression.

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

NOTE
All parameters are required unless noted otherwise.
Name or Variable
Description
FREQUENCY
A literal that must precede the expression.
[<traitID>T]
An array of trait IDs followed by the letter T. Separate multiple traits with a comma. For example, [123T, 456T].
<Recency Operator><Numeric Value>D
(Optional) Sets recency rules on traits in the segment. The letter D indicates recency in days.
<Frequency Operator><Numeric Value>
Sets frequency rules on traits in the segment.

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.

Recency Operators
Frequency Operators
  • >= (greater than/equal to)
  • <= (less than/equal to)
  • >= (greater than/equal to)
  • <= (less than/equal to)
  • == (equal to)
recommendation-more-help
de293fbf-b489-49b0-8daa-51ed303af695