Skip to main content
The Confidence SDKs use OpenFeature’s 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:
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.
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.
Refer to the dedicated section for more information on how and when to use the visitor ID as your entity: 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 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, Android) for more information on how to enable this context data in your application.