Define feature variables

Written by Julie Trenque

Updated on 06/05/2023

1 min

Advanced

Was this content useful?

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?

  1. Navigate to your feature flag or create a new one
  2. In the left side menu, go to Variables under the Setup category 
  3. Create a new Variable by clicking the  + Add Variable  button
  1. Select the type, and then edit the Key and Default Value of your variable. 
  2. 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:

  1. Android
  2. Swift
  3. Java
  4. C#
  5. Node JS
  6. PHP
  7. Ruby
  8. Go
  9. Flutter
  10. Python

  • In this article :