Define feature variables
You can define feature variables to remotely update your feature flags' content in your chosen environment. You must create feature variables to create feature variations. There is no limit on the number of feature variables you can create.
Creating feature variables
- Navigate to your feature flag or create a new one.
- In the left sidebar, click Set Up > Variables > Add Variable.
- Select your variable's Type, Variable Key, and Default Value.
- Click Save.
To retrieve a feature variable from your source code, you must call the getVariation()
method. Please note that if you use feature variations, Kameleoon will automatically bucket the user in a variation and return the value of the variable that has been defined in the variation (you do not need to call the getVariation()
method).
Benefits of feature variables
Feature variables let you variabilize parts of your feature flag code, so you can dynamically assign values to variables without coding them in your source code.
Once the feature variable's code is in production, changing it does not require redeployment. For example, if your feature is a discount offer for premium customers, but you're not sure what the discount percentage will be, you can create a Discount Percentage variable in your code and update it from the Kameleoon app without changing or pushing new code.
Developers and product owners can work together to variablize parts of your feature that might change, so 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:
- Android
- Swift
- Java
- C#
- Node.js
- PHP
- Ruby
- Go
- Flutter
- Python