You can create multiple Variations of your feature to choose which variant is delivered to each user evaluated by the flag.
How to create feature variations?
Any variables you created in the Variables page can be customized for each individual variation you create, meaning you don’t need to hard-code any values in your code.
- Navigate to your feature flag or create a new one
- In the left side menu, go to Variations under the Setup category
- Create a new Variation by clicking the + Add Variation button, then edit the Name and Variation Key of your variation.
- You can also customize the values of any feature variables you have created
- Create as many variations as needed.
Why use feature variations?
You can variabilize your code from the start and then customize your variations without making code changes by just updating the variables within those variations from the Kameleoon app to save substantial development time and branch out your product into more customized variations.
When you create a new feature flag, two default variations are automatically generated: On and Off.
- Off Variation: Users assigned to this variant will experience your application/website as if the feature flag’s toggle is turned off. This gives you flexibility to only turn on a feature for a small subset of users, without impacting others who will continue to receive the Off variation and continue their usage without any changes to their experience. It’s important to note that your created feature variables are not accessible to the Off variation.
- On Variation: The On variation represents the default or control experience of your flagged feature. This is the baseline experience for your feature and will receive only the default values for all your created feature variables.
At minimum, utilizing these default variations allows you to effectively taper and manage the user experience for different segments of your audience. You can see a quick summary of which variations are being served to your users in the Rollout Summary.
Technical note: the getFeatureVariationKey() method of our SDK will return the variation key associated with the user.