Configuring a Statsig Feature Flag with Time Constraints
To create a Statsig feature flag that returns true for a specific duration, you need to set the before and after dates correctly. This guide will help you avoid common pitfalls when configuring these time constraints.
Steps to Configure the Feature Flag
- Access the Statsig Console: Log in to your Statsig account and navigate to the Feature Flags section.
- Create a New Feature Flag: Click on the option to create a new feature flag.
- Set Time Constraints: In the configuration settings, you will find options to specify the
beforeandafterdates. Make sure to use the correct format:- Date Format: Statsig requires dates in the American format:
MM/DD/YYYY. - Time Format: Use
XX:XX AM/PMfor specifying time.
- Date Format: Statsig requires dates in the American format:
Example Configuration
Here’s an example of how your configuration might look:
{
"name": "my_feature_flag",
"rules": [
{
"condition": {
"before": "12/31/2023 11:59 PM",
"after": "12/01/2023 12:00 AM"
},
"treatment": "true"
}
]
}
Troubleshooting Common Errors
If you encounter an "invalid error" when saving your configuration, check the following:
- Ensure that both dates are in the correct format.
- Verify that the
afterdate is earlier than thebeforedate.
By following these guidelines, you should be able to successfully configure your Statsig feature flag to activate for the desired time period.