Feature Flags

All the different testing, personalize and rollout rules within FM&E are built on top of "Feature Flags".
As such, the first step is to fetch the particular flag you're looking to implement for, which is done using the getFlag() function.

getFlag()

// Get the featureFlag object for the feature key and context
GetFlag featureFlag = vwoInstance.getFlag("feature-key", context);

Please note that the flag must already be defined in FM&E for this.

Parameter Definitions

ParameterTypeDescription
feature_key
Required
Stringunique identifier for the particular feature flag that you're implementing. You will see this while creating a feature flag, and you can also find it under 'Settings' for the Feature Flag after creating it.
context
Required
ObjectContains information about the current user, including a required unique identifier for each user. Read more about userContext here.

isEnabled()

// check if flag is enabled, returns true or false  
Boolean isFlagEnabled = featureFlag.isEnabled();

After fetching the flag object, you can call the isEnabled() function, which checks if that particular feature flag is enabled for the current user.

This is evaluated based on the different rules and targeting conditions configured with your feature flag.

If the current user satisfies the conditions for any rollout, testing or personalize rule connected to a specific feature flag, isEnabled() will return 'true', or else it will return 'false'.


What’s Next