• Public
  • Public/Protected
  • All

A legacy LaunchDarkly user object.

This type exists for easing migration to contexts, but code should be moved to use single/multi contexts.

The LDUser object is currently supported for ease of upgrade. It may be removed in a future release. In order to convert an LDUser into a LDSingleKindContext the following changes should be made.

1.) Add a kind to the object. kind: 'user'.

2.) Move custom attributes to the top level of the object.

3.) Move privateAttributeNames to _meta.privateAttributes.

const LDUser: user = {
key: '1234',
privateAttributeNames: ['myAttr']
custom: {
myAttr: 'value'

const LDSingleKindContext: context = {
kind: 'user',
key: '1234',
myAttr: 'value'
_meta: {
privateAttributes: ['myAttr']


  • LDUser



anonymous?: boolean

If true, the user will not appear on the Users page in the LaunchDarkly dashboard.

avatar?: string

An absolute URL to an avatar image for the user.

country?: string

The country associated with the user.

custom?: {}

Any additional attributes associated with the user.

Type declaration

  • [key: string]: string | boolean | number | (string | boolean | number)[]
email?: string

The user's email address.

If an avatar URL is not provided, LaunchDarkly will use Gravatar to try to display an avatar for the user on the Users page.

firstName?: string

The user's first name.

ip?: string

The user's IP address.

If you provide an IP, LaunchDarkly will use a geolocation service to automatically infer a country for the user, unless you've already specified one.

key: string

A unique string identifying a user.

lastName?: string

The user's last name.

name?: string

The user's name.

You can search for users on the User page by name.

privateAttributeNames?: string[]

Specifies a list of attribute names (either built-in or custom) which should be marked as private, and not sent to LaunchDarkly in analytics events. This is in addition to any private attributes designated in the global configuration with [[LDOptions.privateAttributeNames]] or LDOptions.allAttributesPrivate.

Generated using TypeDoc