# Run promotions for Segment audiences

> The Engage Audiences feature in Segment enables you to group users or accounts based on event behavior and traits that Segment tracks.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

In Segment, you can build [an audience](https://segment.com/docs/engage/audiences/)
from a tracking event and synchronize it with [a destination](https://segment.com/docs/connections/destinations/).
By configuring Talon.One as a destination, you can reference the audience in your Talon.One campaigns.

In this tutorial, let's group all users who removed a product from their cart
into an audience. Then, in Talon.One, let's offer these users a convincing discount by issuing a coupon code.

## Talon.One requirements

- You are an [admin](/docs/product/account/account-settings/manage-roles.md#admin-role) user.
- You have set up an [Application](/docs/product/applications/create-and-manage-applications.md).
- Your Application contains a running [campaign](/docs/product/campaigns/create-and-manage-campaigns.md) with the **Coupons** feature
  [enabled](/docs/product/campaigns/settings/manage-campaign-features.md).
- You have [created an audience](/docs/product/audiences/overview.md#create-an-audience).
- You have created a
  [Segment-specific API key](/docs/product/applications/manage-third-party-api-keys.md).

## Segment requirements

- You are an [admin](/docs/product/account/account-settings/manage-roles.md#admin-role) user.
- You have configured a [data source](https://segment.com/docs/connections/sources/) to track events.

## Set up the integration

<StepsContainer>

### Create the Segment audience

In this scenario, we pass event data from a data source to an [audience](https://segment.com/docs/engage/audiences/) in Segment.
Then, we synchronize the audience with a Talon.One destination.

So let's first create an audience that includes all users who removed a product from their cart.

To create the Segment audience:

1. In the Segment sidebar, click **Engage** > **Audiences**.
1. If necessary, create an [Engage space](https://segment.com/docs/engage/quickstart/) or select an existing one.
1. Click **New Audience** > **Audience**.
1. On the **Configure and Preview Your Audience** page,
   click **Add Condition** > **Performed an Event**.
1. In **...performed**, select **Product Removed**, **at least**, `1` **time**.
1. Click **Next**.
1. On the **Select Destinations** page, do not select any destination. We will create the destination in the next step.
1. On the **Review and Create Your Audience** page, type a name
   and optional description and click **Create Audience**.

### Create the Talon.One destination

Now, let's create the [destination](https://segment.com/docs/connections/destinations/):

1. In the Segment sidebar, click **Connections** > **Destinations** > **Add Destination**.
1. On the **Catalog** page, search for `talon` and select the **Talon.One (Actions)** destination.
1. On the overview page, click **Add destination**.
1. On the **Select data source** page, select the **Space** data source that contains your audience and click **Next**.
   :::note important
   Ensure that you select a **Space** data source. Other source types cannot be used to synchronize audiences.
   :::
1. Click **Confirm source**.
1. On the **Basic Settings** page, enter the following information:
   1. In **Destination name**, type a descriptive name for the destination.
   1. In **API Key**, type the API key you [created](#talonone-requirements).
   1. In **Deployment**, type the base URL of your Talon.One deployment, for example `https://mycompany.europe-west1.talon.one/`.
   1. Click the **Enable Destination** toggle and click **Save Changes**.

### Synchronize the audience with the destination

To synchronize the audience you created with the destination you created:

1. In the Segment sidebar, click **Engage** > **Audiences**,
and open the audience you created.
1. Click **Add destination** and select the destination you created.
1. In **Connection settings**, enable **Send Identify** and **Send Track**.
1. In **Enter Event**, type `Product Removed`.
1. Click **Save**.
1. Click **Add 1 destination**.

### Configure data mapping

Data mapping allows you transform the incoming data into a Talon.One-readable format before
passing it to Talon.One.

To configure the data mapping:

1. In the Segment sidebar, click **Connections** > **Destinations**,
   and open the destination you [created](#create-the-talonone-destination).
1. In the **Mappings** tab, click **New Mapping** and select **Update customer profile**.
1. In **Select events to map and send** > **Event Name** > **is**, type `Product Removed`.
1. In **Add test event**, click **Load test event from source**.A test event is displayed in JSON format.
   :::note
   If loading the test event fails, the audience dataset may not be ready. Wait until the audience status changes to **Live**.
   :::
1. In **Select mappings**, map your event fields to the attributes in Talon.One. See the [Segment documentation](https://segment.com/docs/connections/destinations/catalog/actions-talon-one/#update-customer-profile).
   - **Customer Profile ID**: Map this to a field containing a unique identifier. Default is `userId`.
   - **List of audience ID to dissociate with the customer profile**: Leave this field empty. It is used to remove users from an audience, but in our case, we want to add users.
   - **List of audience ID to associate with the customer profile**: Map this to a field containing a list of Talon.One audience IDs, or manually enter a list.
    :::note important
      - The list provided must be enclosed in `[]`. Examples: `[52]`, `[8, 34, 84]`.
      - The specified audiences must exist in Talon.One.
    :::

1. (Optional) To test the mapping, click **Send test event to destination**, and check if a customer has been added to your Talon.One audience.
1. Click **Save**.
1. In the **Mappings** table, under **Status**, enable the mapping.

### Build the rule in Talon.One

In your Talon.One [campaign](/docs/product/campaigns/overview.md),
you can now reference the audience you defined in Segment.

In your [rule](/docs/product/rules/overview.md), use the **Is member of an audience** condition
and the **Create coupon code** effect to create coupon codes for the members of your audience.

:::tip
You can also use the other available
[audience conditions](/docs/product/rules/conditions/available-conditions.md#audience-conditions)
in the Rule Builder.
:::

</StepsContainer>

## Related pages

- [Talon.One (Actions) Destination](https://segment.com/docs/connections/destinations/catalog/actions-talon-one/)
- [Send Audiences to Destinations](https://segment.com/docs/engage/audiences/#send-audiences-to-destinations)
