Segments
Read time: 3 minutes
Last edited: Aug 28, 2024
Overview
This topic introduces the concept of segments. Segments let you target groups of contexts individually or by attribute.
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. 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.
View segments
You can view segments from 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:
- Navigate to the Segments list.
- Add your desired environments to the Segments list following the instructions in Open environments.
- Add any segment filters you need such as tags or segment kind.
- Click the bolt icon above the Segments list to create a shortcut:
- Add a Name for your shortcut.
- (Optional) Choose an Icon to represent your shortcut in the left sidenav.
- Click Save.
Your shortcut appears in the left sidenav.
View segment details
To view a segment's details:
- Navigate to the Segments list.
- Click the Name of the segment.
- The segment details page appears, with the Overview tab selected.
The Overview tab displays information about how many contexts the segment can target or is targeting, which flags use this segment in their targeting, and which variations are served to the contexts in this segment:
The Targeting tab displays information about which contexts this segment targets. The 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.
Target a segment from multiple flags
You can target the same segment from multiple feature flags. If you have many flags that need the same targeting rules, it may be easier to set up a single segment with those rules for your flags to target, rather than setting up the rules repeatedly in each flag.
If you target only a percentage of contexts that match your segment targeting rule, each flag that targets that segment will include the same contexts in its targeting, assuming there are no other differences between the flags' targeting rules.
For example, imagine you configure a segment to target 50% of user contexts that match its rule. As a result, the segment includes user contexts Adrian
, Bailey
, and Cristiano
, and excludes user contexts DJ
, Ellis
, and Felicia
. If there are no other differences between the flags' targeting rules, each flag that targets that segment will also include user contexts Adrian
, Bailey
, and Cristiano
in its targeting, while excluding user contexts DJ
, Ellis
, and Felicia
.
To learn more, read Segment targeting.
Related content
Read the topics in this category to learn how to create, manage, and delete segments: