Facebook Ads provides marketers with a significant number of advanced tracking features, but you can’t access any of these without properly using the Facebook pixel. In fact, accurate placement of Facebook’s tracking and conversion pixels is so important that we don’t recommend advertising on Facebook until the pixel is properly placed.
Placing the pixel on your website can be a challenge for some advertisers, so use the guide below to ensure that you place the pixel correctly and begin collecting valuable data as soon as possible.
Why do I need the Facebook Pixel?
The Facebook pixel provides crucial information regarding account performance – such as measuring cross-device conversions – as well activating opportunities to target various audiences on Facebook. Without the Facebook pixel placed on your site, you cannot create website custom audiences based on website activity. These audiences allow you to establish lookalike audiences, which are the basis of most successful Facebook prospecting efforts, and to access other features such as dynamic retargeting.
Pixel Base Code
The Facebook pixel has two distinct parts – the first, an all-site pixel that must be placed in the header on every page of your site. You can do this either through a master template from your site, or more quickly through a tag management platform like Google Tag Manager.
Event codes give Facebook additional information regarding actions that users take on your site, including purchases or other conversion events. These are small snippets of code that tell Facebook whether someone hit the cart page, purchased, filled out a lead form, etc.
Facebook provides nine standard events, which track everything from a visitor using the search functionality on the site all the way through to a completed conversion such as a purchase or lead form fill.
If these events do not cover everything your business needs to track, Facebook also allows up to 40 Custom Conversion events based on URL rules. If you are already using Google Analytics to track custom events based on URLs, for example, you can utilize many of the same URLs in Facebook as well.
Put it All Together
- Your Website’s Code
- This will only change if you are hard-coding the pixel into a template on your website. In the header of your website, you will have lots of other code – like the GA tracker, website navigation features, etc. You will place the Facebook pixel here as well.
- If you are using Google Tag manager, you will not need to update your site’s code, as your tag container should already be in the header.
- Facebook Base Pixel
- This is the base pixel detailed above that will need to be on every page of the site. If you’re hard-coding, it should go just above the </head> tag to ensure it fires appropriately in the header.
- If you are using Google Tag Manager, set this portion of the code to fire on all pages.
- Facebook Event Pixel
- This pixel should only fire when a site visitor completes an action you want to count as a conversion, like completing a purchase or submitting a lead form, or any micro-conversion events you track, such as putting items into a shopping cart. Add the single line of fbq(‘track’, ‘Event’); inside the Facebook pixel before the </script> tag. It will end up looking like the picture below:
- If you are using Google Tag Manager, add a new Custom HTML tag that will fire just the Event snippet. Then, under advanced settings, select the option to fire this tag after your base code. Facebook provides additional instructions for Google Tag Manager in their help documentation.
Without the Facebook pixel, you will not have access to features such as audience creation, bid optimizations, and down-funnel tracking. Implementing the Facebook pixel, even though it requires a few steps, is a wholly worthwhile investment that unlocks numerous opportunities in the Facebook ads platform and allows you to make the most of your advertising investment.