Leanplum's user guides and developer documentation.

Leanplum Documentation

Leanplum's user guides, SDK setup, API docs, and more resources are here to help you get the most out of A/B testing, Campaigns, Messaging, and Analytics.

Segment operators

Operators tell Leanplum how to compare each user to your segment. For example, if you want to create a segment of users based on their App version, you could build a segment with app version greater than 5.0, less than 3.2, between 1 and 3, etc.

Changing operator from "is" value to "is greater than."

Operators for segment criteria

The tables below define all of Leanplum's operator options. Each table is organized by the type of value the operator works with (number, string, etc.).


Different types of segment criteria use different operators, and not all operators are available for all segment types. The "is greater than" operator, for example, only works with segment criteria that return numbers (e.g. is greater than 4). See Segment and target criteria options for more on segments.

Occurrences and attributes

For Occurrence examples, let's assume we have a shopping app with a user attribute called "rewardsLevel" that has three possible values: bronze, silver, and gold.




is set

Value is present for this user, excluding users with no value set.

Target users with one of the three rewards statuses.

Segment criteria: User attribute > rewardsLevel > is set.

is not set

Value is not present for this user.

Target users with no rewardsLevel set.

Segment criteria: User attribute > rewardsLevel > is not set.


Equal to specific value(s).

Target just gold rewards members.

Segment criteria: User attribute >rewardsLevel > is > gold.

is not

Everything except specific value(s).

Target bronze and silver rewards members (all except gold).

Segment criteria: User attribute >rewardsLevel > is not > gold.

is empty string

Returns users who have an attribute with no value (i.e. an empty attribute).


For Numeric Examples, let's assume our shopping app has an attribute "rewardsPoints," which requires a numeric value between 1 and 100.




is greater than

Is more than a number.

Target users who are close to reaching the next rewards level (takes 100 points).
Segment criteria: User attribute > rewardsPoints > is greater than > 90.

is less than

Is less than a number.

Target users who have a long way to go before reaching the next level.
Segment criteria: User attribute > rewardsPoints > is less than > 10.

is at least

Is greater than or equal to a number.

Target users with 90 or more points.
Segment criteria: User attribute > rewardsPoints > is at least 90.

is at most

Is less than or equal to a number.

Target users with 10 or fewer points.
Segment criteria: User attribute > rewardsPoints > is at most > 10.

is between

Is within a specific range (including the boundary values you select).

Target mid-level users.
Segment criteria: User attribute > rewardsPoints > is between > 20 > and > 80.

Because this operator is inclusive, a user with 20 points, a user with 38 points, and a user with 80 points would all evaluate as true for the segment above.


When using targets with text values, do not put brackets or quotation marks around the value (string) in your target phrase or segment search. Just use the exact characters or text for your value. Example: First Name contains a is correct, but contains "a" or contains ["a"] will not return a user named Adam. See the image below for an example of the right way to use the 'contains' operator.

Also note that text comparisons are case-insensitive. For example, given a user with a name attribute "Adam", the following segments will all return this user: "name is Adam", "name is ADAM", "name is adam".


Note on using 'contains' with arrays

For custom user attributes that contain an array of values, you must type the value exactly as it appears in the array when targeting users. For example, if you have a custom user attribute like this array — types: ["u-type","y-type","z-type"] — you should type the whole value in your target phase like so, "User attribute types contains u-type." Typing just "contains u" will NOT work for attributes that are arrays.





Contains specific text.

Target silver and bronze rewardsLevels. 

Segment criteria: User attribute > rewardsLevel > contains > e

The 'e' character will match characters in silver and bronze, but not in Gold. (See note on array-style attributes above.)

does not contain

Does not contain specific text.

Target Gold level rewards users.
Segment criteria: User attribute > rewardsLevel > does not contain > e 
Silver and bronze levels will be filtered out because both contain the character 'e'





is on


Push support is on.

is off


Push support is off.


See below for accepted formats for timing operators.




is past

Happened after the given time.

Session start in Pacific time is after 1/2/15.

is prior to

Happened before the given time.

Session start time in user's timezone is before yesterday.

is since

Happened at or after the given time.

Session start in user's timezone is after 1/2/15.

is until

Happened at or before this point.

Any sessions logged before 1/2/15.

is between

Happened between

Session happened between yesterday and 08:00 AM.
This target would return users who used the app any time after midnight yesterday up until 08:00 AM today.

Leanplum accepts many different date and time formats for use with our time-specific segment operators:

  • MM/DD/YYYY → 08/05/2015
  • MM/DD/YY → 08/05/15
  • X months ago (weeks, days, hours, or minutes are also accepted) → 3 days ago
  • MM/DD/YY XX:XX AM/PM → 5/13/16 12:01 am
  • MM/DD/YY XX:XX → 5/13/16 00:00 to 5/13/16 23:59
  • Yesterday, today, or tomorrow → between yesterday and today


If a date without a time is specified, the time will default to midnight (00:00) that day.


Only use inequality operators with times, such as since, prior to, and between. The operator “is” will not match any users. (An exact time, such as "is 8:00:00 AM" will pass so instantaneously that no users will be targeted).

For more in-depth examples, see Time-related targeting operators.

Updated about a year ago

Segment operators

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.