how to add Facebook Pixel to WordPress

Struggling with how to add Facebook Pixel to WordPress? If you’re running any type of Facebook ads, using Facebook Pixel is essential to help you optimize your ad campaigns.

In short, Facebook Pixel is like Google Analytics for Facebook ads! It lets you better target your ads and see how effective they are at turning clicks into sales.

You can also create Custom Audiences and Events and just generally work more efficiently with your Facebook advertising campaigns.

But if you’re not super tech-savvy, it can be a little difficult to actually figure out how to get Facebook Pixel up and running with WordPress, right?

To help you out, I’m going to give you a beginner-friendly tutorial for two different methods:

  • With manual code – this is a lightweight option that helps you add the Facebook Pixel code and nothing else.
  • With a plugin – the advantage of this method is that you can create custom audiences and conversion goals from inside your WordPress dashboard. This plugin is especially great for eCommerce stores because it has dedicated WooCommerce and Easy Digital Downloads integrations.

If you’re planning to use custom audiences and conversion goals, I recommend that you use the plugin method. But if you just want to use Facebook Pixel to create Lookalike audiences and other more basic features, the manual code implementation is the simplest solution for your needs.

How to add Facebook Pixel to WordPress manually

To manually add Facebook Pixel to WordPress, you have to complete two steps:

  • Create a new Facebook Pixel at the Facebook website (if you haven’t already)
  • Insert the tracking code from that Facebook Pixel into the <head> section of your WordPress site

It’s nothing too complicated – I promise! Let’s get started…

Step 1: Create new Facebook Pixel via Facebook Business Suite Events Manager

To get started, open the Events Manager area in Facebook Business Suite. You can go straight there by clicking this link.

Then, click the green plus icon to “Connect Data Sources”. Your interface might look slightly different if you haven’t created any Facebook Pixels before, but you should see a prompt to “Create” or “Connect Data Sources”:

Connect a new data source in Facebook

In the popup prompt, you’ll want to choose the option for Web. This is greyed out in the screenshot because I’ve already created a Facebook Pixel for my account and each account can only have one web pixel. However, if you’re just getting started, you should be able to select the Web option:

Create a new Facebook Pixel

If there’s a second prompt after this, make sure to choose the option for “Facebook Pixel” and not “Conversions API”.

Then, you’ll just need to give your Facebook Pixel a name. You also might be prompted to add your website at this time, but this step is optional.

Enter Facebook Pixel details

Once you finish the setup, you should see your Facebook Pixel in the Events Manager. To access the integration code snippet, click the Manage Integrations button:

How to access Facebook Pixel code to add to WordPress

In the popup, choose the option to Install code manually:

How to manually add Facebook Pixel to WordPress

This will display the Facebook Pixel tracking code, which you need to add to the <head> section of your WordPress site. Keep this browser tab and code handy because you’ll need them in the next section:

Facebook Pixel tracking code

Step 2: Add Facebook Pixel tracking code to WordPress <head> section

While there are a number of different ways that you can add code snippets like this to WordPress, I think the simplest method is a free plugin called Insert Headers and Footers:

Here’s how to do it:

  • Install and activate the free Insert Headers and Footers plugin
  • Go to Settings → Insert Headers and Footers
  • Paste the Facebook Pixel tracking code into the Scripts in Header box
  • Save your changes
How to add Facebook Pixel to WordPress <head> section

Step 3: Configure Automatic Advanced Matching and events (optional)

That’s it for the basic setup. You’ve successfully added Facebook Pixel to WordPress and you can stop now if that’s all you need.

However, if you want to continue on with setting up some advanced settings, like Automatic Advanced Matching, you can go back to the Facebook interface and hit the Continue button.

Then, you have the option to enable this feature:

Advanced matching

Click Continue again to advance to the event code. Here, you can open the Event Setup Tool to select where on your website you want to add events using a visual overlay:

Setting up Facebook Pixel events

When you’re finished in the event setup tool, click the option to Finish Setup.

And that’s it! You just learned how to add Facebook Pixel to WordPress.

I’ll show you how to test if your new Facebook Pixel is working at the end of this article. But first, let me cover the plugin method, quickly.

How to add Facebook Pixel to WordPress with PixelYourSite plugin

PixelYourSite is a freemium plugin that makes it easy to add and configure Facebook Pixel, as well as other tracking platforms like Google Analytics and the Pinterest Tag.

The advantages of using PixelYourSite over the method outlined above are that you can easily track conversions, including dedicated integrations for WooCommerce and Easy Digital Downloads. It also just generally simplifies setting up some other advanced aspects of Facebook Pixel and Custom Audiences.

If you’re using WordPress to power an eCommerce store, this functionality is especially helpful.

But even if you’re just running a regular website, the custom audiences functionality can be helpful for more advanced Facebook advertisers.

Before you can use the plugin, you’ll need to have already created a Facebook Pixel in the Facebook Ads Manager (you can follow the same instructions I outlined in Step 1 of the previous section if you need help). However, you don’t need to actually add the Facebook Pixel to your site – the plugin will handle that for you.

How to configure PixelYourSite

To use the PixelYourSite plugin, install and activate it like you would any other plugin.


  • Go to the new PixelYourSite area in your WordPress dashboard sidebar
  • Click the Click for settings button next to Your Facebook Pixel
Facebook Pixel settings

This will expand some additional options. The most important setting here is to add the Facebook Pixel ID, which you can get from the Facebook Event Manager interface:

Where to find Facebook Pixel ID

Beyond that, you can configure the other settings according to your preferences. If you enable certain settings, you might need to add some additional information (such as your conversion API token), but the PixelYourSite plugin does a good job of explaining how to access all of this information.

In the screenshot below, you can see the links that go directly to documentation, such as “watch video” or “how to get it?”:

How to add Facebook Pixel to WordPress with PixelYourSite plugin

Once you’ve added your Facebook Pixel ID and made your other choices, make sure to save your settings (the save button is all the way at the bottom of the interface).

That’s it for the basic setup. However, the PixelYourSite plugin has some other features that you might want to explore.

For example, if you go to the Events tab, you can set up events to track on your site:

Event settings

And if you’re adding Facebook Pixel to a WooCommerce store, you’ll want to go to the WooCommerce tab so that you can configure some WooCommerce-specific tracking settings:

WooCommerce settings

Note – some features will require the premium version of the PixelYourSite plugin.

How to test if Facebook Pixel is working

After you add Facebook Pixel to WordPress, you need to do one more thing:

Make sure Facebook Pixel is actually working!

To do that, you install the Facebook Pixel Helper Chrome extension.

Once you have the Chrome extension activated, visit the site where you installed Facebook Pixel.

If your Pixel is working, you should see something like this when you click on the extension:

How to test Facebook Pixel on WordPress

And there you go! That’s all you need to do to add Facebook Pixel to WordPress. Enjoy your remarketing, conversion tracking, and custom audiences!

Is there anything else that you’d like us to explain when it comes to advertising your WordPress site on Facebook? Let us know in the comments!

Free guide

4 Essential Steps to Speed Up
Your WordPress Website

Follow the simple steps in our 4-part mini series
and reduce your loading times by 50-80%. 🚀

Free Access

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!