Facebook Pixel Destination

Segment makes it easy to send your data to Facebook Pixel (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Facebook Pixel in the format they understand. Learn more about how to use Facebook Pixel with Segment.

Facebook has deprecated their modular “Ads For Websites” suite, which previously comprised Facebook Custom Audiences and Facebook Conversion Tracking. We’ve consolidated those two destinations into the new and improved Facebook Pixel destination!

Getting Started

Facebook Pixel works with our client-side javascript library: Analytics.js.

From your Segment Destinations page click on Facebook Pixel. Drop in your pixelId from Facebook’s “Create a Pixel” dialog, also found in the sidebar of the Pixel pane in the Ads Management console.

We’ll automatically initialize facebook’s pixel with your pixelId upon loading Analytics.js.


We’ve mapped analytics.page() to Facebook’s fbq('track', "PageView") method and will forward all pageviews accordingly.


We support all three documented methods of sending events to Facebook:

“To report a standard event, use one of the 9 standard events in the fbq track call. To report a legacy conversion event, use a Conversion Pixel ID as the eventName in the fbq track call. Additionally, if you are not interested in tracking or optimizing for conversions for specific actions, you can pass custom event names into the trackCustom call.”

Standard Events

Any Segment track events that you map to FB standard events in the Segment interface will be sent with the proper API to signify the type of event. These events can be used for conversions and audiences; we recommend using them where it makes sense. See the FB docs for more information.

For these events, if you pass either revenue or value properties to your track call, we will map them to the value parameter w/in Facebook. We’ll also automatically add currency: USD by default, unless you pass your own currency type as a property to your track call. All other properties will be mapped to Facebook parameters as-is.

Legacy Conversion Events

If you still have conversion tracking pixel IDs, including those we automatically transferred from your Conversion Tracking destination, we’ll send these conversions in lieu of events, as Facebook still accepts them.

For these events, if you pass either revenue or value properties to your track call, we will map them to the value parameter w/in Facebook. We’ll also automatically add currency: USD by default, unless you pass your own currency type as a property to your track call. All other properties will be dropped.

Custom Events

Any Segment events that are not mapped in our interface will be sent with Facebook’s trackCustom method with the event’s properties as customData in the form that Facebook expects.

These events can then be used to build Custom Audiences or custom conversions, which can then be used for conversion tracking and optimization.

Advanced Matching

The Segment Facebook Pixel integration supports Advanced Matching which enables you to send your customer data through the pixel to match more website actions with Facebook users. With this additional data, you can report and optimize your ads for more conversions and build larger re-marketing audiences. When the page loads, before we fire off the pixels, we’ll check for traits that the user has been previously identified with and send that along with each call.

Facebook accepts the following properties, firstName, lastName, email, phone number gender, birthday, city, state and zip code but they require it in a very precise format so in order to get them the data as expected, please follow our spec!. A fully compliant identify call would look like this.

    name: 'Zaphod Beeblebrox',
    gender: 'Male',
    email: 'Zaphod@hotmail.com',
    phone: '1-401-826-4421',
    address: {
        city: 'San Francisco',
        state: 'Ca',
        postalCode: '94107'

If you check the Enable Advanced Matching setting inside Segment, we’ll grab these values from the user’s cookies so once you’ve identified them with this information then it should be included on all future Facebook pixels for that user! You can use as many or as few of these traits as makes sense for you and we’ll send along what you have included.

Ecommerce Events and Facebook Dynamic Product Ads

Product Audiences

We support Facebook Custom Audiences’s Product Audiences feature, enabling you to serve Dynamic Product Ads that are customized and targeted to your users based upon the Segment Ecommerce eventsProduct Viewed, Product List Viewed, Product Added and Order Completed — that a person triggers on that product or product group.

To send this data to Facebook, make sure your events adhere to our ecommerce spec in your client-side javascript. We’ll translate your calls to the correct Custom Audience pixels. No need to map these events in the interface!

Note that any spec’d ecommece events will automatically map to specific Facebook Standard Events (i.e. Product Viewed -> ViewContent, Product List Viewed -> ViewContent, Product Added -> AddToCart, Order Compeleted -> Purchase). These default mappings will override any custom mappings you may have defined in your Segment dashboard.


Inconsistent or Missing Conversions

The most common reason for Facebook conversion pixels to fire inconsistently is that the page redirects or reloads before the pixel has time to be loaded on the page. Make sure your page does not redirect or reload for at least 300ms after the conversion event happens. In some cases a delay of 500ms is necessary.

We recommend using our trackLink or trackForm helpers to delay the page redirect. Documentation here. You can extend the delay by setting the timeout to 500ms.

Extra or Duplicate Conversions

This may be due to conversion events being sent from your development, staging, or testing environments. We recommend setting up separate source for each environment. That way you can either point events to test conversion pixels in Facebook Conversion Tracking or turn off Facebook Conversion Tracking completely in non-production environments.

Double check that your mapped conversion events aren’t happening anywhere else on your site. If the user reloads the conversion page or re-triggers the tracked event they may be double counted.

Facebook’s conversion reports count view-through conversions as well as click-through conversions by default. You can change that setting inside Facebook Conversion Tracking in the report attribution settings.

Facebook Conversions Not Matching Google Analytics

Facebook counts conversions per person, as opposed to Google Analytics which counts per browser cookie session (unless you’re using Google Anlaytics User-ID).

If someone saw or clicked on your ad on a mobile phone then later came back directly to purchase on a desktop machine Google Analytics wouldn’t know that this was the same person, but Facebook would. In that scenario Google Analytics counts 2 unique visits with a conversion last attributed to a direct visit on desktop. Facebook counts 1 conversion with the conversion properly attributed to the last ad click/view on mobile.

Script unverified or undetected by third-party tool

Many times this is a limitation on the tool’s detection process, where the detector is looking for a specific HTML element on your page. Our client side analytics.js library asynchronously loads the tool’s library or pixel onto the page. As such, the detection fails.

In order to confirm that the tool’s library or pixel is actually loaded onto the page, you can open up the javascript console and go to the network tab when the page is loading.

Checking network tab to see if script loads

If the script isn’t loading, check that any form of ad blocker is disabled.

Supported Sources and Connection Modes

📱 Device-based
☁️ Cloud-based

To learn more about about Connection Modes and what dictates which we support, see here.


Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Enable Advanced Matching

If true, we will initialize Facebook Pixel with any user traits that’s been cached in the Segment cookies from your previous .identify() calls.

Legacy Conversion Pixel IDs

These are your deprecated Conversion Pixel IDs from Facebook Conversion Tracking. Facebook will still accept data in this format, though it’s no longer possible to create conversion Pixel IDs. Now you create conversions based on standard and custom events inside their interface. Enter your event name in the left column and your pixel ID in the right column.

Pixel ID

Your Pixel ID, from the snippet created on the Facebook Pixel creation page.

Map Your Events to Standard FB Events

Enter your event on the left, and the Facebook standard event to map to on the right. Facebook recognizes certain standard events that can be used across Custom Audiences, custom conversions, conversion tracking, and conversion optimization. When you map an event to a standard Facebook event, we’ll send the event by that name. Any unmapped events will still be sent as Custom Events.

Value Field Identifier

For pre-purchase events such as Product Viewed and Product Added, choose which Segment property you would like to map to Facebook’s value property.

If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!