Skip to main content

Feature Flags

Feature flags are the central concept that we built Unleash around. In Unleash, feature flags are organized within projects. Feature flags can have different activation strategies for each of their project's environments, and can also be given variants to facilitate A/B testing.

Configuration options

Each feature flag has the following configuration options

OptionRequired?Default valueDescription
nameYesN/AThe feature flag's name. Must be URL-friendly according to section 2.3 of RFC 3986 and must be unique within your Unleash instance. Must be between 1 and 100 characters long, inclusive.
feature flag typeYesReleaseThe feature flag's type.
projectYesThe default project. When created from a project page in the admin UI, that project will be the default value instead.The project that should contain the feature flag.
descriptionNoN/AA description of the feature flag's purpose.
enable impression dataYesNoWhether to enable impression data for this flag or not.

Environments

You probably won't want to use the same configuration to enable a flag in development as you do in production. That's why feature flags have different activation strategy configurations for each environment.

You can enable and disable a flag independently in each of the project's environments. When you disable a flag in an environment, it will always evaluate to false in that environment. When you enable a flag in an environment, the flag will evaluate to true or false depending on its activation strategies.

Refer to the documentation on environments for more details on how environments work.

Activation strategies

To enable a feature in an environment, you must assign it at least one activation strategy. A feature flag's activation strategies determine whether the flag gets enabled for a particular Unleash context (typically a user). When using multiple strategies in a single environment, only a single strategy needs to evaluate to true for the flag to get enabled for a user. Whenever Unleash evaluates a flag, it will evaluate strategies in the current environment until one of them resolves to true. If no strategies resolve to true, then the flag's value is false.

Refer to the activation strategies documentation for a detailed description of all the built-in strategies.

Variants

Variants adds another dimension of flexibility to feature flags. Each feature flag can be assigned any number of variants which will then get distributed amongst your users based on your choice of context field. You can find out more about variants in the variants docs.

Creating flags with payloads

While variants are most often used for A/B testing and the like, you can also use variants to assign a constant payload to a flag. If you give a flag only a single variant and that variant has a payload, then all users variants will receive that payload.