For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Get started
    • Overview
    • Onboarding
    • Get started
    • Launch Insights
    • LaunchDarkly architecture
    • LaunchDarkly vocabulary
  • AgentControl
    • AgentControl
    • Manage AgentControl
  • Feature flags
    • Create flags
    • Target with flags
    • Flag templates
    • Manage flags
    • Code references
    • Contexts
    • Segments
      • Creating segments
      • Targeting segments
      • Managing segments
      • Segment types
      • SDK and integration configuration for segments
  • Releases
    • Releasing features with LaunchDarkly
    • Release policies
    • Percentage rollouts
    • Progressive rollouts
    • Guarded rollouts
    • Feature monitoring
    • Release pipelines
    • Engineering insights
    • Release management tools
    • Applications and app versions
    • Change history
    • Restoring previous flag versions
  • Observability
    • Observability
    • Session replay
    • Error monitoring
    • Logs
    • Traces
    • Observability metrics
    • Product analytics events
    • LLM observability
    • Alerts
    • Dashboards
    • Service map
    • Vega for auto-remediation
    • Observability MCP server
    • Search specification
    • Observability settings
    • Observability integrations
  • Experimentation
    • Experimentation
    • Experiment metric types
    • Experiment configuration
    • Managing experiments
    • Analyzing experiments
    • Multi-armed bandits
    • Holdouts
  • Metrics and events
    • Metrics in LaunchDarkly
    • Creating metrics
    • Metric groups
    • Events
    • Autogenerated metrics
  • Warehouse native
    • Warehouse native metrics
    • Setting up external warehouses
    • Creating experiments using warehouse native metrics
  • Infrastructure
    • Connect apps and services to LaunchDarkly
    • LaunchDarkly in China and Pakistan
    • LaunchDarkly in the European Union (EU)
    • LaunchDarkly in federal environments
    • Public IP list
  • Your account
    • Projects
    • Views
    • Environments
    • Tags
    • Teams
    • Members
    • Roles
    • Account security
    • Feature previews
    • Billing and usage
    • Changelog
Sign inTry it free
LogoLogo
On this page
  • Overview
  • How to use segments
  • Example use
  • View segments
  • Save filtered Segments lists
  • View segment details
  • Related content
Feature flags

Segments

Was this page helpful?
Previous

Creating segments

Next
Built with

Overview

This topic introduces the concept of segments. Segments let you group together users, accounts, or other contexts so you can easily target them as a group in your flag targeting rules. This helps guarantee that the right groups of people are getting the right flag variations every time, instead of having to build your flag targeting rules from scratch for every flag.

Some examples of segments you could create include:

  • Internal users: a group of internal employees who test new features before you release them to your beta testers.
  • Beta testers: A group of customers that have agreed to act as beta testers for new products and features
  • Enterprise accounts: a group of all of your enterprise-level customer accounts who should have access to your premium features

Here is an example of a flag targeting a “Mobile beta” segment:

A flag rule targeting a "Mobile beta" segment.

A flag rule targeting a "Mobile beta" segment.

When you target segments in a flag rule, selecting multiple segments in a single condition uses OR logic. The rule matches if the context is a member of any one of the selected segments.

How to use segments

Using segments requires three steps:

  1. Create the segment
  2. Add targeting rules or add lists of contexts to target
  3. Target that segment in one or more flags

Like contexts, segments are environment-specific.

We recommend using tags on your segments to help you understand quickly which segments are associated with which projects or teams. To learn more, read Tags.

Example use

For an example of how you can use segments, read Using segments and targeting to manage early access programs.

View segments

You can view segments from the Segments list:

The "Segments" list.

The "Segments" list.

From the list, you can filter segments to display only those matching the criteria you select. You can filter based on tags or segment kind using the Tags and Kind menus.

Save filtered Segments lists

You can create shortcuts to filtered Segments lists, and save them in the left sidenav to return to at any time.

To create a shortcut to a filtered Segments list:

  1. In the left navigation, click Code. The CodeControl menu appears.
  2. Click Segments.
  3. Add your desired environments to the Segments list following the instructions in Open environments.
  4. Add any segment filters you need such as tags or segment kind.
  5. Click the bolt icon above the Segments list to create a shortcut:

The Segments list with the "bolt" shortcut icon called out.

The Segments list with the "bolt" shortcut icon called out.
  1. Add a Name for your shortcut.
  2. (Optional) Choose an Icon to represent your shortcut in the left sidenav.
  3. Click Save.

Your shortcut appears in the left sidenav.

A list of shortcuts in the left sidenav.

A list of shortcuts in the left sidenav.

View segment details

To view a segment’s details:

  1. In the left navigation, click Code. The CodeControl menu appears.
  2. Click Segments.
  3. Click the Name of the segment.
  4. The segment details page appears.

The segment details page displays information about:

  • which flags use this segment in their targeting rules
  • which flag variations are served to the contexts in this segment
  • which individual targets are included or excluded from this segment
  • the targeting rules for this segment

A segment's details page.

A segment's details page.

For each segment, contexts may be specified individually, by rules, by an uploaded file, or by a third-party application that is synced with LaunchDarkly. If the contexts are specified by a file or if they are synced, you can search for specific contexts that are included in this segment.

Related content

Read the topics in this category to learn how to create, manage, and delete segments:

  • Creating segments
  • Targeting segments
  • Managing segments
  • Segment types
  • SDK and integration configuration for segments