How to Set Up a Facebook Pixel


Meaghan Butler, Paid Search Specialist at Ontario SEO
Meaghan Butler
June 10, 2021
How To Create and Setup a Facebook Pixel

How do you spot a rookie advertiser? Check if they have a Facebook pixel.

If you’re like most new advertisers, you probably want to skip the technical side of things and get straight to creating your ads. You’ve probably wondered what a Facebook pixel is, and if it’s really necessary. The bad news: You do need to set up a Facebook pixel. The good news – setting it up is a simple process, and it can have a huge impact on the success of your campaigns.

What is a Facebook Pixel?

A pixel is a short snippet of code that allows Facebook to collect data from your website – like the pages users view and the actions they take – in a privacy-safe way.

When users click a link in your ad, they’re taken to your website or landing page where they can browse your products or services, make a purchase, or contact you for more information.

By sending data about user behaviour back to Facebook, you’re closing the feedback loop and enabling reporting and optimization based on what takes place after the ad click.

Why Should I Use the Facebook Pixel?

Access Detailed Performance Insights

By default, Facebook’s Ads Manager tool offers basic ad performance metrics like reach, impressions, clicks, and cost. But how do you know if your ads are really having an impact?

To understand your Facebook ads performance, it’s important to be able to link your ads to actions that are valuable to your business, such as Purchases or Leads from your website. With the Facebook pixel and proper event tracking, you’ll have access to additional metrics like Cost per Lead, Purchase Value, Return on Ad Spend (ROAS) in Ads Manager, which can tell you how your ads are impacting your bottom line.

For instance, you might want to know:

  • Which of my ads lead to the most sales/revenue?
  • Which audience targeting methods are profitable?
  • Which landing page has the highest conversion rate?

Without the Facebook pixel, you wouldn’t be able to answer these questions in the ad platform.

Optimize Your Ads for Action

While performance insights in Ads Manager can help with making decisions like which ads to pause, a lot of the real work is done behind the curtain through machine learning. The Facebook ads algorithm analyzes your performance data and adjusts ad delivery in real time to meet the objective of your campaign. With the Facebook pixel, data inputs are improved so the algorithm can do its job better and faster.

Certain campaign objectives, like Reach, Traffic and Video Views don’t require pixel data to operate, but if you want to use the Conversion objective, you’ll need to have the Facebook pixel installed and event tracking set up.

With a Conversion campaign, you choose which action you want to optimize for and Facebook uses historical data to try and achieve the best results within your budget. This means:

  • Delivering ads to the users most likely to take action 
  • Showing the best-performing ad creative more often

If you really want to hand over the reins, opt in to “detailed targeting expansion” and Facebook will target users outside of your chosen audience if there’s opportunity to achieve conversions at a lower cost.

Target High-Value Audiences

Remarketing Audiences

Ever felt like you’re being followed by ads from a company after visiting their website? It’s likely that you’re in a remarketing audience. A remarketing strategy helps to recapture the attention of people who are already considering your product or service.

Your pixel tells Facebook which users have been on your website, so you can create a remarketing audience to target them specifically. You can include or exclude users depending on their specific behaviour, so the use cases are endless. Some examples include:

  • All website visitors from the last 7 days 
  • Users who visited a product page or viewed a product video 
  • Users who added a product to their cart, but didn’t check out 
  • Top 25% of users by time spent on the website

Lookalike Audiences

A lookalike audience is exactly what it sounds like – a pool of users who are similar to a “seed” audience, like your remarketing audience or a customer list. With lookalike audiences, you can efficiently scale your customer base by targeting the users that are the most likely to become customers.

  • A lookalike audience based on data from the pixel is more dynamic than a list-based lookalike, and only needs to be set up once. As your seed audience grows or changes, so does your lookalike audience – so there’s virtually no maintenance required.
  • You decide how specific you want your audience to be. For example, a 2% lookalike audience selects the 2% of users in the targeted location who are the most similar to your seed audience. When it’s time to scale further, you can increase the percentage to reach more users.
  • For campaigns in Special Ad Category such as Housing, Credit or Employment, lookalike audiences are called “special ad audiences”. The only difference is that demographic characteristics like age and gender are not considered in the matching process.

How to Create and Install a Facebook Pixel on Your Website

Create Your Facebook Pixel

To create your pixel:

  1. Go to Events Manager.
  2. Click Connect Data Sources and select Web.
  3. Select Facebook Pixel and click Connect.
  4. Add your Pixel Name.
  5. Enter your website URL to check for easy setup options.
  6. Click Continue.

Add the Pixel code to your website

Once you’ve created your pixel and continued to pixel setup, you’ll have three options to choose from:

  • Use a partner integration. If you use a website tag manager such as Google Tag Manager, select it from the list of Partners and follow the prompts.
  • Manually add a pixel code to the website. You’ll need to copy the base code, find the header of your website (or locate the header template in your CMS or web platform), then paste the base code at the bottom of the header section, just above the closing head tag.
  • Email the instructions to a developer. If someone else updates the code on your website, you can email them instructions to install your pixel.

For detailed instructions, visit the Facebook Help Center.

Set Up Event Tracking

By default, a “Pageview” event will fire on every page that your pixel is installed. In order to track user behaviour beyond page views, you will need to set up event tracking.

There are three ways to set up Facebook event tracking:

  1. Turn on Automatic Events. Automatic events are events that the Facebook pixel tries to detect automatically on your website. In your Pixel Settings, click to toggle on ‘Track Events Automatically Without Code’ under Event Setup. 
  1. Use the Event Setup Tool. This tool allows you to set up standard events based on button clicks or page visits without any additional code. 
  1. Manually add event code to your website. We recommend managing event code using an external tag manager like Google Tag Manager. 

Once you have event tracking set up, you’ll want to customize your column view in Ads Manager to show metrics related to your events.

Troubleshooting Your Facebook Pixel

While the setup process for a Facebook pixel is fairly straightforward, nothing we do is ever “set and forget”. Especially with new measures to protect user privacy, Facebook advertising and event tracking are getting more complex. If you want someone to stay on top this for you, consider our Facebook Ads management services.