What is a Facebook pixel?
The Facebook pixel is the code that you place on your website. It collects data that helps you track conversions from Facebook ads, optimize ads, build targeted audiences for future ads, and remarket to people who have already taken some kind of action on your website.
It works by placing and triggering cookies to track users as they interact with your website and your Facebook ads.
There used to be a couple of different kinds of pixels: The Facebook conversion pixel and the Facebook custom audience pixel. Facebook discontinued the conversion tracking pixel back in 2017. If you were using the Facebook conversion pixel, you’ll need to switch over. You can learn how to do so in this Facebook business help article. If you were using the old custom audience pixel, these instructions explain how to upgrade to the current pixel.
How can you use the Facebook pixel? Here are just a few ways the pixel can help improve your Facebook marketing results.
Use Facebook conversion tracking
The Facebook pixel allows you to see how people interact with your website after viewing your Facebook ad.
You can even track customers across their devices. This lets you see if people tend to see your ads on mobile but switch to a desktop before buying. Or, maybe it’s the other way around. This information can help you refine your ad strategy and calculate your return on investment.
Use Facebook retargeting
Facebook retargeting pixel data and dynamic ads allow you to show targeted ads to people who have already visited your site. You can choose to get really granular here. For example, you can show people an ad for the exact product that they abandoned in a shopping cart or added to a wishlist on your website.
Create lookalike audiences
Facebook can use its targeting data to help you build a lookalike audience of people who have similar likes, interests, and demographics to people who are already interacting with your website. This can help expand your potential customer base.
Optimize Facebook ads for conversions
You can use Facebook tracking pixel data to optimize your Facebook ads for specific conversion events on your website. Without a pixel, the only conversion you can optimize for is link clicks. With the pixel, you can optimize for conversions that align more closely with business goals, like purchases and sign-ups.
Optimize Facebook ads for value
As Facebook collects data on who buys from your site and how much they spend, it can help optimize your ad audience based on value. That means it will automatically show your ads to the people who are most likely to make high-value purchases.
Gain access to more Facebook ad tools and metrics
Want to use web conversion campaigns, custom audiences from your website, or dynamic ads? You can only do so if you’ve installed the Facebook pixel. You also need the pixel to track metrics like cost per lead or cost per conversion.
How to use the Facebook pixel
You can use the Facebook pixel to collect data on two different kinds of events.
- Facebook has predefined a set of 17 standard events.
- You can set up custom events yourself.
An “event” is simply a specified action that a visitor takes on your website, like making a purchase.
Facebook pixel standard events
The 17 standard Facebook pixel events for which you can simply copy and paste standard Facebook event code are:
- Purchase: Someone completes a purchase on your website.
- Lead: Someone signs up for a trial or otherwise identifies themselves as a lead on your site.
- Complete registration: Someone completes a registration form on your site, such as a subscription form.
- Add payment info: Someone enters their payment information in the purchase process on your website.
- Add to cart: Someone adds a product to their shopping cart on your site.
- Add to wishlist: Someone adds a product to a wishlist on your site.
- Initiate checkout: Someone starts the checkout process to buy something from your site.
- Search: Someone uses the search function to look for something on your site.
- View content: Someone lands on a specific page on your website.
- Contact: Someone contacts your business.
- Customize product: Someone selects a specific version of product, such as choosing a certain color.
- Donate: Someone makes a donation to your cause.
- Find location: Someone searches for your business’s physical location.
- Schedule: Someone books an appointment at your business.
- Start trial: Someone signs up for a free trial of your product.
- Submit application: Someone applies for your product, service, or program, such as a credit card.
- Subscribe: Someone subscribes to a paid product or service.
You can also add more details to standard events using extra bits of code called parameters. These allow you to customize the standard events based on:
- How much a conversion event is worth
- Content type, or ID
- Basket contents
For example, you could use Facebook pixel tracking to record views of a specific category on your website, instead of tracking all views. Perhaps you want to separate dog owners from cat owners based on which sections of your pet supply website they viewed.
Facebook pixel custom events
You can use custom events in place of standard events, or to collect more details than Facebook pixel standard events can provide.
Custom events use URL rules based on specific URLS or URL keywords.
You can learn more about custom conversions in this Facebook help article.
How to create a Facebook pixel and add it your website
Now that you know what you can track, and why you would want to do so, it’s time to create your pixel and put it to work on your website.
Step 1: Create your pixel
- From your Facebook Events Manager, click the hamburger icon (≡) in the top lefts and choose Pixels.
- Click the green Create a Pixel button.
- Name your pixel, enter your website URL, and click Create.
When choosing the pixel’s name, keep in mind that with Events Manager, you only get one pixel for each ad account. The name should represent your business, rather than a specific campaign. If you want to use more than one pixel per ad account, you can do so using Facebook Business Manager.
Step 2: Add the pixel code to your website
To put the pixel to work gathering information on your website, you now need to install some code on your web pages. There a few ways to do this depending on what website platform you use.
- If you use an e-commerce platform like Squarespace or a tag manager like Google Tag Manager, you can install your pixel without having to edit your website code directly. This Facebook Help article describes how to install your pixel if you already use one of those third-party tools.
- If you work with a developer or someone else who can help you edit your website code, click Email Instructions to a Developer to send your developer everything they need to install the pixel.
- If neither of the above options apply, you need to insert the pixel code directly into your web pages. That’s what we’ll walk you through in this section.
- Click Manually Install the Code Yourself.
- Copy-and-paste the pixel code into the header code of your website. That is, post it after the <head> tag but before the </head> tag. You need to paste it into every single page, or into your template if you’re using one.
- Choose whether to use automatic advanced matching. This option matches hashed customer data from your website to Facebook profiles. This lets you can track conversions more accurately and create larger custom audiences.
- Check whether you’ve installed the code correctly by entering your website URL and clicking Send Test Traffic.
Once your Facebook pixel is tracking activity, click Continue.
Step 3: Track the right events for your business
Select which of the 17 standard events you’d like to track using the toggle buttons. For each event, you need to choose whether to track on page load or on inline action.
- Track event on page load: Use this to track actions that involve going to a new page, like a purchase complete or sign-up success page.
- Track event on inline action: Use this to track actions within a page, like clicking an “add to cart” button that does not open a new page.
You can also set parameters for some events. For example, maybe you specifically want to track purchases over a set dollar value.
If you want to use Facebook pixel custom events, head to your Facebook Events Manager. Choose Custom Conversions from the top left menu. Then, click Create Custom Conversion to define your custom conversion event using URL rules.
Step 4: Confirm your Facebook pixel is working
You already tested your Facebook Pixel installation by sending test traffic. But before you start relying on the data from your Facebook pixel, you should confirm that it’s also tracking properly.
- Add the Facebook Pixel Helper extension to your Google Chrome browser. (It’s only available for Chrome, so if you use a different browser, you’ll need to install Chrome to use the Pixel Helper.)
- Visit the page where you have installed the Facebook pixel. If the extension finds the pixel, the </> extension icon will turn blue, and a popup will indicate how many pixels it finds on the page. The popup will also tell you if your pixel is working properly. If not, it will provide error information so you can make corrections.
Step 5: Add pixel notice to your website
To comply with Facebook’s terms (and, in some cases, the law), you need to make sure visitors to your website know you’re collecting their data.
That means you need to provide clear notice that you’re using the Facebook pixel and that their information may be collected through cookies or other methods. You also need to let users know how they can opt out of having their data collected.
To get all the details, go to the Facebook Business Tools Terms and scroll down to point 3: Special Provisions Concerning the Use of Facebook Pixels and SDKs. Or, check out Facebook’s cookie consent guide for sites and apps.
Facebook Pixel cookies
What does it mean? Basically, this change allows advertisers to continue to track data on Safari and Firefox. Both of these browsers have placed limits on third-party cookies.
Why would you want to opt out? Advertisers in fields that have extensive privacy legislation—like finance and health—may need to opt out for compliance reasons.
Get all the details in this Facebook Business help article.