Feature Flags API
The Feature Flags API documentation is being developed. Feature flags are typically managed through the Mixpanel UI.For programmatic feature flag evaluation, use the Mixpanel SDKs which provide built-in support for:
- Evaluating flag values for users
- Tracking flag exposure events
- A/B testing and experimentation
Using Feature Flags
While there isn’t a dedicated REST API for managing feature flags, you can:- Define flags in the UI: Create and configure feature flags in Project Settings
- Evaluate with SDKs: Use Mixpanel JavaScript, Python, or other SDKs to evaluate flags
- Track with Events: Flag evaluations are automatically tracked as events
Example with JavaScript SDK
Example with Python SDK
Best Practices
Use consistent flag naming
Use consistent flag naming
Use kebab-case for flag names:
new-checkout-flowenable-dark-modeexperiment-pricing-v2
Track flag evaluations
Track flag evaluations
Mixpanel SDKs automatically track when flags are evaluated, helping you understand:
- Which users see which variants
- Impact of feature flags on key metrics
- A/B test results
Clean up old flags
Clean up old flags
Remove flags from code once features are fully rolled out: