Define feature variables and feature variations

portrait de l'auteur Julie Trenque

Written by Julie Trenque

Updated on 11/17/2022

1 min


Was this content useful?

Create feature variables

You can define feature variables (Boolean, Number String or JSON) to remotely update the content of your feature flags in production. Creating (default) feature variables are required to create feature variations. There is no limitation in the number of feature variables you can create.

Feature variables let you variabilize parts of your feature flag code so that you can dynamically assign values depending on your use case, without having to hard code them in your source code. So, instead of updating your application or website by deploying new code, you can directly update the feature flag remotely on the Kameleoon app by updating the required variables for your feature flag.

  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.
  4. Select the type, and then edit the Key and Default Value of your variable. 
  5. Create as many variables as needed.

For developers to retrieve a feature variable’s content, you’ll need to call the obtainFeatureVariable() method of our SDK right after calling the activateFeature() method.

Create feature variations

You can create multiple Variations of your flag to choose which version of your feature is delivered to which audience. 

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.

  1. Navigate to your feature flag or create a new one
  2. In the left side menu, go to Variations under the Setup category 
  3. Create a new Variation by clicking the  + Add Variation  button, then edit the Name and Variation Key of your variation. 
  4. You can also customize the values of any feature variables you have created 
  5. Create as many variations as needed. 

You can variablize your code from the start and then customize variables using variations within the Kameleoon app to save substantial development time. 

By default, all users are shown the default (Off) variation, unless targeted by your defined delivery rules in the Rollout planner.

  • In this article :