---
title: Facebook Pixel
slug: facebook-pixel
docTags: 
createdAt: 2023-12-19T15:56:47.304Z
---

## Overview

Chord’s Facebook integration works best when both browser and server events are sent to Facebook. We recommend configuring two Facebook Segment destinations:

1. A [Facebook Pixel destination](https://segment.com/docs/connections/destinations/catalog/facebook-pixel/), connected to your website front-end Segment source.
2. A [Facebook Conversions API destination](https://segment.com/docs/connections/destinations/catalog/actions-facebook-conversions-api/), connected to your server Segment source.

Alternatively, you can connect a second Facebook Conversions API destination to your website front-end Segment source and omit the Facebook Pixel destination.

This setup results in pre-checkout events (ex. `Product Added`) and one post-checkout event, `Order Completed`, being sent to Facebook from your website front end source, and post-checkout events (ex. `Order Completed`) being sent to Facebook from your server source.

`Order Completed` is duplicated from both sources for maximum reliability. For Chord tracking events, Facebook [handles duplicate events](https://developers.facebook.com/docs/marketing-api/conversions-api/deduplicate-pixel-and-server-events) by comparing the event name and the `external_id` property, which should be set to Segment’s`userId` (or `anonymousId` if not present). See instructions below for how to configure your Facebook Pixel and Conversions API destinations to use `userId`/`anonymousId` as Facebook’s `external_id`.

## Facebook Pixel destination

This destination loads the Facebook Pixel Javascript library in the browser and sends Chord events to it client-side, without hitting Segment’s servers first.

First, configure the Facebook Pixel destination [according to Segment documentation](https://segment.com/docs/connections/destinations/catalog/facebook-pixel/#getting-started).

### Event Mapping

To map Chord Segment events to standard Facebook events, create the mappings in the destination setting “Map Your Events to Standard FB Events”. The following mapping is recommended as a minimum:

- `Order Completed`, which Segment sends to Facebook as `Purchase`
- `Product Added`, which Segment sends as `AddToCart`
- `Product List Viewed`, which Segment sends as `ViewContent`
- `Product Viewed`, which Segment sends as `ViewContent`
- `Products Searched`, which Segment sends as `Search`
- `Checkout Started`, which Segment sends as `InitiateCheckout`

In Segment, this should look like:

![Segment event mapping](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/jW3aAxbCcNouZxbINGWHu_untitled.png "Segment Event Mapping")

You can add additional mappings here if you need them, too.

### External IDs

Enable two settings under **Advanced Settings**: “Enable Advanced Matching” and “Use User ID or Anonymous ID as External ID”. Enabling both of these sends the Segment `userId` (or `anonymousId` if not present) as the `external_id` to Facebook, which improves Facebook’s ability to connect Segment events from various sources to the same user.

### Implementation Checklist

- [ ] Connect Facebook Pixel destination to website front-end source
- [ ] Create event mappings in the destination setting “Map Your Events to Standard FB Events”
- [ ] Enable the destination settings “Enable Advanced Matching” and “Use User ID or Anonymous ID as External ID”

## Facebook Conversions API destination

The [Facebook Conversions API destination](https://segment.com/docs/connections/destinations/catalog/actions-facebook-conversions-api/) sends Chord events to Facebook via Facebook’s Conversions API. Chord events are sent to Segment, and then Segment sends the events to Facebook.

This destination can be connected to either browser or server event sources. If connected to a browser event source, the Facebook Pixel destination should not be used for that same browser event source, because that will gather duplicate data.

First, configure the Facebook Conversions API destination [according to Segment documentation](https://segment.com/docs/connections/destinations/catalog/actions-facebook-conversions-api/#getting-started).

Next, the Facebook Conversions API destination requires you to map Chord Segment events to Facebook standard events.

**Using with Chord’s server source**

At a minimum, we recommend mapping the following Chord server source events to Facebook standard events:

- `Order Completed`, which Segment sends as `Purchase`

When you’re creating event mappings, you’re required to provide a value for the **Action Source** property in the **Select mappings** section. Select “SYSTEM GENERATED” as the action source. See [Facebook’s documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event) of the `action_source` property for descriptions of the different options.

**Using with Chord’s website front-end source**

At a minimum, we recommend mapping the following Chord website front-end events to Facebook standard events:

- `Order Completed`, which Segment sends as `Purchase`
- `Product Added`, which Segment sends as `AddToCart`
- `Product List Viewed`, which Segment sends as `ViewContent`
- `Product Viewed`, which Segment sends as `ViewContent`
- `Products Searched`, which Segment sends as `Search`
- `Checkout Started`, which Segment sends as `InitiateCheckout`

When you’re creating event mappings, you’re required to provide a value for the **Action Source** property in the **Select mappings** section. Select “WEBSITE” as the action source. See [Facebook’s documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event) of the `action_source` property for descriptions of the different options.

![Select "WEBSITE" as the action source](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/8LH1VFtngvKWITxV_-cN-_untitled-1.png)

### External IDs

By default, the Conversions API destination correctly maps Facebook’s `external_id` property to Segment’s `userId` (or `anonymousId` if not present). Don’t make changes to this configuration.

![Map to externalID](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/JXY5Vu5KJNttCMBnpiNJQ_untitled-2.png)

### Implementation Checklist

- [ ] Connect the Facebook Conversions API destination to the server source
- [ ] If not using the Facebook Pixel destination, connect the Facebook Conversions API destination to the website front-end source as well
- [ ] Create event mappings, following the minimum recommended mapping listed above, and remember to specify the correct “Action Source” property for each mapping

