Feature Flags

All the different testing, personalize and rollout rules within FME 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()

var flag = vwoClient.GetFlag("feature_key", userContext);

Please note that the flag must already be defined in FME 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.
userContext
Required
VWOContextContains information about the current user, including a required unique identifier for each user. Read more about userContext here.

IsEnabled()

bool isFeatureEnabled = flag.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'; otherwise, it will return 'false'.