SDK v3.8 and higher
The following shows the object model for the OptimizelyDecision object.
class OptimizelyDecision attr_reader :variation_key, :enabled, :variables, :rule_key, :flag_key, :user_context, :reasons
The following table describes the fields of the OptimizelyDecision object:
Whether the flag is enabled or not. Optimizely never returns nil for this field; it returns false when it fails to make a decision due to an error.
Key-value pairs of all the flag variables. When there are no variables defined for the flag or SDK cannot get variables, this field returns an empty map. When SDK fails to get variables for a decision, the Reasons field includes the error messages regardless of the Include Reasons option.
When SDK fails to make a decision, this field returns nil and the Reasons field includes the log messages if the Include Reasons option is set.
The key of the flag rule that the user bucketed into for this decision.
The key of the flag for which the decision was made.
The user associated with the call to the Decide method.
An array of relevant error and log messages, in chronological order. Optimizely returns messages in this field:
See the following section for more information.
The returned decision object includes error and log messages in the Reasons field.
For the sake of consistency with other decision results, Optimizely returns a decision with nill fields instead of throwing errors or exceptions.
Critical errors are always included in the reasons field of the returned decision object regardless of the include reasons option you set on the Decide method.
Optimizely collects log messages in the reasons field of the returned OptimizelyDecision object in the order in which they are logged.
The following types of log messages are only included in the reasons field if you set the include reasons option on the Decide method:
- Log messages related to bucketing users based on audiences or attributes.
- Log messages related to bucketing users based on traffic percentages.
For an example of a returned decision object, see Decide methods.
Updated 4 months ago