Disclaimer: This website requires JavaScript to function properly. Some features may not work as expected. Please enable JavaScript in your browser settings for the best experience.

Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Get Enabled Features

This topic describes the Get Enabled Features method, which retrieves a list of features that are enabled for the user.

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.

Version

SDK v3.0 and higher

Description

This method iterates through all feature flags and for each feature flag invokes Is Feature Enabled. If a feature is enabled, this method adds the feature’s key to the return list.

Parameters

The table below lists the required and optional parameters in C#.

ParameterTypeDescription
userId
required
stringThe ID of the user to check.
userAttributes
optional
mapA map of custom key-value string pairs specifying attributes for the user that are used for audience targeting. Non-string values are only supported in the 3.0 SDK and above.

Returns

A list of the feature keys that are enabled for the user, or an empty list if no features could be found for the specified user.

Examples

This section shows a simple example of how you can use the method.

var actualFeaturesList = OptimizelyMock.Object.GetEnabledFeatures(TestUserId, userAttributes);

Source files

The language/platform source files containing the implementation for C# is Optimizely.cs.