Pass in audience attributes
This topic describes possible user attribute values you can send to Optimizely through the Optimizely C# SDK.
You can pass strings, numbers, Booleans, and null as user attribute values. If you want to target audiences based on the version of your application that they're using, you can also pass in a string formatted as a semantic version, then define a version
audience condition in the Optimizely app. The examples below show how to pass in attributes.
UserAttributes attributes = new UserAttributes
{
{ "DEVICE", "iPhone" },
{ "AD_SOURCE", "my_campaign" },
{ "APPLICATION_VERSION", "4.3.0-beta" }
};
bool enabled = OptimizelyClient.IsFeatureEnabled("new_feature", "user123", attributes);
Important
During audience evaluation, note that if you don't pass a valid attribute value for a given audience condition—for example, if you pass a string when the audience condition requires a Boolean, or if you simply forget to pass a value—then that condition will be skipped. The SDK logs will include warnings when this occurs.
Updated almost 3 years ago