# Facebook Custom Audiences (Actions)

## 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 **Facebook Custom Audiences (Actions)** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)

Deliver effective Facebook Ads campaigns by defining and syncing [custom audiences](https://developers.facebook.com/documentation/ads-commerce/marketing-api/audiences/guides/custom-audiences) to power ad suppression, acquisition (using lookalikes), retargeting, and more.

This destination sends audiences, or lists of users, to Facebook Custom Audiences.

This Destination works with both [Reverse ETL](/docs/segment/connections/reverse-etl) and [Engage](/docs/segment/engage).

* Connect this destination to Reverse ETL sources to sync data from your warehouse to Facebook Custom Audiences.
* Connect this destination to Engage to sync Engage Audiences to Facebook Custom Audiences.

## Getting started

### Prerequisites

* A source already set up.
  * For Reverse ETL: If you don't yet have a Reverse ETL source, follow the instructions in Segment's [Reverse ETL documentation](/docs/segment/connections/reverse-etl/#getting-started). Segment recommends setting an [External ID](#sync-audience) as the primary key for your Reverse ETL model, as you'll need an External ID to remove users from your custom audiences.
  * For Engage Audiences: An [Engage Audience](/docs/segment/engage/audiences/) that you can connect to this destination.
* A Facebook account with [ads\_management](https://developers.facebook.com/docs/permissions#ads_management) permissions for the target Facebook Ad Account(s). The Facebook Ad Account(s) must also be associated with a [Facebook Business Account](https://www.facebook.com/business/help/407323696966570?id=649869995454285).
* Ensure that the user connecting to the destination using OAuth has at least an *Advertiser* or *Admin* role on the ad account. To manage permissions and roles for an ad account, reference [Facebook's documentation](https://www.facebook.com/business/help/186007118118684?id=829106167281625).

### Create the Facebook Custom Audiences destination

1. From your Segment app, navigate to **Catalog > Destinations** and search for "Facebook Custom Audiences (Actions)".
2. Select the Facebook Custom Audiences (Actions) destination and click **Add destination**.
3. Select the source you'd like to connect to your Facebook Custom Audiences (Actions) Destination and click **Next**.
4. Enter a name for your destination and click **Create destination**.
5. Navigate to your destination's settings page and click **Connect to...** to authenticate with Facebook.
6. Return to the Segment app and enter your Advertiser Account ID. See Facebook's [Find your Facebook ad account ID number](https://www.facebook.com/business/help/1492627900875762) documentation for more information.
7. Save the changes you've made and **Enable** your destination.

### Engage Audience setup steps

Follow these steps to connect to an Engage Audience.

1. Navigate to **Connections > Destinations**, search for the **Facebook Custom Audiences (Actions)** destination you just created, and click on it.
2. Navigate to **Mappings > New Mapping** and click on the **Sync Audience** tile.
3. You don't need to change the Sync Mode or event-trigger settings.
4. If you plan to sync additional user profile traits or identifiers to Facebook, configure the fields in the **Map Fields** section.
5. Click **Save**.
6. Back on the Mappings tab, enable the **Sync Audience** Action.

Next, connect your Engage Audience to the Sync Audience Action.

7. Navigate to **Engage > Audiences**, then select the Audience you'd like to sync.
8. Click **Add Destination** then select the **Facebook Custom Audiences (Actions)** destination you created in previous steps.

* Configure the **Advertiser Account ID** and **Description** fields.
* *Optional*: Click **Customized Setup** if you want Engage to sync additional user traits or identifiers to the destination. Note that you must have already mapped these traits and identifiers in the Sync Audience Action (in step 4).

9. This destination supports the Identify and Track methods. Both work in the same way. If you're using Track, there's no need to set an event name as the destination ignores any set event name.
10. Click **Save** to apply the changes, then click **Add 1 Destination** to save the destination configuration.
11. After a period of time, Segment syncs the Audience to Facebook.

### Reverse ETL setup steps

Follow these steps to connect to an Reverse ETL source.

1. Navigate to **Connections > Sources** and select your Reverse ETL source.
2. On the Models page, select the model you'd like to use and click **Add Mapping**.
3. Select the Facebook Custom Audience (Actions) destination and the Sync Audience action.
4. On the Set up mapping page, select the desired Sync Mode. The default is Mirror, which syncs new rows, changes to rows, and row deletions.
5. Select or create an audience in Facebook to sync your data with.
6. Click **Select or create an audience in Facebook** to save the audience ID to your mapping.
7. Map your model columns to the appropriate Facebook Custom Audience parameters. For more context about data formatting, see the [Sync Audience](#sync-audience) and [Data processing](#data-processing) documentation.
   * Map External ID to a unique user identifier from your system (like User ID, CRM ID, or anonymous ID.) Segment recommends using the External ID column as your primary key when setting up your Reverse ETL model so you can more easily remove users from your custom audience. External ID is the only field Facebook requires.
   * Segment recommends mapping as many parameters as you have available in your source model so that you can increase your match rates.
8. Send a test record. If successful, you should see a 200 response in Segment and one added record to your custom audience. To verify that the record was successfully added to your custom audience, open Facebook Ads Manager and navigate to **Audiences > \{Audience Name} > History**.
9. Click **Save Mapping** and enable the mapping.

## Destination Settings

| Field                 | Description                                                                                                                                                                                                                          | Required | Type   |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------ |
| Advertiser Account ID | Your advertiser account id. Read \[more]\(https://www.facebook.com/business/help/1492627900875762). This is required to set up the connection, but can be overriden using the Engage Audience setting named "Advertiser Account ID". | Yes      | string |

## Available Actions

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

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

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

### Sync Audience

Sync data to Facebook Custom Audiences.

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

| Field                                                       | Description                                                                                                                                                                                                                                                                                                          | Required | Type   |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ |
| External ID                                                 | Your company’s custom identifier for this user. This can be any unique ID, such as loyalty membership IDs, user IDs, and external cookie IDs. If not hashed, Segment will hash this value.                                                                                                                           | Yes      | STRING |
| Email                                                       | User’s email (ex: foo@bar.com). If not hashed, Segment will hash this value.                                                                                                                                                                                                                                         | No       | STRING |
| Phone                                                       | User’s phone number, including country code. Punctuation and spaces are ok (ex: 1-234-567-8910 or +44 844 412 4653). If not hashed, Segment will hash this value.                                                                                                                                                    | No       | STRING |
| Date of Birth                                               | User’s date of birth. Include as many fields as possible for better match rates (ex: year = YYYY, month = MM, day = DD). If not hashed, Segment will hash this value.                                                                                                                                                | No       | OBJECT |
| Name                                                        | User’s name. Include as many fields as possible for better match rates. Use a-z only. No punctuation. Special characters in UTF-8 format. If not hashed, Segment will hash this value.                                                                                                                               | No       | OBJECT |
| Gender                                                      | User’s gender (m for male, f for female). If not hashed, Segment will hash this value.                                                                                                                                                                                                                               | No       | STRING |
| City                                                        | User’s city. Use a-z only. No punctuation. No special characters. If not hashed, Segment will hash this value.                                                                                                                                                                                                       | No       | STRING |
| State                                                       | User’s state. Use the 2-character ANSI abbreviation code, Normalize states outside the US with no punctuation and no special characters. If not hashed, Segment will hash this value.                                                                                                                                | No       | STRING |
| Postal Code                                                 | User’s postal code. For the US, use only the first 5 digits. For the UK, use the Area/District/Sector format. If not hashed, Segment will hash this value.                                                                                                                                                           | No       | STRING |
| Country                                                     | User’s country. Use 2-letter country codes in ISO 3166-1 alpha-2 format. If not hashed, Segment will hash this value.                                                                                                                                                                                                | No       | STRING |
| Mobile Advertising ID                                       | User’s Apple IDFA, Android Ad ID, or Facebook app scoped ID. Keep hyphens (ex: AB1234CD-E123-12FG-J123). If not hashed, Segment will hash this value.                                                                                                                                                                | No       | STRING |
| App ID                                                      | The app ID of the user. If not hashed, Segment will hash this value.                                                                                                                                                                                                                                                 | No       | STRING |
| Page ID                                                     | The page ID of the user. If not hashed, Segment will hash this value.                                                                                                                                                                                                                                                | No       | STRING |
| Instagram Account IDs                                       | The Instagram account ID of the user.                                                                                                                                                                                                                                                                                | No       | STRING |
| Create a new custom audience or connect to an existing one? | Choose to either create a new custom audience or use an existing one. If you opt to create a new audience, we will display the required fields for audience creation. If you opt to use an existing audience, a drop-down menu will appear, allowing you to select from all the custom audiences in your ad account. | No       | STRING |
| Audience Creation Name                                      | The name of the audience in Facebook.                                                                                                                                                                                                                                                                                | No       | STRING |
| Existing Audience ID                                        | The ID of the audience in Facebook.                                                                                                                                                                                                                                                                                  | No       | STRING |
| Select or create an audience in Facebook                    | When saving this mapping, Segment will either create a new audience in Facebook or connect to an existing one. To create a new audience, enter the name of the audience. To connect to an existing audience, select the audience ID from the dropdown.                                                               | No       | OBJECT |

## Data processing

To improve match rates, Segment built in normalization and hashing for common fields to align with [Facebook's recommended best practices](https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences/#hash).

### Normalization

Segment automatically strips whitespace and converts the following fields to lowercase:

* Email
* First name
* Last name
* First initial
* City
* State
* Country

Segment normalizes the Phone field by removing any non-numeric symbols, whitespace, and leading zeroes.

### Hashing

Facebook requires you to hash all PII before sending it to the Facebook Conversions API.

Segment automatically hashes any of the following fields that are not already SHA256 hashed at egress:

* Email
* Phone
* First name
* Last name
* First initial
* City
* State
* Postal code
* Country
* Year of birth
* Month of birth
* Day of birth
* Gender

## Additional trait matching

Segment [Trait Enrichment](/docs/segment/engage/trait-activation/trait-enrichment/) lets you send an expanded list of identifiers or traits to Facebook so that it can use these additional data points to match your users to their user profiles. If you have this feature enabled and implemented any of these traits in your Segment tracking, the Facebook Custom Audiences (Actions) destination can send this data to Facebook.

## FAQs and troubleshooting

### Which Sync Mode should be used?

When connecting to an Engage Audience, syncMode should be left as Mirror.
When connecting to Reverse ETL:

* Mirror: syncs data when new rows are added, rows are updated, and when rows are removed.
* Upsert: syncs data when new rows are added or rows are updated.
* Delete: syncs data only when rows are removed.

### Audience not creating and/or existing audience list not populating

If you're unable to create a new audience or select existing audiences while creating a mapping, this might be due to an authentication error. Verify that you've authenticated with Facebook under Destination Settings and that the Facebook user that authenticated with Segment can access your Advertiser Account ID.

### Audience size smaller than expected

Segment sends lists of users with the identifiers you've mapped from your source model. The matching logic itself occurs within Facebook. Facebook is more likely to be able to match a user profile if you track as many identifiers as possible, like email, mobile advertising identifiers (IDFA, Google advertising ID), and others. If Facebook is unable to identify users based on the data that you provide, then the match rate will be low.

As an example, many B2B SaaS businesses have users that sign up for their products with a work email address, like [jane.doe@segment.com](mailto:jane.doe@segment.com). However, most Facebook users sign up for Facebook with a personal email only, like [janedoe@gmail.com](mailto:janedoe@gmail.com). If you only provide Facebook with the work email address and no other identifiers, then Facebook can't match your user to the Jane Doe Facebook profile. This is the case for all identifiers: Facebook must have the identifier somewhere in a user's profile or they can't match on it.

### Do you support value-based lookalikes?

While Facebook has a feature called value-based lookalikes, where you can send an additional field like LTV to optimize campaigns based on a customer's value, there is currently no way to sync LTV data to a value-based lookalike using the Facebook Custom Audiences (Actions) destination.

### Can I leave a field empty when sending events to Facebook Custom Audiences (Actions)?

You can leave some fields empty when sending events to Facebook Custom Audiences (Actions).

If a value isn't available for one of the following fields, you can safely pass an empty string ("") to bypass Segment's validation.

* External ID
* Email
* Phone
* Mobile Advertising ID
* First name
* Last name
* First initial
* City
* State
* Postal code
* Country
* Year of birth
* Month of birth
* Day of birth
* Gender

[As required by Facebook](https://www.facebook.com/business/help/2082575038703844?id=2469097953376494), Segment validates these fields to catch invalid or bad data, like `/` or `-`. Sending these values causes `401 Bad Request` errors.

However, if you send an empty string for these fields, Segment processes your events correctly while still meeting Facebook's requirements.

## 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 Facebook Custom Audiences (Actions) may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.
