LaunchDarkly Developer Documentation

Get started in under 30 minutes.
LaunchDarkly provides feature flags as a service for Java · Python · Ruby · Go · Node.js · PHP · .NET. Control feature launches -- who sees what and when -- without multiple code deploys. Easy dashboard for phased rollouts, targeting and segmenting.
Need more help? write us at support@launchdarkly.com

Get Started    Documentation

Setting user attributes

Overview

This topic explains what user attributes are, how they impact what you see in LaunchDarkly, how to configure them, and how LaunchDarkly uses them to calculate and display flag settings for users.

By default, all of the attributes in your user objects are sent to LaunchDarkly. This data lets LaunchDarkly calculate the current flag settings for users and powers the autocomplete functionality throughout the LaunchDarkly UI.

Access user pages from the Users dashboard. To learn more, read The Users dashboard.

A user's page.

A user's page.

Creating private user attributes

You may not want to send all attributes back to LaunchDarkly. The security or data protection requirements of your organization may require you to limit what customer or user data is transmitted from your service to a third-party platform like LaunchDarkly.

For example, you may want to target customers by their personally identifying information (PII), such as their email address, without sending the email address to LaunchDarkly.

LaunchDarkly's private user attributes feature lets you choose which attributes get sent back to LaunchDarkly. This lets you create targeting rules based on the attributes without having to send sensitive data back to LaunchDarkly.

The SDK does not use the attributes on the Users dashboard to evaluate flags

The SDK only evaluates flags based on the user object you provide. The SDK does not use the attributes shown on the dashboard, and user attributes are not synchronized across SDK instances.

You must provide all applicable user attributes for your targeting rules to apply correctly.

Configure private attribute settings in your SDK.

There are three different ways to configure private attributes:

  • You can mark all attributes private globally in the LDClient configuration object.
  • You can mark specific attributes private by name globally in the LdClient configuration object.
  • You can mark specific attributes private by name for individual users when you construct LDUser objects.

User keys cannot be marked private.

To learn more about setting these configuration options, read your SDK's documentation.

Implications of using private attributes

If a feature flag contains targeting rules that reference private attributes, the user page may not be able to calculate flag settings for your users. The Users page indicates when it is unable to calculate flag settings because of private attributes.

LaunchDarkly cannot perform autocomplete attributes you have made private.

Setting custom user attributes

A user object is constructed of the user's key, standard attributes, and custom attributes.

Custom attributes contain any other user data that you would like to use to conditionally target your users. Custom attributes are provided in the users object. Here is an example user object which contains custom user attributes:

{
"key":"YOUR-USER-KEY",
"firstName": "Bob"
"custom":{
	"groups":[
		"YOUR-COMPANY",
		"YOUR-COMPANY-GROUP-2"
		]
	}
}

The user's key is not optional, but the following standard attributes are all optional:

email

Must be a string.

firstName

Must be a string.

lastName

Must be a string.

name

Must be a string.

avatar

Must be an absolute URL to an avatar image for the user.

ip

Must be an IP address.

country

Must be a string.

This attribute represents the country associated with the user.

anonymous

Must be a boolean.

This attribute prevents the user's other attributes from being transmitted to the events endpoint, and prevents the user from showing up on the dashboard.


Setting user attributes


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.