Built-in attributes
Overview
This topic explains what LaunchDarkly’s built-in attributes are and how to configure them.
LaunchDarkly allows you to target contexts based on built-in attributes. To learn more, read Target with flags.
Use built-in attributes
The built-in attributes are kind, key, name, and anonymous. Kind, key, and name attributes must be strings, and anonymous attributes must be booleans. You can define additional attributes for a context by passing in a name and value for each.
The context kind and key are the only mandatory attributes. All other attributes are optional.
Some SDKs will automatically set the kind to “user” if you do not provide a value. Some client-side SDKs will automatically generate the key if the anonymous attribute is set to true.
Here is a table explaining LaunchDarkly’s built-in attributes:
Here is an example of a context with built-in attribute values, though each SDK sends context data to LaunchDarkly in a slightly different format:
Creating searchable context keys
You can structure your context keys so they are both searchable and unique. To do this, we suggest adding a searchable term to the beginning of the key, followed by a unique ID. For example, if you wanted to easily search users that encountered a specific service, you could structure the key as follows: service_name:uuid
.
Alternatively, you can set unique identifiers for contexts in your SDK configuration. To learn more, read Application metadata configuration.
You can view a context’s attributes by clicking on the individual context from the Contexts list.
You can also use the REST API: Get contexts, Search for contexts, Get context attribute names, Get context attribute values