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.
The JavaScript SDK, @datadog/openfeature-browser, supports flag key obfuscation for precomputed assignments in version 2.1.0 or later. No additional provider configuration is required.
Opt out individual users or devices
Flag evaluation opt-out and experimentation opt-out control different behaviors for a subject, such as a user or device. See Flag Evaluation and Experimentation Opt-Out for the shared concepts and SDK support considerations.
Telemetry options by platform
The web, mobile, and Unity providers expose similar telemetry controls with platform-specific option names. The following Boolean options default to true; set an option to false to disable its behavior. Flutter OpenFeature RUM association requires an explicit hook.
The web options below apply to DatadogProvider, the recommended browser provider. The advanced DatadogCoreProvider does not enable telemetry automatically. Applications using it explicitly register tracking hooks and manage their life cycle. See Browser Rules-Based Evaluation.
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): trackExposures (version 2.3.0 and later). Earlier versions use enableExposureLogging, which is deprecated. - Android (
dd-sdk-android-flags): trackExposures - Dart and Flutter (
datadog_flags, datadog_flags_flutter): trackExposures - iOS (
DatadogFlags): trackExposures - React Native:
trackExposures - Unity:
trackExposures
Send aggregated flag evaluation telemetry
Default: true. Set to false to disable.
- Web (
@datadog/openfeature-browser): enableFlagEvaluationTracking - Android (
dd-sdk-android-flags): trackEvaluations - Dart and Flutter (
datadog_flags, datadog_flags_flutter): trackEvaluations - iOS (
DatadogFlags): trackEvaluations - React Native: Not exposed
- Unity:
trackEvaluations
Attach evaluations to RUM
The Boolean options default to true. Set to false to disable. For Flutter OpenFeature, register the RUM hook explicitly.
- Web (
@datadog/openfeature-browser): enableRumFeatureFlagTracking - Android (
dd-sdk-android-flags): rumIntegrationEnabled - Flutter (
datadog_flags_flutter): Register DatadogRumHook with the OpenFeature API. Omit the hook to disable RUM association. The legacy plugin uses rumIntegrationEnabled. See Dart and Flutter setup. - 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:
- Build a map of flag keys to variants in your test setup.
- Register an
InMemoryProvider with that map through the OpenFeature API. - Call the OpenFeature client in the units being tested. The
InMemoryProvider returns the flag assignments configured at test setup. - 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 can 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.
Additional helpful documentation, links, and articles: