> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluation Context

> The SDK uses the context data for targeting and randomization in flag evaluations (see [Define Rules](/docs/flags/define-rules)).

The Confidence SDKs use OpenFeature's [Evaluation Context](https://openfeature.dev/docs/reference/concepts/evaluation-context) to pass context data for flag evaluations. The context contains information about the user, session, or environment that Confidence uses for targeting rules and randomization.

Here is an example with the Go SDK:

```go theme={null}
evalCtx := openfeature.NewEvaluationContext("user-123", map[string]interface{}{
    "country": "US",
    "membershipLevel": "premium",
})

value, err := client.BooleanValue(ctx, "my-feature-flag.enabled", false, evalCtx)
```

## Managed Contexts

The Confidence SDKs can generate contextual data automatically, depending on the SDK.

### Visitor ID

Supported SDKs: JS (Client), Android, iOS, Flutter

The `visitor_id` is a unique identifier for each installation of a mobile application or browser instance (cookie). This context field is automatically added to the context by the mobile SDKs.

You can override its value by setting a custom context with the same key: `visitor_id`.

<Note>
  When using a combination of Client SDKs and Server SDKs, you should
  append the `visitor_id` in relevant endpoint calls to your backend. This way,
  the Server SDK can access it. Client SDKs expose APIs to read the
  `visitor_id` for this purpose.
</Note>

Refer to the dedicated section for more information on how and when to use the visitor ID as your
entity: [Entities](/docs/metrics/entities).

### Page

Supported SDKs: JS (Client)

Data about the current webpage where the user is at. The various fields are all wrapped in
a `page` struct:

* `path`
* `referrer`
* `search`
* `title`
* `url`

This page data is opt-in: refer to the [SDK README](https://github.com/spotify/confidence-sdk-js) for more information on how to enable this
context data in your application.

### App Lifecycle

Supported SDKs: Android, iOS

These context entries are automatically generated:

* `app_version`
* `app_build`

These App Lifecycle fields are opt-in: refer to each SDK README ([iOS](https://github.com/spotify/confidence-sdk-swift), [Android](https://github.com/spotify/confidence-sdk-android)) for more information on how to
enable this context data in your application.

## Related Resources

<CardGroup cols={2}>
  <Card title="Confidence SDKs" href="/docs/sdks/introduction">
    Overview of available SDKs
  </Card>

  <Card title="Entities" href="/docs/metrics/entities">
    Configure entity types
  </Card>

  <Card title="Flag Audience" href="/docs/flags/audience">
    Configure flag targeting
  </Card>
</CardGroup>
