• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Built-in attributes

    Read time: 1 minute
    Last edited: Feb 27, 2023

    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 Targeting rules.

    Using 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.

    LaunchDarkly does not automatically populate built-in attributes

    While LaunchDarkly provides built-in attribute fields for you to fill in, the SDK does not automatically collect any information. If you want to target contexts based on any built-in attributes, you must supply their values.

    Here is a table explaining LaunchDarkly's built-in attributes:

    Attribute nameAttribute example valueNotes
    kind"user"The context kind. Required for evaluation.
    key"context-key-123abc"Required for evaluation. This should be unique for each context.
    name"Sandy Smith"This attribute is optional, but we recommend including it if you need to target flags to individual contexts.
    anonymoustrueIf set, this boolean attribute prevents the context from appearing in the Contexts list. If the anonymous attribute is set to true, LaunchDarkly treats the context as anonymous.
    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.