Feature Flags

Feature Flags, also known as feature toggles, switches, flippers, gates, or conditional features, are software switches that control the visibility of a feature in real-time, without needing to release a new version of the software. They are used to turn on or off a feature, usually in real-time.

For instance, if you are shipping a new feature and you want to control who gets to see your new feature and who shouldn’t, then you use Feature Flags to accomplish that. They are also known by many names such as Feature toggle, switch, flipper, conditional feature, and more.

Anatomy of a Feature Flag

A feature flag evaluation involves checking a user against the Feature Gate created. This evaluates a predefined set of rules and conditions, ultimately passing if those are met, or failing if not.

For example, a Feature Gate named is_statsig_employee could have a single rule. The rule should be evaluated as follows: if the condition (as defined by: targetValue “email” matches the contains operator with input “@statsig.com”) passes, then the rule (and hence the gate) will pass 100% of the time and return true. Otherwise, the evaluation fails, and the check returns false.

Types of Feature Flags

Feature flags can be categorized into two types:

  1. Permanent Gates: These are expected to live in your codebase for an extended period of time, beyond a feature release, usually for operations or infrastructure control. Common examples include user permissions (e.g. premium features based on subscription level) or circuit breakers/kill switches (e.g. terminating a connection to prevent negative customer impact) or even supporting legacy features in old app versions.

  2. Temporary Gates: All newly created feature gates are marked as Temporary, unless marked otherwise (i.e. Permanent). Therefore, Statsig will not display the phrase Temporary in the console.

Managing the Lifecycle of Feature Flags

A feature can go through different phases throughout its lifecycle - maybe it’s still being tested out by a few users, or only recently fully rolled out to the world, or maybe it’s been tried and true and you no longer need the feature behind a toggle. Statsig makes it easy for your feature gates to reflect the phase your feature is in by using status. A gate can be in one of four statuses:

  • In Progress: This feature is in the process of being rolled out and tested.

  • Launched: This feature has been rolled out to everyone

  • Disabled: This feature has been rolled back from everyone

  • Archived: This feature is no longer in use

Why Feature Flags?

In this modern, continuous deployment style, Feature flags are useful in a variety of scenarios. They can be used for A/B testing, canary releases, kill switches, and more. They allow developers to separate code deployment from feature release, test in production, and do gradual rollouts. They also help in reducing the risk of feature releases and help in easy rollback of features.

Join the #1 experimentation community

Connect with like-minded product leaders, data scientists, and engineers to share the latest in product experimentation.

Try Statsig Today

Get started for free. Add your whole team!

Why the best build with us

OpenAI OpenAI
Brex Brex
Notion Notion
SoundCloud SoundCloud
Ancestry Ancestry
At OpenAI, we want to iterate as fast as possible. Statsig enables us to grow, scale, and learn efficiently. Integrating experimentation with product analytics and feature flagging has been crucial for quickly understanding and addressing our users' top priorities.
OpenAI
Dave Cummings
Engineering Manager, ChatGPT
Brex's mission is to help businesses move fast. Statsig is now helping our engineers move fast. It has been a game changer to automate the manual lift typical to running experiments and has helped product teams ship the right features to their users quickly.
Brex
Karandeep Anand
President
At Notion, we're continuously learning what our users value and want every team to run experiments to learn more. It’s also critical to maintain speed as a habit. Statsig's experimentation platform enables both this speed and learning for us.
Notion
Mengying Li
Data Science Manager
We evaluated Optimizely, LaunchDarkly, Split, and Eppo, but ultimately selected Statsig due to its comprehensive end-to-end integration. We wanted a complete solution rather than a partial one, including everything from the stats engine to data ingestion.
SoundCloud
Don Browning
SVP, Data & Platform Engineering
We only had so many analysts. Statsig provided the necessary tools to remove the bottleneck. I know that we are able to impact our key business metrics in a positive way with Statsig. We are definitely heading in the right direction with Statsig.
Ancestry
Partha Sarathi
Director of Engineering
We use cookies to ensure you get the best experience on our website.
Privacy Policy