Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

JS Client SDK: Add callout to use evaluationDetails option in variationDetail section #80

Merged
merged 3 commits into from
Sep 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/content/topics/sdk/client-side/javascript/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ The default value will only be returned if an error is encountered—for example

The `variationDetail` method allows you to evaluate a feature flag (using the same parameters as you would for `variation`) and receive more information about how the value was calculated.

<Callout intent="alert">
<CalloutTitle>You must enable the evaluationReasons option</CalloutTitle>
<CalloutDescription>
You must enable the `evaluationReasons` option when you initialize the LaunchDarkly client. If you do not do this, the `reason` object returned by this method will always be null.

To learn more, read [Customizing your client](#customizing-your-client).
</CalloutDescription>
</Callout>

The variation detail is returned in an object that contains both the result value and a "reason" object which will tell you, for instance, if the user was individually targeted for the flag or was matched by one of the flag's rules. It will also indicate if the flag returned the default value due to an error.

You can examine the "reason" data programmatically; you can also view it with data export, if you are capturing detailed analytics events for this flag.
Expand Down