Skip to main content

Advanced targeting

Question

How can I add a new advanced targeting option for experiment audiences?

Answer

To add new advanced targeting you can open a PR against the constants.py file in Experimenter. The advanced targeting is evaluated by the client at the moment we try to determine if we can enroll an eligible user. Think of it more like a funnel than a target. All that’s needed is to add a new NimbusTargetingConfig object, e.g.:

NEW_ANDROID_13_USERS = NimbusTargetingConfig(
name="New Android 13 Users",
slug="new_android_13_users",
description="Users who have Android 13 and are on their first run of the application",
targeting="(android_sdk_version|versionCompare('33') >= 0) && is_first_run",
desktop_telemetry="",
sticky_required=True,
is_first_run_required=True,
application_choice_names=(Application.FENIX.name,),
)

If you need help writing the targeting expression, let us know in #ask-experimenter on Slack.