Skip to content

Commit 2f5f7f0

Browse files
authored
Merge pull request #5193 from segmentio/facebook-pixel-fix
Remove Extra Header from Facebook Pixel Destination
2 parents 5e50f4e + a0d2926 commit 2f5f7f0

File tree

1 file changed

+47
-52
lines changed
  • src/connections/destinations/catalog/facebook-pixel

1 file changed

+47
-52
lines changed

src/connections/destinations/catalog/facebook-pixel/index.md

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ rewrite: true
44
strat: facebook
55
id: 5661eb58e954a874ca44cc07
66
---
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"}.
88

99
> 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.
1111
1212

1313

1414
**Use Cases**
1515

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"}
1717

1818

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.
2121

2222
| **Facebook Destination** | Supported by Engage |
2323
| ----------------------------------------------------------------------------------------------------------- | ------------------- |
@@ -28,13 +28,11 @@ This page is about the **Facebook Pixel**. For documentation on other Facebook d
2828
| **[Facebook Conversions API](/docs/connections/destinations/catalog/actions-facebook-conversions-api/)** | Yes |
2929

3030

31-
## Getting Started
32-
33-
31+
## Getting started
3432

3533
1. From the Segment web app, click **Catalog**.
3634
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"}.
3836

3937
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.
4038

@@ -46,7 +44,7 @@ If you're not familiar with the Segment Specs, take a look to understand what th
4644
analytics.page();
4745
```
4846

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()`.
5048

5149
## Identify
5250

@@ -79,9 +77,9 @@ analytics.track("My Custom Event", {
7977
});
8078
```
8179

82-
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.
8381

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
8583
precedence over any other setting or default value.
8684

8785
```javascript
@@ -99,41 +97,40 @@ analytics.track('Checkout Started', {
9997
);
10098
```
10199

102-
### Standard Events
100+
### Standard events
103101

104-
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"}.
105103

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:
107105

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`
114112

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`.
116114

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.
119116

120117
Here is how you'd specify standard events in the settings view:
121118

122119
![event mapping](images/event-mapping.png)
123120

124121
You can map more than one Track event to the same Facebook standard event.
125122

126-
### Legacy Events
123+
### Legacy events
127124

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.
129126

130-
### Custom Events
127+
### Custom events
131128

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.
133130

134131
### Timestamps
135132

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:
137134

138135
- `checkinDate`
139136
- `checkoutDate`
@@ -144,9 +141,9 @@ Facebook Pixel uses a custom timestamp format: an ISO 8601 timestamp without tim
144141
- `travelEnd`
145142
- `travelStart`
146143

147-
### Advanced Matching
144+
### Advanced matching
148145

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.
150147

151148
Facebook accepts the following properties:
152149

@@ -162,23 +159,23 @@ Facebook accepts the following properties:
162159

163160
If you follow Segment's [spec](/docs/connections/spec/identify/#traits), these properties send in the correct format.
164161

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:
166163

167164
- Send the Segment `userId` or `anonymousId` as `external_id` using the **Use User ID or Anonymous ID as External ID** setting
168165
- Indicate which user trait you would like Segment to map to `external_id` using the **Advanced Match Trait Key for External ID** setting
169166

170-
## Limited Data Use
167+
## Limited data use
171168

172169
{% include content/facebook-ldu-intro.md %}
173170

174171
> 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.
176173
177174
{% include content/facebook-ldu-params.md %}
178175

179-
Facebook uses the `context.ip` to determine the geolocation of the event.
176+
Facebook uses `context.ip` to determine event geolocation.
180177

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.
182179

183180
```javascript
184181
analytics.load("replace_with_your_write_key", {
@@ -190,19 +187,17 @@ analytics.load("replace_with_your_write_key", {
190187
});
191188
```
192189

193-
## Settings
194-
195-
### Map Categories to FB Content Types
190+
## Map categories to Facebook content types
196191

197-
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"}.
198193

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".
200195

201196
## Troubleshooting
202197

203-
### PII Blocklisting
198+
### PII blocklisting
204199

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:
206201

207202
- email
208203
- firstName
@@ -219,24 +214,24 @@ Any `track` events with properties containing those keys will be sent to Faceboo
219214

220215
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.
221216

222-
### Inconsistent or Missing Conversions
217+
### Inconsistent or missing conversions
223218

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.
225220

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).
227222

228-
### Extra or Duplicate Conversions
223+
### Extra or duplicate conversions
229224

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.
231226

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.
233228

234229
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.
235230

236-
### Facebook Conversions Not Matching Google Analytics
231+
### Facebook conversions not matching Google Analytics
237232

238233
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)).
239234

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.
241236

242-
{% include content/client-side-script-unverified.md %}
237+
{% include content/client-side-script-unverified.md %}

0 commit comments

Comments
 (0)