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
  • Target segments
  • Target from within a segment
Feature flagsSegments

Targeting segments

Was this page helpful?
Previous

Managing segments

Next
Built with

Overview

This topic explains how to target a segment in a flag rule. If you have many flags that need to target the same group of users or other contexts, we recommend that you create a single segment for your flags to target. This lets you manage targeting for that group in one place instead of recreating identical rules in each flag.

Target segments

To target a segment within a flag rule:

  1. Navigate to the Targeting tab for the flag.
  2. If the flag is off and the rules are hidden, click View targeting rules.
  3. Click the + button between existing rules.
  4. Select “Target segments”:

The "+" menu, with targeting options.

The "+" menu, with targeting options.
  1. (Optional) Enter a name for the rule.

  2. In the Operator menu, select whether you want contexts in these segments or not in these segments to match the targeting rule.

  3. In the Segments menu, enter or select the segments you want to target.

    Segment conditions use OR logic. If you select more than one segment in a “Context is in Segments” condition, the condition matches if the context is a member of any one of the selected segments.

  4. (Optional) Click the + to add additional clauses to your targeting rule.

  5. From the Select… menu, choose a rollout option:

    • a single variation to serve
    • a manual percentage rollout
    • a progressive rollout
    • a guarded rollout
    • an experiment
  6. Click Review and save. The “Save changes” dialog appears.

  7. Review your targeting changes, add comments, or request approval as needed.

  8. (Optional) Click Test run to preview the percentage of contexts that will receive each flag variation.

  9. Click Save changes.

Here is an example of a targeting rule for segments:

A targeting rule for segments.

A targeting rule for segments.

Target from within a segment

You can also target a segment starting from the segment itself. Here’s how:

  1. Navigate to the segment you want to target.
  2. Click Target this segment. A “Target this segment with a flag rule” dialog appears.
  3. Select the flag where you want to use the segment.
  4. Click Target this segment.

You are taken to the flag’s targeting page to complete the segment targeting rule.