The Facebook Pixel: What It Is and How to Use It
If you’re using Facebook ads—or you plan to use them in the future—there’s one key tool you should start using right away to get the most out of your social ad budget: the Facebook pixel.
What is a Facebook pixel?
A Facebook pixel is code that you place on your website. It helps you track conversions from Facebook ads, optimize ads based on collected data, build targeted audiences for future ads, and remarket to qualified leads—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.
Bonus: Download a free guide that teaches you how to turn Facebook traffic into sales in four simple steps using Hootsuite.
Benefits of using a Facebook pixel
There are several ways you can use data collected from Facebook pixel tracking to refine your Facebook advertising strategy.
The Facebook pixel allows you to monitor how people interact with your website after viewing your Facebook ad.
You can even track customers across their devices so you know, for example, if people tend to see your ads on mobile but switch to a desktop before making a purchase—or maybe it’s the other way around. This information can help you refine your ad strategy and calculate your return on investment.
Pixel tracking data allows 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.
This capability is why you should create a Facebook pixel now, even if you’re not using Facebook ads yet—so you have retargeting capabilities from your very first Facebook ad.
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, helping you expand your potential customer base.
Run effective ads
Using a Facebook pixel can make your ads more effective by improving the quality of the ads you run, and by improving the targeting of the people who see them.
In addition to improving your ads based on tracking their effectiveness, you can use Facebook pixel data to ensure your ads are seen by the people who are most likely to take your desired action.
For some examples of companies using the Facebook pixel effectively, check out our post 5 Surprising Ways to Optimize Your Facebook Ads.
How to use a Facebook pixel
You can use Facebook pixel tracking to collect data on two different kinds of events: a set of nine standard events that Facebook has predefined, or custom conversions that you set up yourself. An “event” is simply a specified action that a visitor takes on your website.
The nine standard Facebook pixel events for which you can simply copy and paste standard Facebook event code are:
- View content: Someone lands on a page on your website.
- Search: Someone uses the search function to look for something on your site.
- 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.
- Add payment info: Someone enters their payment information in the purchase process on your website.
- Make 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 for a subscription product.
You can use custom conversion events in place of standard events, or to collect more details than Facebook pixel standard events can provide.
Custom conversions use URL rules based on specific URLS or URL keywords. So, for example, you could use Facebook pixel tracking to record views of a specific category of merchandise on your website, instead of tracking views of all content using the “view content” standard event—perhaps to separate dog owners from cat owners based on which sections of your pet supply website they viewed.
Before you can use Facebook pixel custom conversions, you’ll need to help Facebook understand the details of the conversion event you want to track. To do so, head to your Facebook Ads Manager, then go to Custom Conversions and click Create Custom Conversion to define your custom conversion event using URL rules.
You can also create Facebook pixel custom events by adding more details to standard events using additional bits of code called parameters. These allow you to customize the standard events based on:
- How much a conversion event is worth
- Product name, category, or ID
- The number of items someone adds to their shopping cart
- A specific search string
- The status of a registration
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
1. From your Facebook Ads Manager, click the hamburger icon (≡) and choose Pixels.
2. Click Create a Pixel.
3. Name your pixel, accept the terms, and click Next. When choosing the pixel’s name, keep in mind that you only get one pixel for each ad account, so the name should represent your business, rather than a specific campaign.
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 webpages. There are two ways to do this depending on the tools you have incorporated into your website. We’ll use the copy-and-paste method here. The other option is to use an integration or tag manager.
1. Click Copy and Paste the Code.
2. Copy and paste the pixel base 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. When you’re finished, click Next.
3. Copy the appropriate event code based on the actions you want to track on your website. For custom conversion code, click Custom Event. This Facebook help article can help you figure out which type of setup is best for you: basic, recommended, or advanced.
4. Paste the event code in the appropriate location on your webpage based on the action you want to track. It should go just below the </head> tag for a new page that opens as a result of the tracked action (like a thank you page). Or, you can attach the code to specific HTML elements like buttons that trigger actions within a page. When you’re done, click Next.
Step 3: Confirm your Facebook pixel is working
Before you start relying on the data from your Facebook pixel, you should confirm that it’s working properly.
1. Download the Facebook Pixel Helper extension for Google Chrome.
2. Visit the page where you have installed the Facebook pixel. If the extension finds the pixel, the </> icon will turn blue, and a popup will indicate how many pixels are found 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.
Note: The current Facebook pixel combines two older pixel versions: the conversion tracking pixel and custom audience pixel. Facebook discontinued the conversion tracking pixel on February 17, 2017. If you were using the Facebook conversion pixel, you’ll need to switch over to the new Facebook pixel. You can learn how to do so in this Facebook business help article. If you were using the old custom audience pixel, these instructions for Facebook pixels explain how to upgrade to the new version.