Skip to main content
Segment rules
Support Team avatar
Written by Support Team
Updated over 5 months ago

This article breaks down the specific rules available for segments. If you would like to read more general information on segments themselves, click here.

A single rule consists of contact's fields (and some additional "properties"), values we want to check, and logic operators like AND and OR.

General pattern for a rule is as follows:

"[contact field/property] [operator] [value]".

Example:

"Firstname = 'John'", "contactAge >= 25"

There are two types of contact fields:

  • Basic fields available for every account (email, status, firstname, lastname)

  • Manually added custom contact fields

Conditions

  • Use brackets to group conditions, embed a condition, or to distinguish between two AND and OR conditions that should be treated separately

  • Adjacent conditions, when divided by an AND operator, will be checked as all-or-nothing condition

  • Adjacent conditions, when divided by an OR operator, will be checked separately

General rules

  • Text and date types values must be surrounded by quotation marks

  • A single whitespace must occur between any two rule elements (e.g. between field's name and the '=' sign, or the '=' sign and the value)

Available logic operators

These operators are available only when a segment has two or more conditions:

  • AND - logical AND (all or nothing)

  • OR - logical OR (any that matches)

These operators are available for every condition:

  • = - equals

  • != - not equals

  • < - less than

  • <= - less than or equal

  • > - greater than

  • >= - greater than or equal

  • ( ) - group logic (e.g. for embedding conditions, represented by "add sub-rule" in the dashboard)

  • starts-with searches for text starting with the provided value

  • ends-with – searches for text ending with the provided value

  • contains searches for text containing the provided value

  • not-contains searches for text not containing the provided value

These operators compare their data to the data of the initially picked field

  • [field] month-day ['MM-dd'] – compares field's month and day with the value

  • daysfrom[field] [operator] [value] – compares the difference (number) between now (UTC) and the field

  • [field] = <blank> or [field] = <nodata> or [field] = '' - is field's value empty

  • [field] != <blank> or [field] != <nodata> or [field] != '' - is field's value not empty

Special properties

These keywords can be used instead of a field and will automatically be mapped to a corresponding data that you can work with.

  • list, listname, listid => list's name or ID (whichever fits the provided value)

  • firstfaileddate => contact's last failed email date (UTC)

  • dateadded => date (UTC) when the contact was added

  • dateupdated => date (UTC), when the contact was last updated

  • statuschangedate => last date (UTC), when the contact's status was changed

  • consenttracking => contact's consent on tracking (possible values: allow, deny, unknown)

Examples

  • firstname = 'John' AND status = 'Engaged' - returns contacts named John, with Engaged status

  • lastname != 'Test' AND dateadded < '2021-01-15 10:00:00' – returns contacts not having 'Test' for their lastname and that were added to your account before 15th of January 2021 10 AM UTC

  • (firstname = 'John' OR firstname = 'Katherine') AND lastname = 'Santana' – returns contacts being named John Santana or Katherine Santana

  • firstname = '' AND job ends-with 'IT' AND daysfromfirstworkday >= 30 – returns contacts having a blank firstname field, a job field ending with 'IT', and it's been 30 days since the date saved in the 'firstworkday' field

Hint

  • To request all contacts, provide this text as a rule: "All Contacts"

Did this answer your question?