UA-111544038-4

Facebook Pixel Implementation Guide

The Facebook pixel can be used for three main functions:

  1. Building Custom Audiences from your website for remarketing.
  2. Optimizing ads for conversions.
  3. Tracking conversions and attributing them back to your ads.

 

Benefits of using the pixel

With the Facebook pixel, you'll also be able to:

  • See rich insights: In Ads Manager you'll see a dashboard which gives you information on the traffic across your website.
  • Share your pixel: Useful when working with an agency or Facebook Marketing Partner. Instead of implementing a second pixel for your agency, you can share your existing pixel with them through Business Manager.

 

 

 

The pixel dashboard in Ads Manager.

 

The pixel code

The Facebook pixel code is made up of two main elements: the base code and the standard event code. The base code should be placed on every page of your website.

 

 

 

What the new code looks like on an add-to-cart page.

 

Customize your code with standard events

The one part of the code you'll have to customize is the standard event section. There are 9 available standard events to choose from, such as "Add to cart" or "View Content". These represent the different types of actions people take on your website and only need to be placed on some pages.

 

Standard events outside your pixel's base code

 

You can also place a standard event outside of your pixel's base code. To do so, add tag, paste the Standard Event code that's relevant to your page (ex: Complete Registration, Add To Cart). You'll need to do this for every page you want to track.

 

The key here is that every page of your website should have everything that's enclosed in section 2 (the base code), but different pages will have different snippets of code for section 3 (standard event code).
 
 

3. Customize your code with standard events

On the special pages of your website that you want to track and optimize your ads for, add one of these 9 standard events. For example, someone selling toys on their website would place standard event codes for their add-to-cart page and purchase page. Just copy and paste everything in the standard event code column and paste it under fbq('track','PageView'); like in the diagram above. If you'd prefer to use URL rules instead of standard events, you can use custom conversions instead.

 

Website action Standard event code
View content fbq('track', 'ViewContent');
Search fbq('track', 'Search');
Add to cart fbq('track', 'AddToCart');
Add to wishlist fbq('track', 'AddToWishlist');
Initiate checkout fbq('track', 'InitiateCheckout');
Add payment info fbq('track', 'AddPaymentInfo');
Make purchase fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});
Lead fbq('track', 'Lead');
Complete registration fbq('track', 'CompleteRegistration');

 

You can also add different parameters for each standard event code, such as Content ID, value and currency. These are optional, besides from the Purchase standard event, which requires the value and currency parameters to work.

 

If you've already installed the old Custom Audience pixel, but not the conversion pixel, on your website:

You don't need to do anything and your Custom Audience pixel will continue to work as normal. However, if you'd like to start optimizing for and tracking conversions, add the standard event code to your existing base code like the diagram below. Notice you'll need to make a slight change to the standard event codes shown in the table above. Instead of using fbq('track', 'AddToCart'); use window._fbq.push(['track', 'AddToCart']); for your standard event.

 

Website action Standard event code for old Custom Audience pixel
View content window._fbq.push(['track', 'ViewContent']);
Search window._fbq.push(['track', 'Search']);
Add to cart window._fbq.push(['track', 'AddToCart']);
Add to wishlist window._fbq.push(['track', 'AddToWishlist']);
Initiate checkout window._fbq.push(['track', 'InitiateCheckout']);
Add payment info window._fbq.push(['track', 'AddPaymentInfo']);
Make purchase window._fbq.push(['track', 'Purchase', {value: '0.00', currency: 'USD'}]);
Lead window._fbq.push(['track', 'Lead']);
Complete registration window._fbq.push(['track', 'CompleteRegistration']);

 

 

 

The old Custom Audience pixel code with a standard event.

 

If you've already installed the conversion pixel, but not the old Custom Audience pixel, on your website:

 

Create the Facebook pixel and place the base code across your site so you can start building audiences. On the pages where you've installed the conversion tracking pixel, add the corresponding standard event within your new Facebook pixel code.

If you've been optimizing campaigns with your conversion pixel, we recommend that you leave both pixels in place and transition gradually to the Facebook pixel, especially if you're running large campaigns. Things to keep in mind:

  • The Facebook pixel will need about 2 days of 15 1-day click-through conversions per event to perform as well as the conversion pixel.
  • You should try running new campaigns, or switching optimization over on only a few existing campaigns, to minimize the impact on performance. You should have campaigns optimizing for each event you care about for 2 days.
  • After 2 days of 15 1-day click-through conversions, your performance should match the conversion pixel and you can start using the Facebook pixel to optimize on all new campaigns for those events. If you have other existing campaigns optimizing on the conversion pixel, you can let them finish.
  • If you choose to delete your conversion pixel codes after this time, make sure they're not associated with any active campaigns. Also keep in mind your conversion pixel Custom Audiences won't grow any more if you delete the code. This will be the case anyway when the conversion pixel gets removed, so you should use this time now to build up new Custom Audiences on the Facebook pixel.
  • The historic reporting data from your conversion pixel will still be accessible.
  • If you usually receive fewer than 15 1-day click-through conversions on a particular event, switching optimization to the Facebook pixel shouldn't have much effect on your normal conversion pixel output.

 

This table shows your previous conversion pixel types and how they map to the new standard events.

Conversion pixel type Corresponding standard event
Checkouts Make purchase
Registrations Complete registration
Leads Lead
Key Page Views View content
Adds to Cart Add to cart
Other Website Conversions Custom event

 

If you've already installed the conversion pixel and the old Custom Audience pixel on your website:

Add standard events within your existing Custom Audience pixel code. If you've been optimizing campaigns with your conversion pixel, see the above section on what to do to start optimizing on the Facebook pixel.

If you previously only placed the Custom Audience pixel on a few pages of your website, now's a good time to add it to all the pages of your website so you're not missing any data on your pixel dashboard.

 

Running your campaign

Now that your pixel is installed across your website with the appropriate standard events, you're ready to put it into action. Besides building audiences, you'll be able to optimize for and track those standard events you placed in the pixel code across your website.

 

 

To create your ad:

  1. Go to your ad creation.
  2. Select Increase conversions on your website.
  3. Enter your website URL and then click Choose a conversion.
  4. You should see a list of standard events. Choose the one you want to optimize for (ex: Purchase), then click Continue.
  5. Go through the sections and then click Place Order.

 

Keep in mind you can use the Facebook pixel in the same way when creating your ads in Power Editor. Your ad will automatically track all available conversion events so you don't need to manually select a pixel for tracking. You'll be able to see all this data in your ads reports.