How to Create a Facebook Pixel and add it to your website

Step 1: Create your pixel

  1. From your Facebook Business Manager, click the hamburger icon (≡) in the top lefts and click on Measure & report and choose Pixels:

  2. Click the green Create a Pixel button.

  3. Name your pixel, enter your website URL, and click Create:

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.
  • 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.
  1. Click Manually Install the Code Yourself.

  2. 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.
  3. 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.
    automatic advanced matching screen
  4. 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.

Facebook Pixel cookies

In October 2018, Facebook changed how it uses cookies to track Facebook pixel data. Advertisers can now use first-party cookies as well as third-party cookies. Unless you want to opt out of using first-party cookies, you don’t need to do anything because of this change.

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.

Free E-Book