How to Install a Facebook Pixel on your Website

How to Install Facebook Pixel on your website

The new Facebook pixel was introduced in mid-2015 as a way to combine the features that two different pixels used to offer. The new pixel is an even more powerful tool for online marketers to use in your Facebook marketing plan.

According to Facebook, the Facebook pixel can be used for three main functions:

  • Building Custom Audiences from your website for remarketing
  • Optimizing ads for conversions
  • Tracking conversions and attributing them back to your ads

You can now use the Facebook pixel to measure, optimize and build audiences for your ad campaigns, and no longer need to implement the conversion pixel and Custom Audience pixel.


Table of Contents

  1. Install Facebook pixel
  2. Add pixel to your website
  3. Verify pixel is installed correctly

The Facebook Pixel Base Code
The standard Facebook pixel is called the base code. The base code is all you need to get started with Facebook marketing. It will allow you to create custom audiences based on your website traffic, and report data back to Facebook so you can see how your ad is performing. Additionally, you can create custom events & conversions. These can track specific events or products on your site. Custom events provide a much deeper level of tracking, so for this tutorial, I’ll focus solely on installing the Facebook pixel base code.

I’ll walk you through the steps needed to install a Facebook pixel on your website using 3 different techniques, including WordPress & Google Tag Manager. Choose the one that works best for your setup. Watch the video tutorial »

Facebook Pixel Graphic
image credit:

1. Install Facebook Pixel

Before you can install the Facebook pixel on your website, you need to create the pixel in Facebook Business Manager. You can only create one pixel per ad account, so choose a name that accurately represents your ad account (or just your business in general).

RELATED: Facebook Business Manager Setup Guide »

Create Facebook Pixel in Business Manager

  1. From the home screen, click on Ads Manager
  2. Choose the appropriate Ad Account from the dropdown at the top
  3. Click on Tools > Pixels
  4. Click Create a Pixel
  5. Confirm your pixel’s name
  6. Agree to the terms
  7. Click Create Pixel

Install Facebook pixel tools menu

Install Facebook pixel base code

If you’re ready to install your Facebook pixel, click Install Pixel Now. Otherwise, you can email it to a web developer to install for you.

2. Add Facebook Pixel to Website (3 ways)

You can install a Facebook pixel on any website, but I’ll be focusing mainly on WordPress, as that is my platform of choice.

Install Facebook Pixel with Google Tag Manager

This is my preferred method. It assumes you already have a Google Tag Manager (GTM) account. If you don’t, and you plan to do any marketing, analytics or tracking on your website, I highly recommend you setup an account.

SEE: How to install Google Tag Manager on WordPress »

  1. Copy your Facebook pixel base code from the Business Manager area
  2. Login to Google Tag Manager
  3. Click on the account you want to add your pixel to
  4. Click Add a new tag
  5. Name your tag (i.e. Facebook Pixel – Base Code)
  6. Click on Custom HTML Tag under “Choose Product”
  7. Under Configure Tag, paste your Facebook pixel code
  8. Click Continue
  9. Under Fire On, choose All Pages
  10. Click Create Tag
  11. Make sure you Publish your tag changes when you’re ready to make it live

Insall Facebook pixel with Google Tag Manager

Install Facebook Pixel using WordPress Plugin

If you don’t use GTM, or you’re not a marketer, and just need a simple way to install the Facebook pixel on your site, I recommend this option.

  1. Copy your Facebook pixel base code from the Business Manager area
  2. In WordPress, go to Plugins > Add New
  3. Search for Insert Headers and Footers
  4. Install & activate the plugin
  5. Navigate to Settings > Install Headers and Footers
  6. Paste the Facebook pixel into the Scripts in Header area
  7. Click the Save button

Install Facebook Pixel with WordPress Plugin

Install Facebook Pixel in WordPress Theme

If you’re a WordPress theme developer and/or know your way around code, this is another option. Keep in mind, make sure you copy over your code if you should decide to change themes. You’ll likely want to continue using your Facebook pixel even with a new theme design.

  1. Copy your Facebook pixel base code from the Business Manager area
  2. Open up your theme’s header.php file
  3. Locate the closing </head> tag
  4. Paste the Facebook pixel code just before the closing </head> tag
  5. Save the file
  6. Use an FTP program to upload the file

Install Facebook pixel on WordPress theme

3. Check That You’ve Installed the Facebook Pixel Correctly

After you’ve installed the Facebook pixel, you want to make sure that it’s setup correctly. Facebook has created a tool to help us test our pixel. It’s a Google Chrome extension called the FB Pixel Helper.

Using Google Chrome, click this link to add the FB Pixel Helper extension to Chrome.

  1. Navigate to your website (any page is fine, because the pixel should be installed on all pages)
  2. Click this icon Facebook Pixel Helper Icon in the top-right corner of your browser bar
  3. It should say 1 pixel found on
  4. This confirms that your Facebook pixel is installed correctly

Facebook Pixel Helper Chrome extension

After a few days, you should also log back into your Facebook Business Manager to make sure data is being collected.

  1. Login at
  2. Click on your Ad Account
  3. Go to Tools > Pixels
  4. You should see a graph of your pixel traffic. This should be similar (not exact) to the amount of visitors you are receiving. Cross-reference it with your website analytics tool.

Facebook pixel traffic graph

Install Facebook Pixel Video Tutorial

This video will show you how to create the Facebook pixel in Facebook Business Manager, as well as 3 different ways to install it onto your website.

  • In your WordPress theme – start at 2:47
  • Using a WordPress plugin – start at 3:34
  • Using Google Tag Manager – start at 4:43
  • Verify it was installed correctly – start at 6:01

I hope this helps you install a Facebook pixel on your website. If you have any other installation methods, I’d love to hear them. And as always, let me know if you have any questions in the comments.

6 Commentson "How to Install a Facebook Pixel on your Website"

  1. /

    Very helpful thank you.

    → Reply
  2. /

    Is it normal that the pixel work in my Child Theme Header.php and not in my Parent Theme Header.php file ??

    Facebook Pixel helper detects it when in child theme not parent theme.

    Thank you for your reply!

    → Reply
    1. (Author) /

      Yes, Janie, that is normal. When you use a child theme, whatever files you place in your child theme override the ones in the parent theme. So the header.php file in your parent theme is not being used; just the one in your child theme is.

  3. /

    Hi Dave,

    Thanks for the detailed presentation and video.

    Could you please suggest or throw a light on
    1. Footer tracking code
    2.Target Completed tracking code
    3. Sales page tracking code
    4. Sales completed tracking code.

    How to generate, from where to generate?

    Thanks for your time.
    Kind regards

    → Reply
    1. (Author) /

      Hi Raj — Facebook has changed their interface significantly since I published this, and I have not gone back through the process since then. I can just point you to Facebook’s help article on tracking conversions with the Facebook Pixel.

What Are Your Thoughts?

All fields are required. Your email will not be published.

You can use standard <code> and <pre> tags to post code examples, or a service like