How to create a Facebook pixel and add it your website

create a Facebook pixel

If you are using Facebook adverts—or you plan to use them in the future—there is one key tool you need to begin using immediately. The Facebook Pixel will help you get the most out of your social advert budget.

Now that you realize 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 site.

Step 1: Create your pixel

  1. From your Facebook Events Manager, click on the hamburger icon (≡) in the top lefts and select Pixels.

Facebook Events Manager

  1. Click on the green Create a Pixel button.

Create Pixel button

  1. Name your pixel, enter your site URL, and click on Create.

Pixel creation screen

When selecting the pixel’s name, remember that with Events Manager, you only get one pixel for each advert account. The name should represent your business, rather than a particular campaign. If you wish to use a couple of pixel per advert account, you could do so using Facebook Business Manager.

Step 2: Add the pixel code to your site

To put the pixel to work gathering info on your site, you now need to install some code on your web pages. There a few methods to do that depending on what site platform you use.

Choosing platform screen

  • When you use an e-commerce platform like Squarespace or a tag manager like Google Tag Manager, you possibly can set up your pixel without having to edit your site code directly. This Facebook Help article describes the way to install your pixel when you already use one of those third-party tools.
  • When you work with a developer or someone else who could help you edit your site code, click on Email Instructions to a Developer to send your developer everything they should install the pixel.
  • If neither of the above options apply, you should insert the pixel code directly into your web pages. That is what we will walk you through in this part.
  1. Click on Manually Install the Code Yourself.
  2. Copy-and-paste the pixel code into the header code of your site. That is, post it after the <head> tag, however before the </head> tag. You should paste it into every single page, or into your template when you are using one.

Facebook Pixel code

  1. Select whether to use automatic advanced matching. This feature matches hashed customer data from your site to Facebook profiles. This lets you could track conversions more accurately and make bigger custom audiences.

automatic advanced matching screen

  1. Check whether you have installed the code correctly by entering your site URL and clicking Send Test Traffic.

Once your Facebook pixel is tracking activity, click on Continue.

Continue button

Step 3: Track the right events for your business

Choose which of the 17 standard events you would like to track using the toggle buttons. For each event, you should select 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 doesn’t open a new page.

You may also set parameters for some events. For instance, perhaps you specifically want to track purchases over a set dollar value.

Facebook pixel parameter options

If you want to use Facebook pixel custom events, head to your Facebook Events Manager. Select Custom Conversions from the top left menu. Then, click on Create Custom Conversion to define your custom conversion event using URL rules.

Custom conversion events screen

Step 4: Confirm your Facebook pixel is working

You already tested your Facebook Pixel installation by sending test traffic. However, before you begin relying on the data from your Facebook pixel, you need to confirm that it’s also tracking properly.

  1. Add the Facebook Pixel Helper extension to your Google Chrome browser. (It’s only available for Chrome, so when you use a different browser, you will need to install Chrome to use the Pixel Helper.)

Facebook Pixel Helper Chrome extension

  1. 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 in case your pixel is working properly. If not, it’ll provide error info so you could make corrections.

Facebook Pixel Helper screen

Step 5: Add pixel notice to your website

To comply with Facebook’s terms (and, in some cases, the law), you should ensure visitors to your site know you are collecting their data.

Which means you should provide clear notice that you are using the Facebook pixel and that their info might be collected via cookies or other methods. You also need to let users know how they will 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.

Share this post