HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In


Evaluates and returns all feature variables for the specified feature flag.

This method takes into account the user `attributes` passed in, to determine if the user is part of the audience that qualifies for the experiment.

### Sample call





## Version

SDK v1.3 and higher

## Description

For each feature variable associated with the feature flag, Get All Feature Variables returns all feature variable keys. For each key, it returns either the default or the user-specific variable value, depending on which audience the user is bucketed into. For example:

  • If the user is in a "Beta" audience on a feature rollout, this method returns user-specific values: `{"welcome_snippet": "you're in our beta!", "new_feature_color": "red"}`.

  • If the user is in a feature tests's `control_variation` in which the feature is disabled, this method returns the default values: `{"welcome_snippet": "", "new_feature_color": "grey"}`.

Note that depending on the audience rules, this method can return a mix of default and user-specific variable values.

Important

Unlike [Is Feature Enabled](🔗), the Get All Feature Variables method does not trigger an impression event. This means that if you are running a feature test, events will not be counted until you call Is Feature Enabled. If you do not call Is Feature Enabled, you will not see any visitors on your results page.

## Parameters

Required and optional parameters are listed below.

ParameterTypeDescription
**feature_key** _required_stringThe feature key is defined in the Features dashboard.
**userContext** _required_entities.UserContextHolds information about the user, such as the userID and the user's attributes.

## Returns

Returns an [OptimizelyJSON](🔗) object. For example, you can call _your_returned_OptJson_.toMap() to get the following example JSON representation:





## Example





## See also

[Get Feature Variable](🔗)

## Side effects

Invokes the `DECISION` [notification listener](🔗) if this listener is enabled. Sends only one notification for all variables.

## Source files

The language/platform source file containing the implementation for Go is [client.go](🔗).