_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.
- 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.
Client-side SDKs
Here are the configuration options for private context and user attributes in client-side SDKs:- .NET (client-side)
- Android
- C++ (client-side)
- Electron
- Flutter
- iOS
- JavaScript
- Node.js (client-side)
- React Native
- React Web: The React Web SDK relies on the JavaScript SDK for context-related functionality.
- Roku
- Vue: The Vue SDK relies on the JavaScript SDK for context-related functionality.
.NET (client-side)
Expand .NET (client-side) code sample
Expand .NET (client-side) code sample
- When creating the LaunchDarkly
Configurationobject, you can call theAllAttributesPrivatemethod, which takes in a boolean parameter. Iftrue, all context attributes except the kind and key are removed for all contexts before the SDK sends the context to LaunchDarkly. - When creating the LaunchDarkly
Configurationobject, you can call thePrivateAttributesmethod, which takes any number of attribute names or slash-delimited paths to designated JSON properties within an attribute, such as/address/street. If any context has a custom or built-in attribute that matches one of these names, the SDK removes it before sending the context to LaunchDarkly.
Private() on the context builder.For example:email attribute.Android
Expand Android code sample
Expand Android code sample
LDConfig object, call the privateAttributes method, which takes in a set of custom or built-in attributes as a parameter. If any context has a custom or built-in attribute named in this set, the SDK removes it before sending the context to LaunchDarkly.Here’s how to configure private attributes:name and group attributes.C++ (client-side)
Expand C++ (client-side) code sample
Expand C++ (client-side) code sample
- When using the
ConfigBuilder, you can callAllAttributesPrivate(). When you do this, all context attributes except the kind and key are removed before the SDK sends the context to LaunchDarkly. - When using the
ConfigBuilder, you can configure a set ofPrivateAttributes(). If any context has an attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
.SetPrivate() in the ContextBuilder.Here’s how:ContextBuilder.Electron
Expand Electron code sample
Expand Electron code sample
allAttributesPrivate option:name and email attributes.You can also specify an array of which attributes should be private with the privateAttributeNames option. You can configure this option in the user object, the configuration object, or both:key and name back to LaunchDarkly.Flutter
Expand Flutter code sample
Expand Flutter code sample
LDConfig object, you can set all attributes private for all contexts. You can also provide a list of attributes to the globalPrivateAttributes option. If any context has an attribute named in this set, the SDK removes it before sending the context to LaunchDarkly.private optional parameter. For example:email and group attributes are removed.To learn more about the configuration options for private attributes, read allAttributesPrivate and globalPrivateAttributes. To learn more about setting private attributes for a specific context, read LDContext.iOS
Expand iOS code sample
Expand iOS code sample
- When creating the
LDConfigobject, you can set theallContextAttributesPrivateattribute totrue. - When creating the LDConfig object, you can set the
privateContextAttributesproperty to a list ofReferences, such as[Reference("name"), Reference("/address/state")]. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
LDContext instance, for example:JavaScript
Expand JavaScript code sample
Expand JavaScript code sample
allAttributesPrivate option:allAttributesPrivate.In the configuration object, to mark some attributes as private specify your array of attributes in the privateAttributes configuration option:privateAttributes.In the context object, specify your array of attributes in the privateAttributes field of the reserved _meta property.Here’s how:privateAttributes.Node.js (client-side)
Expand Node.js (client-side) code sample
Expand Node.js (client-side) code sample
allAttributesPrivate option:privateAttributes option. You can configure this option on a per-context basis by specifying which attributes should be private in your context object.You can configure this option in both the context object and the configuration object:React Native
Expand React Native code sample
Expand React Native code sample
allAttributesPrivate and privateAttributes.You can also mark an attribute as private for a particular context:/ delimiter followed by the attribute name, then the / delimiter followed by the JSON property within the value. In the example, the attribute "address": { "street": "Main St", "city": "Springfield" } has only the /address/street marked as private.React Web
All context-related functionality provided by the JavaScript SDK is also available in the React Web SDK.Roku
Expand Roku code sample
Expand Roku code sample
Vue
All context-related functionality provided by the JavaScript SDK SDK is also available in the Vue SDK.Server-side SDKs
Here are the configuration options for private context and user attributes in server-side SDKs:- .NET (server-side)
- Apex
- C++ (server-side)
- Erlang
- Go
- Haskell
- Java
- Lua
- Node.js (server-side)
- PHP
- Python
- Ruby
- Rust
.NET (server-side)
Expand .NET (server-side) code sample
Expand .NET (server-side) code sample
- When creating the LaunchDarkly
Configurationobject, you can configureEventswithAllAttributesPrivate, which takes in a boolean parameter. Iftrue, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the key. - Or, you can configure
EventswithPrivateAttributes, which takes any number of attribute names or slash-delimited paths to designated a JSON property within an attribute, such as/address/street. If any context has a custom or built-in attribute that matches one of these names, the SDK removes it before sending the context to LaunchDarkly.
Private() after setting the attribute on the context builder.For example:email attribute.Apex
Expand Apex code sample
Expand Apex code sample
LDConfig object or on a per-user basis.When creating the LDConfig object, you can use setAllAttributesPrivate(true). When you do this, all user attributes, except the key, are redacted before the SDK sends the user to LaunchDarkly.Here’s how:C++ (server-side)
Expand C++ (server-side) code sample
Expand C++ (server-side) code sample
-
When creating the config object, you can use
AllAttributesPrivate. When you do this, the SDK only sends the context key and kind to LaunchDarkly. For example:
-
When creating the config object, you can list specific private attributes with
PrivateAttributes. The SDK removes all attributes in this list before sending the context to LaunchDarkly. Here’s how:
- You can also define private attributes on a per-context basis. For example:
ContextBuilder.Erlang
Expand Erlang code sample
Expand Erlang code sample
name and /address/street attributes are private for this context.Go
Expand Go code sample
Expand Go code sample
- You can set the configuration option
AllAttributesPrivateto true. If you enable this, the SDK removes all attributes for all contexts before it sends the context to LaunchDarkly, except the key and kind. - You can set the configuration option
PrivateAttributesto a list of attribute names. If any context has an attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
Haskell
Expand Haskell code sample
Expand Haskell code sample
- When you create the
Configobject, useconfigSetAllAttributesPrivateto set all context attributes as private. When you do this, all context attributes, except the key and kind, are removed before the SDK sends the context to LaunchDarkly. - When you create the
Configobject, you can list specific private attributes withconfigSetPrivateAttributeNames. If any context has attributes named in this list, the SDK removes them before sending the context to LaunchDarkly.
Java
Expand Java code sample
Expand Java code sample
- When creating the
LDConfigobject, you can call theallAttributesPrivatemethod, which takes in a boolean parameter. Iftrue, all context attributes except the key for all contexts are removed before the SDK sends the context to LaunchDarkly. - When creating the
LDConfigobject, you can call theprivateAttributesmethod, which takes in a set of custom or built-in attributes as a parameter. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes builder method. For example:email attribute.Lua
Expand Lua code sample
Expand Lua code sample
- Use
allAttributesPrivateto remove all context attributes except for the kind and key from all contexts before the SDK sends the contexts to LaunchDarkly. - Use
privateAttributesto designate a list of private attributes. If any context has an attribute named in this list, the SDK removes that attribute before sending the context to LaunchDarkly.
privateAttributes:clientInit and makeContext.Node.js (server-side)
Expand Node.js (server-side) code sample
Expand Node.js (server-side) code sample
- In the LaunchDarkly
LDOptions, you can setallAttributesPrivatetotrue. If you enable this, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the kind and key. - In the LaunchDarkly
LDOptionsobject, you can define a list ofprivateAttributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes on the context object. For example:email attribute.PHP
Expand PHP code sample
Expand PHP code sample
- In the LaunchDarkly
config, you can setall_attributes_privatetotrue. If you enable this, the SDK removes all attributes except the key and kind from a context before sending the context to LaunchDarkly. - In the LaunchDarkly
configobject, you can define a list ofprivate_attribute_names. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
LDContextBuilder method.For example:email attribute.Python
Expand Python code sample
Expand Python code sample
- In the LaunchDarkly
config, you can setall_attributes_privateto true. If you enable this, the SDK removes all context attributes for all contexts before sending the context to LaunchDarkly, except the key. - In the LaunchDarkly
configobject, you can define a list of attributes inprivate_attributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
private builder method. For example:email attribute.Ruby
Expand Ruby code sample
Expand Ruby code sample
- In the LaunchDarkly
config, you can setall_attributes_privateto true. If you enable this, the SDK removes all context attributes for all contexts before sending the context to LaunchDarkly, except the key. - In the LaunchDarkly config object, you can define a list of
private_attributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes on the context object. For example:email attribute.Rust
Expand Rust code sample
Expand Rust code sample
- In the LaunchDarkly config object, you can set
all_attributes_privateto true. If you enable this, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the key and kind. - In the LaunchDarkly config object, you can define a list of
private_attributes. If any contexts has an attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
email attribute.AI SDKs
Here are the configuration options for private context attributes in AI SDKs:.NET AI
Expand .NET AI SDK code sample
Expand .NET AI SDK code sample
Private() after setting the attribute on the context builder.For example:email attribute.Go AI
Expand Go AI SDK code sample
Expand Go AI SDK code sample
Private() after setting the attribute on the context builder.For example:email attribute.Java AI
Expand Java AI SDK code sample
Expand Java AI SDK code sample
privateAttributes builder method.For example:email attribute.Node.js (server-side) AI
Expand Node.js (server-side) AI SDK code sample
Expand Node.js (server-side) AI SDK code sample
privateAttributes on the context object.Here’s how:email attribute.Python AI
Expand Python AI code sample
Expand Python AI code sample
private builder method.Here’s how:email attribute.Ruby AI
Expand Ruby AI code sample
Expand Ruby AI code sample
email attribute.