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

EDIT ON GITHUB

Segments

Read time: 7 minutes
Last edited: Sep 25, 2023
Segments are a Pro and Enterprise feature

Segments are available to customers on a Pro or Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Overview

This topic explains how to build and manage segments. Segments let you target groups of contexts individually or by attribute. Contexts are people, services, machines, or other resources that encounter feature flags in your product.

Segments are useful for keeping groups of contexts up to date. They let you more quickly turn features on or off for certain groups with confidence. For example, segments are helpful when you want to target a specific group of customers, like beta-users or enterprise-customers, across many different flags, or in an experiment.

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.

Understanding segments

LaunchDarkly supports two types of segments:

  • Standard segments, which can be rule-based or smaller list-based segments
  • Big Segments, which can be segments synced from external tools or larger list-based segments

Understanding segment types

There are a few differences between standard segments and Big Segments. You cannot convert a segment from one kind to another after you create it, so choose the kind that best suits your use case when you create it.

This table explains the differences between standard segments and Big Segments:

Segment type

Number of contexts

Backed by external data store

Supports uploading contexts from CSV

Supports targeting rules

Supports multiple context kinds

Standard segments

Up to 15,000

Big Segments

More than 15,000

Managing segments

You can view standard and Big Segments on the Segments list.

From the list, you can filter segments to display only those synced from Amplitude.

The "Segments" list with the "Amplitude synced cohorts" filter applied.
The "Segments" list with the "Amplitude synced cohorts" filter applied.

Creating segments

To create a new segment:

  1. Navigate to the Segments list.
  2. Click Create segment. The "Create a segment" panel appears.
The "Segments" list with the "Create segment" button called out.
The "Segments" list with the "Create segment" button called out.
  1. Give your segment a human-readable Name.
  2. Enter a Key for the segment. This field auto-populates based on the segment name, but you can change it if you need to.
  3. (Optional) Add a Description.
  4. (Optional) Select a tag or create a new tag from the Tags menu.
  5. Select the Standard option to create a standard segment, or the Big option to create a Big Segment. You cannot convert a segment from one kind to another after you create it.
The "Create a segment" panel.
The "Create a segment" panel.

  1. Click Save segment. The segment's Targeting tab appears.

You can further edit the segment's settings from its Settings tab.

You can also use the REST API: Create segment

Deleting segments

To delete a segment, find the segment you want to delete on the Segments list and click Delete.

You can also use the REST API: Delete segment

Targeting with segments

There are some differences between flag targeting and segment targeting:

  • Segments are environment-specific. They do not populate in environments other than the one you created them in.
  • Segment targeting can reference another segment only if both segments exist in the same environment, and if you're using a version of an SDK that supports contexts.
Not all SDKs support targeting segments within segments

To target a segment within another segment, you must be using a version of an SDK that supports contexts. To learn more, read the list of SDKs that support contexts.

If you target a segment within another segment but are using an older SDK, the flag will skip the segment targeting rule and evaluate contexts against the next subsequent rule.

Like flags, you cannot create a circular reference between two segments, for example, where segment A targets segment B and segment B targets segment A.

Here are the topics in this category:

  • Rule-based segments
  • List-based segments
  • Segments synced from external tools