Mobile targeting
Read time: 2 minutes
Last edited: Nov 13, 2024
Overview
This topic explains how to control which mobile apps and devices receive a variation of a feature flag.
Target mobile apps and devices
If you are using a mobile SDK that supports environment attributes, you can target your mobile applications based on automatically collected details about your application, application version, and device. You can also target mobile applications based on whether the application version is supported or unsupported. To learn more about configuring your mobile SDKs to enable this targeting, read Automatic environment attributes.
You can only create a "Mobile" targeting rule, and target mobile apps and devices based on automatically collected mobile environment attributes, if you have completed the following:
- your feature flag has its Client-side SDK availability set to include "SDKs using Mobile key." To learn more, read Creating new flags.
- you have already started to collect mobile environment attributes in the
ld_application
andld_device
context kinds. LaunchDarkly must receive these context kinds before it enables the option to create a mobile targeting rule.
If you are using other mobile SDKs, you can target your mobile applications using custom targeting rules. With custom targeting rules, you can target your mobile applications based on any attributes that you have manually added to your contexts.
To target mobile apps and devices:
- Click the + Add rule button, or + between existing rules, and select "Target mobile":
- (Optional) Enter a name for the rule.
- In the Attribute menu, select the application or device attribute that you want to target on. By default, mobile targeting rules include clauses for the application version support status and for device information.
- In the Operator menu, select the operator for your clause.
- In the Application ID or Values menu, enter the values to check against.
- (Optional) Click + to add additional clauses to your targeting rule, or click - to remove existing clauses from your targeting rule.
- In the Rollout field, select the variation to serve, or set a percentage rollout.
- (Optional) Click + Add rollout to create a progressive rollout or guarded rollout for this rule.
- Click Review and save.
Here is an example of a targeting rule for mobile apps:
To reference this rule when working with other members of your organization, click the three-dot overflow menu and choose Copy link to rule.