14 Oct

The Future of Feature Flags: Managing Dynamic Applications

LaunchDarkly Multivariate Feature Flags / Toggles

Traditionally, software teams have used feature flags/toggles to control simple rollouts and enable kill switches.  Boolean values were used for “on” or “off”, “true” or “false”.  With the introduction of multivariate flags, developers have been experimenting with serving rich values via these flags: strings, numbers, JSON objects, and JSON arrays. This has opened up a whole new world of dynamic application management.

Use Cases

Using feature flags to manage dynamic applications opens up many powerful and interesting use cases, for example:

  • Manage features in a pricing plan
  • Customize pricing based on user segment Apply coupons and discounts based on user actions or holiday sales
  • Allow users to personalize their own experiences
  • Manage CSS styling to test colors, layouts, and elements
  • Control conditional logic separately from your code base

The Multivariate Flag

A multivariate feature flag has two primary benefits: you can customize the number and type of variations returned.

LaunchDarkly Multivariate Feature Flags / Toggles

Let’s first look at a simple example. This feature flag calls the variation method to determine which variation the user should get for a “checkout.flow” feature flag.

Here, the user “bob@example.com” will either see a one-click, two-click, or original checkout based on the string value returned by the feature flag:

Serving Dynamic Values

Now, let’s use a feature flag to insert prices into a pricing page based on some attributes of a the user. We’ll call this feature flag “plan.price”.

LaunchDarkly Managing Dynamic Content with Feature Flags / Toggles

Here, the user will receive a price of $20, $50, or $75 depending on whether they match a particular targeting rule.

For a more advanced use case, these values (20, 50, 75) could be used to populate other pricing dependencies, like a customer invoice and account limits.

Best Practices

Of course, you should not use feature flags as a secondary database, but they could be useful as a way to personalize feature targeting without tying that logic into your codebase. This allows you to rapidly change pricing models, test color schemes, and configure complex features without having to redeploy.

09 Sep

Launched: Multivariate Feature Flags

LaunchDarkly has always supported boolean feature flags, which came with two pre-defined variations: true and false. This satisfied our customer’s use cases for risk mitigation and end user control.

As our platform grew, so too did our customers’ requests for more powerful ways to harness feature flags, like managing user plans, app configurations, and multiple variations of a feature.

To meet these use cases, LaunchDarkly now provides support for multivariate feature flags. A multivariate flag allows you to define two or more custom variations. These variations can be strings, numbers, JSON objects, or JSON arrays.


Creating a Multivariate Feature Flag

The next time you create a feature flag, you’ll be able to specify which kind of flag you need: boolean or multivariate.

Here, we have created a multivariate flag that serves strings as variations. There is no limit to the number of variations you can add to a multivariate feature flag, making it very powerful for complex use cases and to manage two or more variations of a feature.

LaunchDarkly multivariate feature flags and toggles with multiple variations

Multivariate Percentage Rollouts

Now, you can easily perform percentage rollouts using multivariate feature flags. In this example, 10% of users will receive one-click-checkout, 10% will receive two-click-checkout, and 80% will receive original-checkout.

LaunchDarkly multivariate percentage rollouts for granular user targeting

Multivariate Individual User Targeting

We have also revamped our user targeting UI to support multivariate feature flag user targeting. This UI allows you to easily target individual users by key.

In this example, bob@example.com will get the one-click-checkout , john@example.com will get the two-click-checkout, and sarah@example.com will get the original-checkout.

LaunchDarkly multivariate individual user targeting

Multivariate Rollouts Using Custom Rules

You can also create custom rules to serve variations based on any user attributes you send us.

In this next example, we have two rules. The first rule serves two-click-checkout to all users whose country is USA. The second rule targets users whose email ends with example.com and serves one-click-checkout to 50% and two-click-checkout to 10% of those users.

LaunchDarkly multivariate feature flag / toggle rollouts using custom targeting rules and user attributes

All users who have not been targeted in the custom rules or who have not been individually targeted will fall to the Default Rule.

In this next example, all users will receive original-checkout if they have not been individually targeted and have not matched any custom rules.

LaunchDarkly Default Rollout Rule

We hope you find multivariate flags useful. Send us feedback at support@launchdarkly.com