Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Context types

This section documents the context types used in your organization. Each context type represents a different entity you can target with feature flags.

Available context types

Session

Unauthenticated user sessions that maintain consistency pre and post-login. Use for anonymous user tracking and experimentation.

User

Authenticated users with consistent experience across devices. Use for user-level entitlements and cross-device feature rollouts.

Build

Build metadata for version-aware feature management across applications and services. Use for build-specific targeting and microservice coordination.

Browser

Browser and platform detection for web applications. Use for browser-specific rollouts and progressive enhancement.

Request

Request or transaction-specific metadata for API services. Use for API versioning and endpoint-specific behavior.

Multi-kind contexts

You can combine multiple context types in a single evaluation for sophisticated targeting:

const multiContext = {
  kind: "multi",
  session: {
    key: sessionId,
    anonymous: true
  },
  user: {
    key: userId,
    name: userName
  },
  build: {
    key: "api-orders-2.5.0",
    version: "2.5.0"
  }
};

This enables targeting rules like “roll out to 20% of sessions OR all enterprise users on build version 2.5.0+”.

Adding custom context types

To document a new context type for your organization:

  1. Create a new markdown file in this directory named after your context kind
  2. Follow the table structure from existing context types
  3. Include implementation examples
  4. Document specific use cases for your context
  5. Add the new context type to the navigation in SUMMARY.md