Feature Flag Determination


Feature flags are only available for SDK version 2.0.0 or higher.

When using feature flags, please apply SDK version 2.0.0 or higher when adding dependencies.

A feature flag has an on and off state. You will set different functions according to each state.

Once a feature flag is applied, a specific user from your traffic should be able to either receive an off or on status. This on/off status determination can be done through the Hackle SDK.


You can pass a feature key to the isFeatureOn() method to receive status results for the user. After receiving the status, we can then implement the logic according to each status.

In the example code below, we are passing feature key 42.

// Execution should occur after the SDK is ready. Don't forget to wrap with onReady.
hackleClient.onReady(function() {
  // Determines the status of the feature flag to assign the user in a feature flag with a feature key of 42.
  // For undetermined cases, users are assigned to false (off status). 
  const isOn = hackleClient.isFeatureOn(42);

  // Logic by state
  if (isOn) {
    // Logic for on status
  } else {
    // Logic for off status


The featureDetail() method works the same as the isFeatureOn() method and additionally provides a reason for determining the status of a particular user. This can be useful when you want to check whether the manual allocation is working well or when you think that the traffic allocation you have set is not being reflected in your results.

You must pass a function key as a parameter. For the example code below, we are passing function key 42.

hackleClient.onReady(function() {
  // Status determination details
  const decision = hackleClient.featureFlagDetail(experimentKey);
  // Feature flag on/off results 
  const featureOn = decision.isOn;
  // Reason for status determination
  const reason = decision.reason;

Please refer to the table below for the full list of reasons for the different types of status distributions.



Feature Status


The SDK is not ready to use.
(e.g. trying to initialize with the wrong SDK key)

Default status(off)


No feature flags were found for the function key you passed in.
The feature key may be incorrect or the corresponding feature flag may be in an archived state.

Default status(off)


The feature flag is off.

Default status(off)


User has been matched to individual targeting settings.

Set to individual targeting


User has been matched to audience targeting settings.

Set to audience targeting


User has not been matched to either individual targeting or audience targeting.

Default status (off)


The input value is not valid.
(Example: Character type entered in a parameter that requires a numeric type)

Default status (off)


An unknown error has occurred.

Default status(off)

Did this page help you?