What is a feature gate?
A feature gate is a mechanism for teams to configure what system behavior is visible to users without changing application code. Feature gates are also commonly called feature flags or feature toggles.
When to use feature gates
Feature gates are commonly used as on/off switches to turn a certain system behavior on or off in production. Teams often use feature gates to turn on certain features or behavior for a small percentage of the total user base. Teams may do this to gradually ramp up a software release across their user base to limit the impact of any unanticipated system behavior, or to enable a restricted behavior only for a specific set of users.
Statsig offers several built-in capabilities with feature gates:
- A feature gate can be a simple kill switch that you can use to turn off a particular code branch for all your users
- You can use a feature gate to target newly coded system behavior to a specific set of users to implement whitelisting
- You can create user targeting rules based on Statsig-derived environment attributes such as location, client device, browser type, and client app version
- You can create user targeting rules based on user attributes such as email and user ID that you provide
- Each feature gate offers built-in A/B testing with no additional effort or charge so you can automatically see how your feature is performing in production compared to the default or control
- A feature gate may depend on other targeting gates that control when it’s active; for example, you can create a feature gate as a top level kill switch that activates child feature gates that depend on it
The following tutorials show how you can perform common tasks with feature gates.