You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/facebook-pixel/index.md
+47-52Lines changed: 47 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,20 @@ rewrite: true
4
4
strat: facebook
5
5
id: 5661eb58e954a874ca44cc07
6
6
---
7
-
[Facebook Pixel](https://developers.facebook.com/docs/facebook-pixel) lets you measure and optimize the performance of your Facebook Ads. It makes conversion tracking, optimization and remarketing easier than ever. The Facebook Pixel Destination is open-source. You can browse the code [on GitHub](https://github.com/segment-integrations/analytics.js-integration-facebook-pixel).
7
+
[Facebook Pixel](https://developers.facebook.com/docs/facebook-pixel) lets you measure and optimize the performance of your Facebook Ads, making conversion tracking, optimization and remarketing easier than ever. The Facebook Pixel Destination is open-source. You can browse the code [on GitHub](https://github.com/segment-integrations/analytics.js-integration-facebook-pixel){:target="_blank"}.
8
8
9
9
> warning ""
10
-
> Facebook has deprecated the modular "Ads For Websites" suite, which previously comprised Facebook Custom Audiences and Facebook Conversion Tracking. We've consolidated those two destinations into this new and improved "Facebook Pixel" destination.
10
+
> Facebook deprecated the modular Ads For Websites suite, which previously comprised Facebook Custom Audiences and Facebook Conversion Tracking. Segment consolidated those two destinations into this new and improved Facebook Pixel destination.
11
11
12
12
13
13
14
14
**Use Cases**
15
15
16
-
*[Increase conversions by retargeting shopping cart abandoners on Facebook](https://segment.com/recipes/abandon-cart-retargeting-facebook/)
16
+
*[Increase conversions by retargeting shopping cart abandoners on Facebook](https://segment.com/recipes/abandon-cart-retargeting-facebook/){:target="_blank"}
17
17
18
18
19
-
## Other Facebook Destinations Supported by Segment
20
-
This page is about the **Facebook Pixel**. For documentation on other Facebook destinations, see the pages linked below.
19
+
## Other Facebook Destinations supported by Segment
20
+
This page is about the **Facebook Pixel** destination. For documentation on other Facebook destinations, see the pages linked below.
2. Search for "Facebook Pixel" in the Catalog, select it, and choose which of your sources to connect the destination to.
37
-
3. In the destination settings, enter your `pixelId` from the [Pixels tab in Facebook Ads Manager](https://www.facebook.com/ads/manager/pixel/facebook_pixel).
35
+
3. In the destination settings, enter your `pixelId` from the [Pixels tab in Facebook Ads Manager](https://www.facebook.com/ads/manager/pixel/facebook_pixel){:target="_blank"}.
38
36
39
37
When you enable Facebook Pixel as a destination in your Segment workspace, Segment automatically initializes Facebook's pixel with your `pixelId` upon loading `analytics.js`. This means you should remove the native Facebook script from your page.
40
38
@@ -46,7 +44,7 @@ If you're not familiar with the Segment Specs, take a look to understand what th
46
44
analytics.page();
47
45
```
48
46
49
-
Segment maps `analytics.page()` to Facebook's `fbq('track', "PageView")` method and will forward all page views accordingly. Note that the integration will ignore any parameters you pass to `analytics.page()`.
47
+
Segment maps `analytics.page()` to Facebook's `fbq('track', "PageView")` method and will forward all page views accordingly. The integration will ignore any parameters you pass to `analytics.page()`.
On our analytics.js client-side integration we support all three [documented](https://developers.facebook.com/docs/facebook-pixel/api-reference#events) methods of sending events to Facebook.
80
+
Segment's analytics.js client-side integration supports all three [documented](https://developers.facebook.com/docs/facebook-pixel/api-reference#events){:target="_blank"} methods of sending events to Facebook.
83
81
84
-
At any time, you can define a custom `contentType` on the integration options. If the value is present, it will take
82
+
At any time, you can define a custom `contentType` on the integration options. If the value is present, it takes
85
83
precedence over any other setting or default value.
To send *Standard* events, use the Segment destination setting labeled "Map Your Events to Standard FB Events". Then, any time Segment receives one of the events in that mapping, it will be sent to Facebook as the standard event you specified. All properties you included in the event will be sent as event properties. You can find documentation on these events [here](https://developers.facebook.com/docs/facebook-pixel/implementation/conversion-tracking/#standard-events).
102
+
To send *Standard* events, use the Segment destination setting labeled "Map Your Events to Standard FB Events". Then, any time Segment receives one of the events in that mapping, it will be sent to Facebook as the standard event you specified. All properties you included in the event will be sent as event properties. For more information, view [Meta's conversion tracking documentation](https://developers.facebook.com/docs/facebook-pixel/implementation/conversion-tracking/#standard-events){:target="_blank"}.
105
103
106
-
In addition, Segment will specially handle the following event types and send them as Standard events:
104
+
In addition, Segment sends the following event types as Standard events:
107
105
108
-
-"Order Completed" will be sent as "Purchase"
109
-
-"Product Added" will be sent as "AddToCart"
110
-
-"Product List Viewed" will be sent as "ViewContent"
111
-
-"Product Viewed" will be sent as "ViewContent"
112
-
-"Products Searched" will be sent as "Search"
113
-
-"Checkout Started" will be sent as "InitiateCheckout"
106
+
-`Order Completed`, which Segment sends as `Purchase`
107
+
-`Product Added`, which Segment sends as `AddToCart`
108
+
-`Product List Viewed`, which Segment sends as `ViewContent`
109
+
-`Product Viewed`, which Segment sends as `ViewContent`
110
+
-`Products Searched`, which Segment sends as `Search`
111
+
-`Checkout Started`, which Segment sends as `InitiateCheckout`
114
112
115
-
Facebook requires a currency for "Purchase" events -- if you leave it out, Segment will set a default value of "USD".
113
+
Facebook requires a currency for `Purchase` events. If you leave it out a currency, Segment will set a default value of `USD`.
116
114
117
-
You can set custom properties for the events listed above. Use the setting "Standard Events custom properties" to list
118
-
all the properties you want to send.
115
+
You can set custom properties for the events listed above. Use the setting "Standard Events custom properties" to list all the properties you want to send.
119
116
120
117
Here is how you'd specify standard events in the settings view:
121
118
122
119

123
120
124
121
You can map more than one Track event to the same Facebook standard event.
125
122
126
-
### Legacy Events
123
+
### Legacy events
127
124
128
-
To send *Legacy Conversion* events, use the Segment setting called "Legacy Conversion Pixel IDs". Any events that appear in that mapping will be sent to Facebook with the specified Pixel ID used as the Facebook Pixel `eventName`. Conversion events only support `currency` and `value` as event properties, so only these will be associated with the event. `currency` will default to "USD" if left out.
125
+
To send *Legacy Conversion* events, use the Segment setting called "Legacy Conversion Pixel IDs". Any events that appear in that mapping will be sent to Facebook with the specified Pixel ID used as the Facebook Pixel `eventName`. Conversion events only support `currency` and `value` as event properties, so only these will be associated with the event. `currency` will default to `USD` if left out.
129
126
130
-
### Custom Events
127
+
### Custom events
131
128
132
-
To send *Custom* events, send any event that does not appear in either mapping. All properties you include in the event are included as event properties. Any events you don't add to the "Map Your Events to Standard FB Events" setting are sent to Facebook as a custom event. There is no setting to add custom events in the Facebook Pixel Destination configuration.
129
+
To send *Custom* events, send any event that does not appear in either mapping. All properties you include in the event are included as event properties. Segment sends any events you don't add to the "Map Your Events to Standard FB Events" setting to Facebook as a custom event. There is no setting to add custom events in the Facebook Pixel Destination configuration.
133
130
134
131
### Timestamps
135
132
136
-
Facebook Pixel uses a custom timestamp format: an ISO 8601 timestamp without timezone information. For the following event fields, if you pass in a JavaScript `Date` object, it will be converted to this custom format. If you pass in a string, it is assumed that the string is already formatted as Facebook expects:
133
+
Facebook Pixel uses a custom timestamp format: an ISO 8601 timestamp without timezone information. For the following event fields, if you pass in a JavaScript `Date` object, it will be converted to this custom format. If you pass in a string, Segment assumes that the string is already formatted as Facebook expects:
137
134
138
135
-`checkinDate`
139
136
-`checkoutDate`
@@ -144,9 +141,9 @@ Facebook Pixel uses a custom timestamp format: an ISO 8601 timestamp without tim
144
141
-`travelEnd`
145
142
-`travelStart`
146
143
147
-
### Advanced Matching
144
+
### Advanced matching
148
145
149
-
The Segment Facebook Pixel integration supports [Advanced Matching](https://developers.facebook.com/docs/facebook-pixel/advanced/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.
146
+
The Segment Facebook Pixel integration supports [Advanced Matching](https://developers.facebook.com/docs/facebook-pixel/advanced/advanced-matching){:target="_blank"}, 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, and before Segment fires off the pixels, Segment checks for traits that the user has been previously identified with and sends that along with each call.
150
147
151
148
Facebook accepts the following properties:
152
149
@@ -162,23 +159,23 @@ Facebook accepts the following properties:
162
159
163
160
If you follow Segment's [spec](/docs/connections/spec/identify/#traits), these properties send in the correct format.
164
161
165
-
When you use Advanced Matching, Facebook also accepts an External ID. This can be any unique ID from the advertiser, like loyalty membership IDs, user IDs, and external cookie IDs. To send an `external_id` to Facebook you can either:
162
+
When you use Advanced Matching, Facebook also accepts an `external_id`. This can be any unique ID from the advertiser, like loyalty membership IDs, user IDs, and external cookie IDs. To send an `external_id` to Facebook you can either:
166
163
167
164
- Send the Segment `userId` or `anonymousId` as `external_id` using the **Use User ID or Anonymous ID as External ID** setting
168
165
- Indicate which user trait you would like Segment to map to `external_id` using the **Advanced Match Trait Key for External ID** setting
169
166
170
-
## Limited Data Use
167
+
## Limited data use
171
168
172
169
{% include content/facebook-ldu-intro.md %}
173
170
174
171
> info ""
175
-
> The **Use Limited Data Use** destination setting is disabled by default for all Facebook destinations except for Facebook Pixel. This must be enabled manually from the destination settings if you're using other Facebook destinations.
172
+
> The **Use Limited Data Use** destination setting is disabled by default for all Facebook destinations except for Facebook Pixel. You must enable the setting manually from the destination settings if you're using other Facebook destinations.
176
173
177
174
{% include content/facebook-ldu-params.md %}
178
175
179
-
Facebook uses the `context.ip` to determine the geolocation of the event.
176
+
Facebook uses `context.ip` to determine event geolocation.
180
177
181
-
You can manually change the Data Processing parameters by adding settings to the `integrations` object. For Facebook Pixel, you must store these settings in the [Load object](/docs/connections/sources/catalog/libraries/website/javascript/#load-options) so that Segment can set them *before* it calls `init`. The example below shows how you might set custom Data Processing parameters in Analytics.js.
178
+
You can manually change the Data Processing parameters by adding settings to the `integrations` object. For Facebook Pixel, you must store these settings in the [Load object](/docs/connections/sources/catalog/libraries/website/javascript/#load-options) so that Segment can set them *before* it calls `init`. The following example shows how you might set custom Data Processing parameters in Analytics.js.
If you're using real estate, travel, or automotive [Dynamic Ads](https://www.facebook.com/business/learn/facebook-create-ad-dynamic-ads) you can map `category` values to `content_type` values. For example, you might map the category "cars" to the "vehicle" content type so Facebook promotes relevant vehicles from your catalog. To understand which content types you can map to, consult the [Facebook Dynamic Ads](https://developers.facebook.com/docs/marketing-api/dynamic-ad) documentation.
192
+
If you're using real estate, travel, or automotive [Dynamic Ads](https://www.facebook.com/business/learn/facebook-create-ad-dynamic-ads){:target="_blank"} you can map `category` values to `content_type` values. For example, you might map the category "cars" to the "vehicle" content type so Facebook promotes relevant vehicles from your catalog. To understand which content types you can map to, consult the [Facebook Dynamic Ads documentation](https://developers.facebook.com/docs/marketing-api/dynamic-ad){:target="_blank"}.
198
193
199
-
For most implementations we recommend leaving these mappings blank. By default, we'll set`content_type` to "product".
194
+
For most implementations, Segment recommends leaving these mappings blank. By default, Segment sets`content_type` to "product".
200
195
201
196
## Troubleshooting
202
197
203
-
### PII Blocklisting
198
+
### PII blocklisting
204
199
205
-
Facebook enforces strict guidelines around sending Personally Identifiable Information (PII) as properties of Pixel events. In order to adhere to these guidelines, Segment will automatically scan`track` event properties for PII and remove any that get flagged from the event to Facebook. The following keys are currently filtered:
200
+
Facebook enforces strict guidelines around sending Personally Identifiable Information (PII) as properties of Pixel events. To adhere to these guidelines, Segment automatically scans`track` event properties for PII and removes any that get flagged from the event to Facebook. The following keys are currently filtered:
206
201
207
202
- email
208
203
- firstName
@@ -219,24 +214,24 @@ Any `track` events with properties containing those keys will be sent to Faceboo
219
214
220
215
If you have events that use any of those keys for non-PII properties, you can manually allowlist them using the **Allowlist PII Properties** setting. You may also add to this list and/or optionally hash blocklisted properties with the **Blocklist PII Properties** setting.
221
216
222
-
### Inconsistent or Missing Conversions
217
+
### Inconsistent or missing conversions
223
218
224
-
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.
219
+
Facebook conversion pixels can fire inconsistently due to page redirects or reloads before the pixel has finished loading on the page. Make sure your page doesn't redirect or reload for at least 300ms after the conversion event happens. In some cases a delay of 500ms is necessary.
225
220
226
-
We recommend using our`trackLink` or `trackForm` helpers to delay the page redirect. [Documentation here](/docs/connections/sources/catalog/libraries/website/javascript#track-link). You can extend the delay by [setting the timeout to 500ms](/docs/connections/sources/catalog/libraries/website/javascript#extending-timeout).
221
+
Segment recommends using the`trackLink` or `trackForm` helpers to delay the page redirect. For more on these methods, view [the track link documentation](/docs/connections/sources/catalog/libraries/website/javascript#track-link). You can extend the delay by [setting the timeout to 500ms](/docs/connections/sources/catalog/libraries/website/javascript#extending-timeout).
227
222
228
-
### Extra or Duplicate Conversions
223
+
### Extra or duplicate conversions
229
224
230
-
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.
225
+
This may be due to conversion events being sent from your development, staging, or testing environments. Segment recommends setting up separate sources for each environment, which will let you either point events to test conversion pixels in Facebook Conversion Tracking or turn off Facebook Conversion Tracking completely in non-production environments.
231
226
232
-
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.
227
+
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.
233
228
234
229
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.
235
230
236
-
### Facebook Conversions Not Matching Google Analytics
231
+
### Facebook conversions not matching Google Analytics
237
232
238
233
Facebook counts conversions per person, as opposed to Google Analytics which counts per browser cookie session (unless you're using [Google Analytics User-ID](/docs/connections/destinations/catalog/google-analytics/#user-id)).
239
234
240
-
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 one conversion with the conversion properly attributed to the last ad click/view on mobile.
235
+
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 would count two unique visits with a conversion last attributed to a direct visit on desktop. Facebook would count one conversion with the conversion properly attributed to the last ad click/view on mobile.
241
236
242
-
{% include content/client-side-script-unverified.md %}
237
+
{% include content/client-side-script-unverified.md %}
0 commit comments