Skip to main content

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This topic explains how to configure private context and user attributes in LaunchDarkly SDKs. These features are available for client-side, server-side, and AI SDKs. You can optionally configure your SDK to treat some or all attributes as private context attributes. You can use private context attributes for targeting purposes, but the SDK removes them from the context data it sends back to LaunchDarkly.
The context key is not optional. You cannot set either the context key or the context kind as a private attribute.
If you initially mark an attribute as private, LaunchDarkly will continue to treat the attribute as private in subsequent evaluations as long as the context is in the Contexts list, even if you later remove the “private” designation from the attribute. If you no longer want LaunchDarkly to treat the attribute as private, remove the “private” designation within the SDK, delete the context from the Contexts list, and re-evaluate the context. After you configure private attributes within your SDK, the context details page in the LaunchDarkly user interface shows the private attributes under a _meta section. The values of these attributes are not displayed:
The "Attributes" section of the context details page, showing private attributes in a "_meta" section.
Depending on the type of SDK you use, LaunchDarkly does not receive or store the information in private attributes:
  • If you are using a server-side or AI SDK, the SDK will not send the private attribute back to LaunchDarkly.
  • If you are using a client-side SDK, the SDK will send the private attribute back to LaunchDarkly for evaluation. However, the SDK won’t send the attribute to LaunchDarkly in events data, LaunchDarkly won’t store the private attribute, and the private attribute will not appear on the Contexts list or on the detail page for the context.
A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags in your product. Contexts replace another data object in LaunchDarkly: “users.” To learn more, read Contexts.Creating contexts and evaluating flags based on them is supported in the latest major versions of most of our SDKs. For these SDKs, the code samples on this page include the two most recent versions.
Details about each SDK’s configuration are available in the SDK-specific pages below.

SDK-specific configuration

Use the SDK-specific pages for implementation details and code samples: