Affected: All SDKs
Overview
Setting up targeting correctly in experimentation ensures accurate results and prevents experiment issues. Instead of using the default rule, create a specific targeting rule within your feature flag to define exactly which users should be included in the experiment.
The default rule is designed to catch all contexts that do not match any of the defined flag rules. Using this rule as a targeting rule can lead to unexpected assignments if the evaluated context does not match the intended targeting criteria.
By explicitly defining a targeting rule, you ensure that only the correct users are included, leading to more reliable experiment results.
Example:
A UX team is testing a new checkout flow using an experiment with three variations: Control, Variation A, and Variation B. They use the default rule to target users.
However, their backend sometimes evaluates flags with an organization context instead of a user context. Since the default rule only targets users, LaunchDarkly does not find a match and serves the last defined variation by default.
Impact
- Some users receive the wrong variation, affecting experiment accuracy.
- Results become unreliable due to inconsistent targeting.
Solution
Follow these steps to prevent unintended variations from being served:
-
Create a specific targeting rule on the feature flag.
-
Define the audience by selecting the correct context kind (for example, user or organization) in your experiment.
-
Run the experiment on that rule, ensuring only the intended users are evaluated.