LaunchDarkly feature flags let you map flag targeting to your precise business needs. Flag and segment targeting can help you govern critical parts of user experiences, tailoring them to each audience segment and adapting them to changing conditions, without requiring custom code.
With custom targeting, you can do things like:
As an example of how you can use segments and targeting to meet your business needs, this guide provides strategies for managing early access programs (EAPs).
An EAP is a way to release a feature to a small subset of customers for early evaluation and testing. You can use EAPs to gather feedback from strategic stakeholders or users, gauge interest in the feature, create marketing opportunities, and build relationships with external stakeholders.
EAPs can be appropriate for highly innovative or highly demanded features, or other features where feedback from strategically chosen customers would be valuable.
To complete this guide, you must have the following prerequisites:
You should understand these concepts before you read this guide:
There are three kinds of LaunchDarkly segments:
To learn more, read Segments.
Some of the techniques in this guide limit your targeting to just one context kind. For early access programs, it’s likely that you will be targeting on a context kind such as user or customer. If you need to target on more than one context kind, you cannot use large list-based segments.
To learn more, read Context kinds.
Before you begin building your EAP, consider the following questions:
There are four ways you can target your EAP customers within segments:
No matter what method you use, we recommend adding an eap tag to your segments so it’s easy to search for segments associated with an early access program.
If you are using server-side SDKs, then you must also be using the Relay Proxy and it must be configured to use synced segments. To learn more, read Implementing the Relay Proxy.
This method is our recommended approach to managing large EAPs if you use an external tool such as Amplitude or Segment.
Configure your SDK: Relay Proxy configuration
To begin, you must create the segment in your external tool. We have provided examples using Amplitude and Segment here, but you can use any of our segment integrations.
Open each section below to learn how to create a segment synced with LaunchDarkly in either Amplitude or Segment:
To configure a segment that syncs with an Amplitude cohort, you must choose a cohort in Amplitude and tell it to send data to LaunchDarkly. When you do this correctly, the cohort appears as a segment in LaunchDarkly.
To do this, first add LaunchDarkly as a destination and then sync the cohort to the LaunchDarkly destination.
To learn more, read Syncing segments with Amplitude cohorts.
To configure a segment that syncs with a Twilio Segment Audience, you must choose an Audience in Twilio Segment and configure it to use the LaunchDarkly Audiences destination. When you do this, the cohort appears as a segment in LaunchDarkly.
To do this, you will need to first configure the LaunchDarkly Audiences destination and then add the LaunchDarkly Audiences destination as a Twilio Segment Audience.
To learn more, read Syncing segments with Twilio Segment Audiences.
After you set up your synced segment it will appear automatically in LaunchDarkly in the Segments list. We recommend adding an eap tag to the segment from the segment’s settings. To learn how, read about adding tags to segments.
To update the customers included in a synced segment, make the changes in your external tool. The changes will automatically sync with the segment in LaunchDarkly.
If you are using server-side SDKs, then you must also be using the Relay Proxy and it must be configured to use big segments. To learn more, read Implementing the Relay Proxy.
Maintaining an external list of EAP customers allows you to have very large opt-in programs without impacting performance or payload size. You should use this option when you will have thousands of opt-ins to your program, and can export those opt-ins to a CSV file. This option requires that all of the targeted contexts are of the same context kind.
Configure your SDK: Relay Proxy configuration, Big segments
Before you create and populate your segment, you must have a CSV file including all of the contexts to include in your EAP program. The context keys should be in the first column of the CSV file, and the file should not contain a header row.
To create and populate the segment:
eap tag from the Tags menu.
You can also use the REST API: Create segment, Create big segment import
You can add to or overwrite the current list of contexts by uploading a new CSV file from the segment’s details page. If you are merging contexts, they must be of all the same context kind.
When you upload the new CSV file:
You can target on any context attribute in a rule-based segment. For example, perhaps you capture customer sign-ups using a form, and store it in an attribute called eap-opt-in that your SDK passes in to LaunchDarkly. In this scenario, your segment would target anyone with an eap-opt-in attribute value of yes.
To create the segment:
eap tag from the Tags menu.To add targeting rules:
eap-opt-in.yes.
Now all contexts that match the targeting rule will be included in the EAP.
Another approach, if you have multiple EAPs running concurrently, is to store multiple attribute values in your eap-opt-in attribute. For example, if you are running two different EAPs, the flag controlling the first EAP could target on eap-opt-in attributes with a value of eap1, and the flag controlling the second EAP could target on eap-opt-in attributes with a value of eap2. You can then pass in an array of values for customers that are in both EAPs.
Configure your SDK: Context configuration
To update a rule-based segment, navigate to the segment’s details page and edit the existing rule, or add a new rule. Be sure you are passing in the desired context attribute values from your SDK.
You can also use the REST API: Patch segment
You can use individual targets to implement small EAPs. Use individual targets when you have a smaller number of opt-ins and want to avoid the cost of implementing your own external list.
To create the segment:
eap tag from the Tags menu.You can further edit the segment’s settings by clicking the gear icon to manage settings.
To add EAP members to the segment:
user contexts, choose contexts to include in or exclude from the segment.user:You can also use the REST API: Create segment
To view or add new customers to the EAP, navigate to the segment’s details page and view or edit the “Individual targets” section.
To remove a member from the segment, click the “x” next to the context in the “Individual targets” section and save your changes.
You can also use the REST API: Patch segment
After you create your EAP segments, you can target the EAP segment in your EAP-related flags using a targeting rule. Targeting a segment, rather than creating individual targeting rules for each flag, ensures you’re targeting the exact same contexts every time and eliminates the need to update multiple targeting rules in multiple flags if something changes.
To target segments:
Navigate to the Targeting tab for the flag.
If the flag is off and the rules are hidden, click View targeting rules.
Click the + button between existing rules, and select Target segments.

(Optional) Enter a name for the rule. We recommend including “EAP” in the name.
In the Operator menu, select “is in.”
In the Segments menu, enter or select the EAP segments you want to target.
From the Select… menu, select the variation to serve.
Click Review and save.
Here is an example of a targeting rule for segments:

You can also use the REST API: Update feature flag
To view which flags are using an EAP segment, navigate to the Segments list and click the name of the EAP segment. The segment’s details page appears. It displays how many flags target the segment and which variations those flags are serving.

Anyone with a LaunchDarkly Project Admin, Maintainer, or Developer project role, or a Writer, Admin, or Owner base role can edit segments. You can use views to scope access to EAP-related segments.
To scope segment edit permissions with views:
This approach keeps role definitions consistent while letting you scope access by project and view.
To learn more, read Onboarding to views, Use views in complex policy statements, and Creating roles and policies.
In this guide, you learned about managing early access programs using segments and targeting. LaunchDarkly offers a variety of segment types to easily manage and target your EAP customers, no matter the program size. For more examples of how segments and targeting can help you meet your business needs, read Using entitlements to manage customer experience.