You can define feature variables (Boolean, Number String or JSON) to remotely update the content of your feature flags in your chosen environment. Creating (default) feature variables are required to create feature variations. There is no limit on the number of feature variables you can create.
How to create feature variables?
- Navigate to your feature flag or create a new one
- In the left side menu, go to Variables under the Setup category
- Create a new Variable by clicking the + Add Variable button
- Select the type, and then edit the Key and Default Value of your variable.
- Create as many variables as needed.
Technical note: to retrieve a feature variable in your source code, you’ll need to call the getFeatureVariable() method of our SDK. Please note that if you use feature variations, Kameleoon will automatically bucket the user in a variation and return the value of the variable which has been defined in the variation (ie. you do not need to call the getFeatureVariationKey() method).
Why use feature variables?
Feature variables let you variablize parts of your feature flag code so that you can dynamically assign values to variables on the fly depending on your use case, without having to hard code them in your source code.
Once the feature variables’ code is in production, changing it does not require redeploying. For example, if your feature is a new offer for premium customers but you are not sure about the discount code % you want to offer, you can create a Discount Percentage variable in your code and update it remotely from the app at any time without changing or pushing new code.
Developers and product owners can work in tandem to variablize parts of your feature that are subject to change, so that product updates are not blocked by development and deployments.
Choose your SDK language and use the sample code provided to set up the SDK in your application in any of the following languages:
- Node JS