Intro to Conditions

Powerful conditions for targeting, with over 100 properties

Conditions are boolean string expressions that can be evaluated with the current state of the users device. A few examples show the range of possiblities:

  • UI State: interface_orientation == 'landscape' || dark_mode || screen_brightness < 0.1

  • Device state: user_interface_idiom == 'tablet' || device_orientation == 'face_up' || device_model_version == '13.3' || device_battery_level > 0.25

  • Locale: locale_language_code IN ['en', 'es'] && locale_currency_code == 'USD'

  • App info: versionGreaterThan(app_version, '1.4.2') && app_install_date < date('2021-06-06')

  • Networking state: network_connection_type != 'cellular' && has_active_network && !low_data_mode && !expensive_network

  • Location: location_approx_city == 'Toronto' || location_region == 'TX'

  • And much more: !on_call && (has_bt_headset || has_wired_headset) && !has_watch && contacts_permission && canOpenUrl('spotify:')


Conditions can evaluate over 100 properties:

  • Built in properties: our SDK includes over 100 realtime device conditions from device orientation to "is it raining where the user is". See a complete list of built in properties.

  • Custom properties: add your own data like "is this a power user" or "date of original account creation". Anything that makes sense for your app or use case.

  • Property history database: check the history of any property to see if it has ever held a specific value, when it occurred, or how often it's happened. Allowed for powerful personalized decision making. The database is completely private: data is stored on the user's device, evaluated locally, and never sent off device.


Conditions allow for inline functions like date parsing, random number generation, parsing version numbers, URL support (canOpenURL), and more.

Event history functions can query the built in database of event history, counting how many times a user has performed an action, or when the last time it was performed.

Powerful Syntax

Conditional expressions support a wide range of operators including order of operation (()), arithmetic (+, -, %, /, *, ^, **), strings (startsWith, endsWith, contains), regex, ranges, and much more.

This powerful set of features can be used to

  • Multi-variable thresholding: device_battery_level > 0.2 && eventCount('app_start') > 5

  • Multi-variable scoring: (eventCount('completed_task_1') * 2) + (eventCount('completed_task_2') * 3) > 15

  • Combine different use cases: for example, a feature flag with progress rollout, while only targeting new iPhones for the initial cohort (exclude iPads and old OSs)

See the full syntax docs for details.

Realtime Evaluation

Conditions are evaluated realtime, and will update their result as device state changes.


Conditions are connected to the rest of the system through the config file. The following parts of the config file can include an condition strings:

  • Actions and Triggers may optionally contain a condition, and only perform the action if the condition is true

  • Conditional actions: are actions which check a condition, and fire one action by name if true, and another if false

  • Feature Flags can return their value based on a conditional string, and be updated over time with remote updates.

  • Named conditions can evaluate conditions in code. Use them instead of manually writing complex conditional logic in code.

Last updated