Skip to content

Segmentation language

Pushwoosh offers a powerful segmentation engine for building granular Segments based on Tag values. Segmentation Language is a specific way of writing and combining segmentation criteria to describe a particular group of users that match those criteria and treat them as a single audience segment.

This article describes the basic concepts and syntax of the Segmentation Language and provides comprehensive examples of building segmentation criteria for various cases.

Each device in your userbase has specific attributes associated with it via Tag values.

For example, let’s say a user named Jane lives in Tokyo, and her age is 28. That user will have the following Tags set for their device:

  • Name: Jane
  • City: Tokyo
  • Age: 28

To target Jane, you will need to describe a segment as follows:

T("Name", eq, "Jane") * T("Age", eq, 28) * T("City", eq, "Tokyo")

This combination of conditions is a filter expression used in Segmentation Language for describing groups of users aka audience Segments.

Filter expressions

Anchor link to

Filter expression is a string that contains a condition or a combination of conditions describing the segment you need.

Conditions

Anchor link to

Each condition describes a segment of devices that match the criteria specified in that condition.

For example, the following condition builds a segment of users who live in Tokyo:

T("City", e, "Tokyo")

where

  • T is a Tag (condition type);
  • eq is an operator to apply;
  • “Tokyo” is a Tag value users have associated with their devices.

Condition types

Anchor link to

There are four condition types you can use for your segmentation:

  • A (Application) – describes a segment of devices with a particular app installed;
  • T (Tag) – describes a segment of devices with the specified Tag values;
  • AT (App-specific tag) – applied in combination with the app codes for tags that are app-specific;
  • Event – describes a segment of devices triggered a specific Pushwoosh event;

Operations with conditions

Anchor link to

For building sophisticated segments, the following operations can be applied to conditions within the filter expression:

Joins the segments, i.e., builds a new segment of users who match at least one of the specified conditions.

For example, to target users who live in Tokyo or in Osaka, you’ll need to describe the segment with the following conditions:

T("City", eq, "Tokyo") + T("City", eq, "Osaka")

Intersection (*)

Anchor link to

Constructs a segment of users belonging to both segments described by the conditions. Thus, only those users who comply with each condition you specify will be included.

The following expression describes a segment of users who both live in Tokyo and have specified their names:

T("City", eq, "Tokyo") * T("Name", any)

Difference (\)

Anchor link to

Builds a segment of users who belong to one of the described segments and do not belong to another.

Users who live in Tokyo but have not given you their names will be described as follows:

T("City", eq, "Tokyo") \ T("Name", any)

Parentheses

Anchor link to

Determine the order of operations to perform with the conditions in your filter expression.

For example, the following filter expression will, at first, obtain a segment of the 12345-67890 subscribers whose age is 18 and then subtract all men of that segment:

( A("12345-67890") * T("Age", eq, 18) ) \ T("Gender", eq, "Male")

Tag conditions operators

Anchor link to

For each Tag type, their own operators are applied.

Integer Tags Operators

Anchor link to
  • eq - equal to a specified value
  • noteq - not equal to a specified value
  • lte - less than or equal to a specified value
  • gte - greater than or equal to a specified value
  • in - any of specified values
  • notin - not equal to any of specified values
  • between - in a specified range
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

String Tags Operators

Anchor link to
  • eq - equal to a specified value
  • noteq - not equal to a specified value
  • in - equal to any of specified values
  • notin - not equal to any of specified values
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

List Tags Operators

Anchor link to
  • in - devices with any of the specified tag values
  • notin - none of the specified tag values associated with the device
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

Date Tags Operators

Anchor link to
  • eq - equal to the date specified
  • noteq - not equal to the date specified
  • lte - before of or on the date specified
  • gte - after of or on the date specified
  • in - equal to any of specified dates
  • notin - not equal to any of specified dates
  • between - in a specified range
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag
  • match - matches a specified month of the year and day of the month.
  • daysago eq - equal to a specified number of days before the present day
  • daysago noteq - not equal to a specified number of days before the present day
  • daysago lte - less than or equal to a specified number of days before the present day
  • daysago gte - greater than or equal to specified number of days before the present day
  • daysago between - between the specified numbers of days

Boolean Tags Operators

Anchor link to
  • eq - equal to a specified value
  • noteq - not equal to a specified value
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

Price Tags Operators

Anchor link to
  • eq - equal to a specified value
  • noteq - not equal to a specified value
  • lte - less than or equal to a specified value
  • gte - greater than or equal to a specified value
  • in - equal to any of specified values
  • notin - not equal to any of specified values
  • between - in a specified range
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

Version Tags Operators

Anchor link to
  • eq - equal to a specified value
  • noteq - not equal to a specified value
  • lte - less than or equal to a specified value
  • gte - greater than or equal to a specified value
  • in - equal to any of specified values
  • notin - not equal to any of specified values
  • between - in a specified range
  • any - devices with any values set for the tag
  • notset - devices with no value set for the tag

”Event” conditions operators

Anchor link to

Event’s count

Anchor link to
  • count gte - devices triggered the event more than or exactly n times
  • count lte - devices triggered the event less than or exactly n times
  • count eq - devices triggered the event exactly n times
  • count noteq - devices triggered the event any times but not equal to n

Event’s date

Anchor link to
  • date gte - devices triggered the event later than or exactly on the specified date
  • date lte - devices triggered the event earlier thar or exactly on the specified date
  • date eq - devices triggered the event exactly on the specified date
  • date noteq - devices triggered the event whenever but not on the specified date
  • date in - devices triggered the event on any of the specified dates
  • date notin - devices triggered the event whenever but not on any of the specified dates
  • date between - devices triggered the event within a specified period
  • date daysago eq - event trigger date is equal to a specified number of days before the present day
  • date daysago noteq - event trigger date is not equal to a specified number of days before the present day
  • date daysago lte - event trigger date is less than or equal to a specified number of days before the present day
  • date daysago gte - event trigger date is greater than or equal to specified number of days before the present day
  • date daysago between - event trigger date is between the specified numbers of days

Filter expression example

Anchor link to
  1. iOS and Android devices with the app installed and with push tokens:
A("11111-11111", ["ios","android"], [with_tokens])

2. iOS and Android devices with the app installed but without push tokens:

A("11111-11111", ["ios","android"], [without_tokens])

3. iOS and Android devices with the app installed, whether they have push tokens or not:

A("11111-11111", ["ios","android"], [with_tokens, without_tokens])

4. All app subscribers who have purchased something in the app:

AT( "11111-11111", "In-App Purchase", gte, 1)