Facebook Pixels
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=<FB_PIXEL_ID>&ev=PageView&noscript=1"
/></noscript>
Facebook Pixel is one unified pixel that advertisers can use to traffic user activities on their website to Facebook for remarketing, conversion tracking, and optimization purposes. You can also share the data collected from the pixel with your advertising agencies to custom their own audiences and conversions.
Facebook Pixel is built on top of the current remarketing pixel. We upgraded this per-site pixel with these new functionalities:
-
Standard events - We are introducing 9 predefined standard events representing common actions taken on websites. These standard events are optional, but enable you to track these events in ads for measurement and use for optimization. You can also create website custom audiences more effectively without worrying about URL matching.
-
Easier to troubleshoot - The new javascript library (
fbevents.js) includes a set of function calls and parameter validation for the list of predefined standard events to make sure all the required information are provided before sending to Facebook, reducing the chance of errors. -
Website traffic dashboard - We are exposing some useful breakdowns on the activities we collected from a Facebook pixel in a dashboard to help advertisers diagnose pixel installation issues more effectively.
-
Pixel Sharing - Advertisers working with multiple agencies can use Business Manager to manage their pixels as assets. They can share and manage permissions of the pixel with other ad accounts or business accounts so that they can create their own custom audiences without the need to install multiple pixels on the website.
Standard Events
We are introducing a set of predefined website events you can send through Facebook Pixel. These events are standardized based on the event name. With the updated JS code & library (fbevents.js), an advertiser can use the corresponding function call to report a standard event to Facebook.
| Event Name | Event Description | Required Parameters |
|---|---|---|
ViewContent |
When a key page is viewed such as a product page, e.g. landing on a product detail page | |
Search |
When a search is made, e.g. should this be the product search query from audience in the ecomm site? | |
AddToCart |
When a product is added to the shopping cart, e.g. click / LP on add to cart button | |
AddToWishlist |
When a product is added to a wishlist, e.g. click / LP on add to wishlist button | |
InitiateCheckout |
When a person enters the checkout flow prior to completing the checkout flow, e.g. click / LP on checkout button | |
AddPaymentInfo |
When a payment information is added in the checkout flow, e.g. click / LP on save billing info button | |
Purchase |
When a purchase is made or checkout flow is completed, e.g. landing on "thank you" / confirmation page | value, currency |
Lead |
When a sign up is completed, e.g. click / LP on pricing, signup for trial | |
CompleteRegistration |
When a registration form is completed, e.g. complete subscription / signup for a service |
Custom Events
You can report a custom events through Facebook Pixel and be used for creating website custom audiences. However, we don't support conversion tracking, reporting, and optimization directly through these custom events.
| Event Name | Event Description | Required Parameters |
|---|---|---|
| - |
Any custom events a person chooses to report |
JavaScript
// Report one of the 9 predefined website events, e.g. Purchase
fbq('track', 'Purchase', { value: 9.99, currency: 'USD'});
// Report a custom website event
fbq('trackCustom', 'MyCustomEvent', { myParam: 'abc' });
Example: Image
<!-- Report one of the 9 predefined website events, e.g. Lead -->
<img height="1" width="1" alt="" style="display:none"
src="https://www.facebook.com/tr?id=<fb_pixel_id>&ev=Lead&cd[value]=9.99&cd[currency]=USD&noscript=1" />
<!-- Report a custom website event -->
<img height="1" width="1" alt="" style="display:none"
src="https://www.facebook.com/tr?id=<fb_pixel_id>&ev=myCustomEvent&cd[myParam]=abc&noscript=1" />
Dynamic Events
Dynamic Events allow you to activate a Pixel based on an action taken on the page, as opposed to only at page load.
Here is the basic code that you will need to place in your page before triggering the dynamic events.
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '<FB_PIXEL_ID>');
</script>
Firing event on button click
function onSelect() {
var value = $("#wca-select").val();
toastr.success("You selected " + value + "!");
fbq("trackCustom", "Select", {value:value});
}
Setup WCA with Event Data
For conversion optimization, we only allow a single (pixel,event) tuple to be specified.
Website Conversions metric in ads reporting is renamed to Website Actions. This metric contains actions collected from individual conversion pixel (CP) categories and unified pixel (UP) standard events.
NOTE: To avoid double-counting, one can only choose tracking either UP/CPs in our interfaces.