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.
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
.NET (client-side)
Expand .NET (client-side) code sample
Expand .NET (client-side) code sample
In the client-side .NET SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also mark attributes as private when building the context object by calling When the SDK sends this context back to LaunchDarkly, it removes the
- 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
In the Android SDK you can define private attributes for the entire LaunchDarkly client. When creating the You can also mark attributes as private when building the context object by using the private versions of the builder methods to set the attributes. For example:When the SDK sends this context back to LaunchDarkly, it removes the
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
In the C++ SDK there are two ways to define private attributes for the LaunchDarkly client:You can also define private attributes for a particular context by calling To learn more, read
- 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
To mark all user attributes except the key as private, use the In the above example, the SDK removes the In the above example, the SDK sends only the
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 on a per-user basis by specifying which attributes should be private in your user object.This option is configured in both the user object and the configuration object:key and name back to LaunchDarkly.Flutter
Expand Flutter code sample
Expand Flutter code sample
In the Flutter SDK, you can define private attributes for the entire LaunchDarkly client. When you create the You can also mark attributes as private when building the context object by using the When the SDK sends this context back to LaunchDarkly, the
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
In the iOS SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also mark attributes as private on a particular
- 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:Java
ScriptExpand JavaScript code sample
Expand JavaScript code sample
You can configure the private attributes option either in the configuration object or in the context object.In the configuration object, to mark all attributes except the key as private in the JavaScript SDK, use the To learn more, read To learn more, read To learn more, read
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
To mark all attributes except the key as private in the Node.js SDK, you can use the You can also specify an array of which attributes should be private with the In the above example, the SDK sends only the context key and name back to LaunchDarkly.
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
You can configure this option in the configuration object, to apply to all contexts, either for all attributes or some attributes:To learn more, read For attributes that are objects, you can mark specific fields private, using the
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
You can configure this option in the configuration object, to apply to all contexts, either for all attributes or some attributes:You can also mark an attribute as private for a particular context: