Intro to Conditions
Powerful conditions for targeting, with over 100 properties
Last updated
Was this helpful?
Powerful conditions for targeting, with over 100 properties
Last updated
Was this helpful?
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:
: our SDK includes over 100 realtime device conditions from device orientation to "is it raining where the user is". See a of built in 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.
: 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 , , , URL support (canOpenURL
), and more.
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.
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)
Conditions are evaluated realtime, and will update their result as device state changes.
See the for details.
Conditions are connected to the rest of the system through the . The following parts of the config file can include an condition strings:
and may optionally contain a condition, and only perform the action if the condition is true
: are actions which check a condition, and fire one action by name if true, and another if false
can return their value based on a conditional string, and be updated over time with .
can evaluate conditions in code. Use them instead of manually writing complex conditional logic in code.