WordPress Facebook Pixel - How to Add / Install It (2024)

Install Facebook Pixel to WordPress

Are you having trouble adding to WordPress Facebook Pixel? If you're running any kind of Facebook ads, adding the Facebook Pixel to WordPress is essential because it will help you optimize your ad campaigns.

Facebook Pixel is essentially Facebook ads' equivalent of Google Analytics, or if you're more familiar with Ads, it's closer to Google Ads.

The Facebook pixel enables you to more precisely target your ads and assess how well they convert clicks into sales.

Additionally, you can develop Custom Audiences, plan Events, and generally manage your Facebook advertising campaigns more effectively.

However, if you're not very tech-savvy, it might be a little challenging to figure out how to actually set up and use Facebook Pixel with WordPress.

We're going going to give you two different (but easy) ways that are suitable for beginners to help you out:

  • Using small change to WordPress theme code: The only option available to you when editing the theme code manually is to add the Facebook Pixel code directly.
  • With a WordPress Facebook Pixel plugin: The benefit of this approach is that you can create custom audiences and conversion goals from within your WordPress dashboard when using a plugin. Because it has specific integrations for WooCommerce and Easy Digital Downloads, this plugin is particularly fantastic for eCommerce stores.

We would advise using the plugin method if you intend to use custom audiences and conversion goals. Actually, the plugin will always be better, unless you have specific reasons not to use it.

However, if all you want to do is use Facebook Pixel to build lookalike audiences and other more fundamental features, manual code implementation is the most straightforward way to set it up.

If you've in a hurry, use the Table of Contents below to scroll to the relevant section.


How to add Facebook Pixel in WordPress manually

There are two steps to manually adding Facebook Pixel in WordPress:

  1. If you haven't already, go to the Facebook website and create a new Facebook Pixel.
  2. Put the tracking code from that Facebook Pixel in your WordPress site's <head> section.

Use Facebook Business Suite Events Manager to create a new Facebook Pixel.

Open Facebook Business Suite's Events Manager section to get going. 

Then select "Connect Data Sources" by clicking the green plus sign. If you've never created any Facebook Pixels before, your interface might appear slightly different, but you should see a prompt to "Create" or "Connect Data Sources":

Connect a new data source in Facebook

You should select the Web option from the popup prompt. Because I've already created a Facebook Pixel for my account—and since there can only be one web pixel per account—this is greyed out in the screenshot.

Create a new Facebook Pixel

However, you should be able to choose the Web option if you're just getting started:

In the event that there is a second prompt, be sure to select "Facebook Pixel" and not "Conversions API."

connection method facebook pixel WordPress

After that, all you have to do is give your Facebook Pixel a name. At this point, you might be asked if you want to add your website, but doing so is optional.

Enter Facebook Pixel details

Once the setup is complete, your Facebook Pixel should appear in the Events Manager. Click the Manage Integrations button to get to the integration code snippet:

Select the manually install code option in the pop-up menu:

Wordpress Facebook Pixel manually install code

This will show you the Facebook Pixel tracking code that you must insert into your WordPress website's <head> section. You'll need this browser tab and the code in the following section, so keep them close at hand:

Facebook Pixel to WordPress install base code

Include Facebook Pixel tracking code in the <head> section of WordPress.

While you can add code snippets like this to WordPress in a variety of ways, we believe the simplest way is to use the free plugin called Insert Headers and Footers:

This is how you do it:

  • Activate the free Insert Headers and Footers plugin after installing it.
  • Access Settings. Click Add headings and footers.
  • Put the tracking code for Facebook into the Scripts in Header box.
  • Save your changes

how to add facebook pixel to wordpress

Set up events and automatic advanced matching (optional)

The basic setup is complete. If that's all you need, you can stop adding Facebook Pixel to WordPress at this point.

However, you can return to the Facebook interface and click the Continue button if you want to keep setting up more advanced options, such as Automatic Advanced Matching.

  • Choose to make this feature active:
  • To proceed to the event code, click Continue once more.
  • You can use a visual overlay to choose where on your website to add events by opening the Event Setup Tool here:
  • Click the Finish Setup option in the event setup tool when you are finished.

That's it, then! You just learned how to integrate WordPress with Facebook Pixel.

At the end of this article, we'll demonstrate how to check to see if your new Facebook Pixel is operational. But first, let us quickly go over the plugin method.


Do you want a fast website?

Who am I kidding? Don't we all?

So why do so many of us struggle?

The biggest challenge is usually finding a fast, reliable hosting company.

We've all been through the nightmares - support take takes forever or doesn't resolve our problem always blaming something on your side... 

But the biggest bummer is that the website always feels slow.

At CollectiveRay we host with InMotion hosting and our website is stupid fast. We run on a custom stack of LightSpeed server setup on MariaDB with a PHP7.4 engine and fronted through Cloudflare. 

Combined with our front-end optimizations we reliably server 6000 users every single day, with peaks of 50+ simultaneous users. 

Want to get a fast setup like ours? Transfer your site for free to InMotion hosting and get our 50% OFF on current pricing.

Try InMotion Hosting with 50% OFF for CollectiveRay visitors in April 2024 ONLY!

InMotion hosting 50% OFF for CollectiveRay visitors

Use the PixelYourSite plugin to add Facebook Pixel to WordPress


A freemium plugin called PixelYourSite makes it simple to install and set up the Facebook Pixel as well as other tracking tools like Google Analytics and the Pinterest Tag.

The benefits of using PixelYourSite over the above method include the ability to track conversions with ease and specific integrations for WooCommerce and Easy Digital Downloads. Additionally, it makes other more complex Facebook Pixel and Custom Audiences setup procedures simpler in general.

This functionality is especially useful if you're using WordPress to run an online store.

The custom audiences feature can be useful for more experienced Facebook advertisers, even if you just run a standard website.

The Facebook Pixel must already be created in the Facebook Ads Manager before you can use the plugin (you can follow the same instructions I outlined in Step 1 of the previous section if you need help). However, the plugin will take care of adding the Facebook Pixel for you, so you don't need to.

How to Add Facebook Pixel to WordPress using PixelYourSite

Install and activate the PixelYourSite plugin as you would any other plugin before using it.

  • Go to the new PixelYourSite section in the sidebar of your WordPress dashboard.
  • Select "Settings" from the menu next to "Your Facebook Pixel."

This will open up some new possibilities. The Facebook Pixel ID, which you can obtain from the Facebook Event Manager interface, should be added as the most crucial setting in this case:

Facebook Pixel settings

The other settings can then be customized based on your preferences. The PixelYourSite plugin does a good job of describing how to access all of this information, but if you enable specific settings, you might need to add some additional information (such as your conversion API token).


How to add Facebook Pixel to WordPress with PixelYourSite plugin

Once you've selected other options and added your Facebook Pixel ID, be sure to save your settings (the save button is all the way at the bottom of the interface).

The fundamental set-up is finished. You might want to investigate some of the additional features of the PixelYourSite plugin, though.

Go to the WooCommerce tab to set up some tracking options specific to WooCommerce if you're adding Facebook Pixel to a WooCommerce store:

Please take note that some features of the PixelYourSite plugin require the premium version.


WooCommerce settings

How to verify that Facebook Pixel is functioning

After adding the Facebook Pixel to WordPress, you must complete the following steps:

Visit the website where you installed Facebook Pixel after activating the Chrome extension.

When you click on the extension, you ought to see something similar if your Pixel is functioning:

facebook pixel helper to check wordpress install

That's it, then! The Facebook Pixel can be added to WordPress by doing just that. Enjoy the custom audiences, conversion tracking, and remarketing you have access to!

Add Facebook Pixel To Wordpress FAQs

How can a WordPress website add the Facebook pixel?

To manually add Facebook Pixel to WordPress, follow these two steps: Go to the Facebook website and create a new Facebook Pixel if you haven't already. Add the Facebook Pixel tracking code to the relevant <head> section of your WordPress website. You can do this using a plugin such as Headers and Footers.

How can a Facebook pixel be created?

Click on Pixels under "Ads Manager" in the menu. If you have never created a pixel before, once you are in the Facebook Pixel Command Center, you will see a green pixel button that reads, "Create a Pixel." Click on that button to start creating your first pixel and follow the wizard.

Choose a plugin to allow code in the head of the website such as Insert Headers & Footer, then install and activate it. Insert the code using the Headers & Footers plugin (found under Settings). Copy the code, choose Show in Header section and paste the code then click Save in the Scripts in Header box.

About the Author
Daniel Luke
Daniel is a web designer and developer. He has been a developer for the last 10 years working with various WordPress themes that allows him to compare and contrast different themes, understand the strengths and weaknesses to develop factual, real-world reviews. He is also a mobile app developer and technology reviewer. Over several years, he has developed his own mobile apps, both on Android and iPhone. This hands-on specialisation in mobile and web development allows him to be an authoritative voices when it comes to technology reporting.

One more thing... Did you know that people who share useful stuff like this post look AWESOME too? ;-)
Please leave a useful comment with your thoughts, then share this on your Facebook group(s) who would find this useful and let's reap the benefits together. Thank you for sharing and being nice!

Disclosure: This page may contain links to external sites for products which we love and wholeheartedly recommend. If you buy products we suggest, we may earn a referral fee. Such fees do not influence our recommendations and we do not accept payments for positive reviews.

Author(s) Featured On:  Inc Magazine Logo   Sitepoint logo   CSS Tricks logo    webdesignerdepot logo   WPMU DEV logo   and many more ...