The "Facebook pixel" isn't the kind of pixel you'd find on a display monitor; it's a short string of code you place on the pages of your website.
And if you're looking to maximize the performance and return from your Facebook advertising campaigns, you need to have this pixel installed on every page of your web site, because having this code in place serves several important purposes.
The Facebook pixel enables you to:
- Measure cross-device conversions - for example, someone who saw your offer page on a mobile device, didn't convert, but came back later, via a desktop device, and did convert.
- Optimize ad serving - for example, by bidding higher to display ads to people who have converted or otherwise expressed interest in what you're offering.
- Build Custom Audiences - so you can retarget ads to, on or off Facebook.
It's also very important that you configure the pixel correctly so that it tracks the action you're trying to drive with your Facebook advertising. Here's a guide on how to create and implement the right Facebook tracking pixel for your ad objective.
Creating the pixel
You can create the Pixel in several places: in Ads Manager, in Power Editor, or here:
https://www.facebook.com/ads/manager/pixel/facebook_pixel/
Note: if you already created a Pixel at some time in the past, you won't see the "create Pixel" option as only one pixel is allowed to be associated with a Facebook account; instead, you'll see a graph showing its performance over time.
Now click on "Create a Pixel". A window will appear a block of code in it. Highlight this code, copy it, and save it in a document - you'll need to post this into every page of your website you want to track.
Technically speaking, you'll need to paste it in within the <HEAD></HEAD> HTML code on your pages. Provided you're using a modern CMS such as WordPress, doing this is easy, and is typically done either via a plug-in such as Yoast or directly through the WordPress code editor.
If you're not doing the implementation yourself, Facebook also gives you the option of sending it directly to your IT team or webmaster via e-mail.
Once your pixel's installed, you'll need to verify that it's passing data to Facebook.
To do this, return to Ads Manager, locate the pixel, and verify that it's active. Once your pixel is verified, and begins passing data, you'll start to see how it's performing via a graph that looks like this:
Customizing the Pixel
OK - great. You've got the pixel code installed and it's passing data. But you still have more work to do, because you don't want this pixel to just track accesses to your site: you want it to track exactly the kind of actions you want your Facebook advertising campaigns to drive. This means installing bits of code ("Standard Event Codes") that will cause the pixel to reflect these actions.
To do this, you'll need to do a little bit of JavaScript hacking. So let's take a look at the way that the pixel code is actually structured:
The blue (#1) area (the area between <head> and </head> represents the original code of your website; the red (#2) area represents the Facebook Pixel code itself, between <script> and </noscript>.
You'll be inserting your custom code in area #3e - the green area: just after the two lines that read:
fbq('init', '123456789');
fbq('track', 'PageView');
Now before we go any further, it's important to understand that you won't have to customize every instance of the Facebook pixel on your site: just the special pages where special actions occur - for example, on your shopping cart pages, or lead form pages, or newsletter sign-up pages.
There's also not much code hacking you have to do. Customizing the pixel to your liking is just a matter of inserting very simple code into the "green" area:
Let's look at the custom tracking options and code options that Facebook gives us, along with what they do:
Action tracked: View Content
Code snippet: fbq('track', 'ViewContent');
What it does: Tracks key page views (for example, product pages, landing pages, or articles)
Action tracked: Search
Code snippet: fbq('track', 'Search');
What it does: Tracks searches on your website (for example, product searches)
Action tracked: Add to Cart
Code snippet: fbq('track', 'AddToCart');
What it does: Tracks when items are added to your shopping cart (for example, clicking to or landing on page with an Add to Cart button)
Action tracked: Add to wishlist
Code snippet: fbq('track', 'AddToWishlist');
What it does: Tracks when items are added to a wishlist
Action tracked: Initiate checkout
Code snippet: fbq('track', 'InitiateCheckout');
What it does: Tracks when people enter your checkout path (for example, clicking a checkout button or landing on a checkout page)
Action tracked: Add payment info
Code snippet: fbq('track', 'AddPaymentInfo');
What it does: Tracks when payment information is added in the checkout.
Action tracked: Make purchase
Code snippet: fbq('track', 'Purchase', {value: '0.00', currency:'USD'});
What it does: Tracks when payment information is added in the checkout flow (for example, clicking tor or landing on a page on billing info)
Action tracked: Lead
Code snippet: fbq('track', 'Lead');
What it does: Tracks when a user expresses an interest in your offering (for example, through a form submission, sign up for trial, or by landing on pricing page)
Action tracked: Complete Registration
Code snippet: fbq('track', 'CompleteRegistration');
What it does: Tracks when a registration form is completed (for example, signing up for your newsletter or otherwise opting into your communications)
Feeling a bit daunted? Please don't be. Your site has a fixed (and hopefully very small) number of pages associated with the kind of specific user actions reflected in the code snippets listed above, so it's likely that you'll only have to customize a few small number of instances of the Pixel.
Don't avoid this step, because if the Facebook Pixel isn't customized to reflect the kind of ad campaign you're running on Facebook, you won't be able to measure how well - or even whether - it's working for you.
Naturally, you'll need to be careful when modifying Facebook's JavaScript code, and verify that any changes you make are passing data back to Facebook.
If you find yourself getting lost with this process, Facebook has a helpful page you may want to consult: https://www.facebook.com/business/help/952192354843755
Key takeaways
- The Facebook Pixel isn't an actual pixel; it's a short string of JavaScript code
- Facebook's Pixel provides a versatile mechanism for tracking many different kinds of user behavior driven by your Facebook ad campaigns
- You'll need to configure your Pixel correctly to pass back data on the type of action you're trying to drive via your Facebook ad campaigns
- Unless you correctly configure the Pixel, you won't know whether your Facebook ad campaigns are working
- If you add or change any Event Codes in the Facebook Pixel code, make sure you verify that the Pixel is still passing data correctly to Facebook before proceeding further.