Targeting individual users

Targeting rules allow you to enable Space Mode only for the users you specify in the feature flag.

Previously, when you wanted a flag to evaluate to false, you would turn off its targeting.

This time will be different. To explore the use of flag targeting rules, targeting needs to be enabled.

Instead of making the flag evaluate to false by turning off targeting, you need to change the default value:

  1. Navigate to the targeting page for the space-mode flag in LaunchDarkly.
  2. Scroll down to the default rule near the bottom of the page.
  3. Change the default rule to serve false instead of true.
  4. Click Save changes.

Default rule should be false

Once the flag configuration is saved, the game should update back to dinosaur mode.

Now you'll enable the flag, but only for your user key.

To add a user target:

  1. Stay on the targeting page for the space-mode flag in LaunchDarkly.
  2. Under Target individual users, click Add user targets .
  3. Click into the Add users box under the True option and enter user123.
  4. Click Save changes.

Target individual users

The Space Mode graphics reappear in the game window because your user key is "user123" by default, and the Space Mode flag evaluates to true for that user key.

Try changing users to see what happens:

  1. Click on the "Toggle Runner" heading.
  2. Change the key to user456. The graphics switch back to dinosaur mode, as your user key no longer matches the targeting rule in the flag.
  3. Change the key back to user123. The space mode graphics reappear.

Targeting with individual user keys is effective for differentiating between small sets of users, as long as you know all their user keys. But often you'll want to address larger sets of users, based on different criteria.

On the next page, we'll show you an example of doing this with targeting rules.