For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/feature_flags/client.md. A documentation index is available at /llms.txt.

Client-Side Feature Flags

This product is not supported for your selected Datadog site. ().

Overview

Set up Datadog Feature Flags for your applications. Follow the platform-specific guides below to integrate feature flags into your application and start collecting feature flag data:

Datadog Feature Flags is built on the OpenFeature standard, an open-source, vendor-neutral specification for feature flag APIs. If you’re new to OpenFeature concepts like providers, evaluation context, and hooks, see the OpenFeature concepts documentation.

Android
Android TV
Angular
iOS
JavaScript
React
React Native
tvOS
Unity

Telemetry options by platform

The web, mobile, and Unity providers expose similar telemetry controls with platform-specific option names. Each exposed option defaults to true, so the listed behaviors are on by default; set the option to false to opt out.

The iOS OpenFeature bridge (dd-openfeature-provider-swift) is available for use as a pre-1.0 package. Until it reaches 1.0, version updates may include breaking changes. For the most stable iOS API surface, use the FlagsClient API directly.

Send exposure events

Default: true. Set to false to disable.

  • Web (@datadog/openfeature-browser): enableExposureLogging
  • Android (dd-sdk-android-flags): trackExposures
  • iOS (DatadogFlags): trackExposures
  • React Native: trackExposures
  • Unity: trackExposures

Send aggregated evaluation telemetry

Default: true. Set to false to disable.

  • Web (@datadog/openfeature-browser): enableFlagEvaluationTracking
  • Android (dd-sdk-android-flags): trackEvaluations
  • iOS (DatadogFlags): trackEvaluations
  • React Native: Not exposed
  • Unity: trackEvaluations

Attach evaluations to RUM

Default: true. Set to false to disable.

  • Web (@datadog/openfeature-browser): enableRumFeatureFlagTracking
  • Android (dd-sdk-android-flags): rumIntegrationEnabled
  • iOS (DatadogFlags): rumIntegrationEnabled
  • React Native: rumIntegrationEnabled
  • Unity: Not exposed

Testing with in-memory providers

Datadog supports these testing approaches:

  • Integration tests: Point DatadogProvider at a dedicated test environment and control flag values from the Datadog UI. This exercises the real provider end-to-end, including the CDN-delivered flag assignments.
  • Unit tests: Swap DatadogProvider for OpenFeature’s standard InMemoryProvider (or an equivalent test stub, where no in-memory provider is available in the language) and set flag values directly in test code. This keeps tests hermetic and offline.

This section covers the in-memory approach. Because the OpenFeature API is designed to make providers swappable at runtime, your application code does not change — only the provider registered during test setup.

A typical test follows this pattern:

  1. Build a map of flag keys to variants in your test setup.
  2. Register an InMemoryProvider with that map through the OpenFeature API.
  3. Call the OpenFeature client in the units being tested. The InMemoryProvider returns the flag assignments configured at test setup.
  4. Reset the provider in test teardown to avoid cross-test state leakage.

See your platform’s SDK page (select from the top of this page) for a concrete test example.

Context attribute requirements

Evaluation context attributes must be flat primitive values (strings, numbers, booleans). Nested objects and arrays are not supported and will cause exposure events to be silently dropped.

Use flat attributes in your evaluation context:

const evaluationContext = {
  targetingKey: 'user-123',
  userId: 'user-123',
  tier: 'premium',
  age: 25
};

await OpenFeature.setProviderAndWait(provider, evaluationContext);

Avoid nested objects and arrays:

// These attributes will cause exposure events to be dropped
const evaluationContext = {
  targetingKey: 'user-123',
  user: { id: 'user-123' },        // nested object - NOT SUPPORTED
  features: ['beta', 'analytics']  // array - NOT SUPPORTED
};

Further reading

For percentage-based rollouts and deterministic bucketing, see Traffic Splitting and Randomization.