# LaunchDarkly Audiences Destination

## Destination Info

* Accepts [Page](/docs/segment/connections/spec/page), [Alias](/docs/segment/connections/spec/alias), [Group](/docs/segment/connections/spec/group), [Identify](/docs/segment/connections/spec/identify), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **LaunchDarkly Audiences** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This integration is **partner owned.** Please reach out to the partner's support for any issues.

[LaunchDarkly](https://launchdarkly.com) is a feature management platform that empowers development teams to safely deliver, control, and measure their software through feature flags.

With LaunchDarkly, you can release features that target specific groups, such as beta users, and premium accounts, using segments. This destination allows you to sync Engage Audiences to LaunchDarkly segments, letting you concentrate more on deploying features and less on managing end users between platforms.

LaunchDarkly maintains this destination. For any issues with the destination, [contact the LaunchDarkly Support team](mailto:support@launchdarkly.com).

## Getting started

1. In LaunchDarkly, navigate to [Account settings](https://app.launchdarkly.com/settings/projects) and copy the client-side ID for the project and environment where you would like to create an Engage Audience synced segment.
2. In LaunchDarkly, create a service token with either a Writer role or a custom role. If your service token has a custom role, it must have the actions `createSegment` and `updateIncluded` to sync a segment from an Engage Audience. To learn how to create a service token, read [Creating API access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens#creating-api-access-tokens).
3. From the Segment web app, navigate to **Engage > Audiences**. Ensure you are in the Engage space you plan to use with the LaunchDarkly Audiences destination. Either choose an existing Engage audience or create a new one. This is the audience you plan to sync with LaunchDarkly.
4. Navigate to **Engage > Engage Settings** and click **Destinations**. Ensure you are still in the correct Engage space.
5. Search for `LaunchDarkly Audiences` and select the destination. Click **Add destination**.
6. On the **Select Source** screen, your Engage space should already be selected as the source. Click **Confirm Source**.
7. On the Destination **Settings** tab, name your destination and provide your LaunchDarkly client-side ID and service token.
8. Toggle **Enable Destination** on and click **Save Changes**.
9. Navigate to the **Mappings** tab, click **New Mapping**, and select the **Sync Engage Audience to LaunchDarkly** pre-built mapping.
10. Under **Select mappings**, modify the default mappings as needed. In most cases, you shouldn't need to make any changes.
11. Click **Save**.
12. Ensure the **Status** toggle on the **Mappings** tab is enabled.

## Destination Settings

| Field                       | Description                                                                                                                                                                                                                                                                                                                                                             | Required | Type     |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- |
| LaunchDarkly Service Token  | We recommend creating a dedicated \[LaunchDarkly service token]\(https://docs.launchdarkly.com/home/account-security/api-access-tokens#service-tokens) for this destination. The service token must have the ability to perform the \`createSegment\` and \`updateIncluded\` \[role actions]\(https://docs.launchdarkly.com/home/members/role-actions#segment-actions). | Yes      | password |
| LaunchDarkly client-side ID | Copy the \[client-side ID]\(https://app.launchdarkly.com/settings/projects) of the environment for your segment. You can find this in the LaunchDarkly \*\*Account settings\*\* page for your project.                                                                                                                                                                  | Yes      | string   |

## Available Presets

LaunchDarkly Audiences has the following presets

| Preset Name                          | Trigger                                        | Default Action |
| ------------------------------------ | ---------------------------------------------- | -------------- |
| Sync Engage Audience to LaunchDarkly | Event type = "identify", Event  type = "track" | Sync Audience  |

## Available Actions

Build your own Mappings. Combine supported [triggers](/docs/segment/connections/destinations/actions/#components-of-a-destination-action) with the following LaunchDarkly Audiences-supported actions:

> \[!NOTE]
>
> Individual destination instances have support a maximum of 50 mappings.

* [Sync Audience](#sync-audience-4)

### Sync Audience

Sync Engage Audiences to LaunchDarkly segments

Sync Audience is a **Cloud** action. The default Trigger is `type = "identify" or type = "track"`

| Field        | Description                                                                                                                                                                                                              | Required | Type    |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- |
| Context kind | The event's context kind. To learn more about context kinds and where you can find a list of context kinds LaunchDarkly has observed, read \[Context kinds]\(https://docs.launchdarkly.com/home/contexts/context-kinds). | Yes      | STRING  |
| Context key  | The unique LaunchDarkly context key. In most cases the Segment UserId should be used.                                                                                                                                    | Yes      | STRING  |
| Batch events | When enabled, the action will batch events before sending them to LaunchDarkly. In most cases, batching should be enabled.                                                                                               | No       | BOOLEAN |

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to LaunchDarkly Audiences  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field                       | Description                                                                                                                                                                                                                                                                                                                                                             | Required | Type     |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- |
| LaunchDarkly Service Token  | We recommend creating a dedicated \[LaunchDarkly service token]\(https://docs.launchdarkly.com/home/account-security/api-access-tokens#service-tokens) for this destination. The service token must have the ability to perform the \`createSegment\` and \`updateIncluded\` \[role actions]\(https://docs.launchdarkly.com/home/members/role-actions#segment-actions). | Yes      | password |
| LaunchDarkly client-side ID | Copy the \[client-side ID]\(https://app.launchdarkly.com/settings/projects) of the environment for your segment. You can find this in the LaunchDarkly \*\*Account settings\*\* page for your project.                                                                                                                                                                  | Yes      | string   |
