Managing segments
Read time: 3 minutes
Last edited: Nov 19, 2024
Overview
This topic explains how to edit and delete segments. You can update a segment's details, update its targeting, and target segments within flags.
Update segment details
To update a segment's details:
- Navigate to the segment detail page for the segment you want to update.
- Click the gear icon to open the segment's settings page.
- Edit the Name, Description, and Tags for each segment.
- Click Save.
Update segment targeting
To update a segment's targeting:
- Navigate to the segment detail page for the segment you want to update.
- Update the segment's targeting based on the kind of segment:
- For rule-based segments, add, remove, or edit the segment's targeting rules. To learn more, read Rule-based segments.
- For list-based segments, add or remove individual targets or upload a new CSV to overwrite or merge with the existing targets. To learn more, read List-based segments.
- For synced segments, you cannot change segment targeting within LaunchDarkly. Instead, edit the segment in the source application. To learn more, read Segments synced from external tools.
Test segment targeting
You can test a segment's targeting rules to find out whether or not a particular context will be included in the segment. Testing segment targeting helps ensure that contexts are included or excluded from segments as you expect.
To test a segment's targeting:
-
From the Segments list, open the segment you want to test.
-
Make any needed changes to the segment rules and save your changes.
-
Click the fingerprint icon. The "Test run a context" section appears.
-
In the contexts field, search for and select the context you want to preview.
The "Test run a context" section populates with whether or not the context is included in the segment.
Target segments in flags
To target the segment in a flag:
- Navigate to the segment detail page for the segment you want to update.
- Click the > icon to expand the "N flags targeting this segment" callout. "N" is the number of flags currently targeting this segment.
- Click Target this segment.
- In the "Target this segment with a flag rule" dialog, select the flag where you want to use the segment. Then click Target this segment.
Alternatively, you can navigate to the Flags list and add a new targeting rule directly from the flag's Targeting tab.
Delete segments
To delete a segment:
- Navigate to the segment detail page for the segment you want to update.
- Click the gear icon to open the segment's settings page.
- Click Delete this segment.
- In the "Delete segment?" dialog, click Delete.
You cannot delete a segment if one or more flags is using it.
You can also use the REST API: Delete segment