How to Create a Facebook Pixel

How to Create a Facebook Pixel

Facebook pixels collects data that helps you track conversions from Facebook ads, optimize ads, and build targeted audiences for future ads.

Step 1: Create your pixel

  1. Go to Facebook Events Manager page and click the three horizontal bars icon (≡) in the top left, 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

Next you need to install the pixel code on your website to begin gathering the data. You have the following ways to set up your pixel:


  1. If you use an e-commerce platform like Shopify you can install your pixel without having to edit your website code directly. Check this Facebook Help article on how to.
  2. 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.
  3. If neither of the above options apply you need to insert the pixel code directly into your web pages as follows:
        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. Select automatic advanced matching if you want to track conversions more accurately and create larger custom audiences.
        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.

      Step 3: Start tracking the right events for your business

      Check out our previous article, What is a Facebook Pixel and 5 Ways to Use It,  to learn about the 17 Facebook events you can track. 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.

      If you want to track custom events, go 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

      Before you use Pixel data, check if it is being collected properly.

      • Add the Facebook Pixel Helper extension to your Google Chrome browser. (It’s only available for Chrome.)
      • 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.                                                                                                                                                                                

      Step 5: Add pixel notice to your website

      You need to let your customers know that you are collecting all this data through Pixel. This is a rule as per facebook.

      Read our other articles in our Series on Facebook Advertising:

      Lucent Innovation is a full-service Shopify web design and development company. We build ecommerce websites that are ready to sell, scale, and grow.

      Contact us for your next project: