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.
Overview
This category has documentation topics about LaunchDarkly contexts. Most, but not all, LaunchDarkly SDKs support contexts. Some older SDKs rely on legacy user objects. To learn which SDKs are available to use with contexts, read SDKs.About contexts
LaunchDarkly contexts are data objects that represent users, devices, organizations, and other entities. Feature flags use these contexts during evaluation to determine which variation to use, based on your flag targeting rules. Each context contains attributes that describe what you know about that context, such as their name, location, device type, or organization they are associated with. You can manage how contexts interact with your app by targeting flag variations to specific contexts, based on their context attributes. When a flag is evaluated, LaunchDarkly uses the provided context to determine which variation of the flag to serve. This is known as the evaluation context. You can be as specific as targeting a flag to a single end user, or as broad as targeting your entire customer base. You can even use anonymous contexts and private attributes to control what data to include or exclude in the information you collect about your end users.Example context: Anna at Global Health Services
As an example, let’s assume Anna is one of your end users. She is a doctor who works for a hospital chain called Global Health Services. Anna has two mobile devices, an Android phone and an iPad tablet. Anna uses your application on both devices as part of her work. Given this information, you may know the following things about Anna:- her name, email, and job function (“doctor”),
- her organization’s name (“Global Health Services”),
- her device’s type (“iPad”)
kind, a key, and one or more attributes:
Context kinds
Each context has onekind with a unique set of corresponding attributes that you can use for flag targeting and other features.
The most common context kind is user. Contexts of the user kind often represent individual people and include attributes such as “name,” “email address,” or “location.” However, you can create other context kinds like organization or device. Contexts of an organization kind might include attributes like “name” or “address”, and the context of a “device” kind might include attributes like “type” or “operating system.”
To learn more, read Context kinds.