Do you know you can try any of our premium WordPress themes for free?Show me the themes
Definitive guide to adding Facebook Pixel in WordPress

Definitive guide to adding Facebook Pixel in WordPress


Are you having problems setting up Facebook Pixel in WordPress? If you want to improve your Facebook ads conversion, use this guide, and learn how to properly ad Facebook Pixel in any WordPress site or blog.

Knowing that Facebook Ads are a necessity; learning how to set up Facebook Pixel to your WordPress site is crucial for your business. You need it if you want to:

  • know which ads are working and which not,
  • target the right audience,
  • track your conversions,
  • optimize your spendings and more.

But before we dig into the detailed how-to guide, let’s cover the basics.

Table of Content

Top WP Hosting recommended by Meks

Feel free to jump to whichever sector of this guide you need the most and enjoy it in your own pace.

1. What are Facebook Pixel and conversion tracking

2. How to add Facebook Pixel in WordPress

3. Facebook Pixel tips and tricks

What are Facebook Pixel and conversion tracking?

How exactly does Facebook Pixel work?

„The Facebook pixel is an analytics tool that helps you measure the effectiveness of your advertising. You can use the Facebook pixel to understand the actions people are taking on your website and reach audiences you care about.“

As such, it helps you tailor and deliver your messages to the right audience and at the right time. Once installed, facebook Pixel will track your visitors’ behavior, such as:

  • URLs and domains they visit
  • Devices they use
  • Interaction with your website

The collected data helps you better understand your visitors’ habits and action, so you can create better Facebook ads and get better results.

For instance, let’s say you created a Facebook ad that drives visitors to your site. Facebook Pixel will track their behavior and engagement to see how it performs so you can improve it or make arrangements for better ROI.

Conversions and conversion tracking

Simply said, a conversion is a specific action that a person takes on your website, just like Goals in Google Analytics. It can be a click on your link, view on a particular page, subscribe to your newsletter, adding an item to the shopping cart, etc. Facebook Pixel helps you track all those conversions in order to analyze the effectiveness of your marketing, make sense of it, and improve your set goals.

How to add Facebook Pixel in WordPress

This guide is all you need to install Facebook Pixel to your WordPress blog or site successfully. Now, there are two ways to do it, and I’ll explain them both. It’s up to you to choose the one that’s easier and more convenient for you.

How to set up Facebook Pixel manually

First thing you need to do is head over to your Facebook Ads Manager and click on the + Add New Data Source to create Facebook Pixel:


Once the box opens, you name the Pixel and – if you choose to – enter the website URL you want to install this pixel on. This field is optional. Click on the Create button, and you’re ready for the next step: Facebook Pixel installation. This is where all magic happens:


Out of these three options, you’ll choose the middle one – Manually install Pixel code yourself, and once you click on it, you’ll get the code to paste it to your WordPress site:


Use that code to paste it in the header code of your site ( tags), something that should look pretty much like this:

And, voila, you’re now ready to track your visitors and serve them relevant ads messages 🙂

How to add Facebook Pixel using a plugin

The other, for some more easier, way to install Facebook Pixel to your site is with plugins. With so many of them out there, we chose and tested the ones we think best serve this purpose.

Insert Headers and Footers


One of the easiest ways to a piece of code to your site is to use this great free little plugin. This plugin allows you to add extra scripts to the header and footer of your blog by hooking into wp_head and wp_footer. Just install it and head over to Settings > Insert Headers and Footers and paste the Facebook Pixel code where you want it:


Click Save, and it’s done! You now have Facebook Pixel Code installed in your WordPress blog or site!

You can use this plugin for any type of code set up: Google Analytics, custom CSS across themes, various scripts, and so on.

Official Facebook Pixel


Of course, Facebook has its own Facebook Pixel WordPress plugin 🙂

So, how do you use this plugin to add Facebook Pixel to your site? Simply add your Pixel ID you got upon creating Facebook Pixel, check „Enabling Advanced Matching improves audience building“ and click Save.


No coding or snippets play; this plugin does it all by itself.

Pixel Caffeine


The simplest way to manage your Facebook Pixel needs and create custom audiences on WordPress. Pixel Caffeine not only helps you add Facebook Pixel in WordPress but also serves as the Facebook Ads Manager tool as well. With it, you can easily:

  • Track conversions
  • Set up custom audiences
  • Create Facebook Dynamic Ads with WooCommerce
  • Make and manage product catalogs and more!

So, how to set up this plugin, you ask? Install it and activate within your WordPress dashboard, then head over to plugin’s settings:


You’ll need to connect your Facebook account within the Settings page to be able to have access to all the features.


Once you do that, customize the settings, and you’re ready to deliver your Facebook ads!

Pixel Cat


Another great quick plugin helper for your Facebook Pixel setup. Similarly to the Official Facebook Pixel, Pixel Cat as well uses Pixel ID to help you activate your Facebook ads analytics code.


Other than that, Pixel Cat helps you keep track of Facebook conversions, optimize your ad campaigns, build powerful retargeting audiences, and more! Just head on to their detailed tutorial for all the tips and tricks and have fun 🙂

There’s also a premium version that is created for more experienced advertisers and it comes with features like:

  • AMP Integration
  • Custom and Dynamic Events
  • Track Valuable User Info
  • Exclude Bouncing Visitors
  • WooCommerce integration
  • Easy Digital Downloads Integration, and more.

The price starts at $59/a year.

Pixel Your Site


Pixel Your Site is a one-click-install plugin that lets you manage Facebook Pixel but also Google Analytics and any other script. A premium option allows you to manage Google Ads, Microsoft (Bing) UET tag, and more.

The free version has everything you need to set up and manage Facebook Pixel in WordPress. Once you install the plugin, head over to its dashboard to configure Facebook Pixel, simply add your Pixel ID, and you’re ready to go.


As you see, you can even add Google Analytics tracking ID, as well as a Pinterest tag with the free addon.

Premium version will cost you from $150 for a single site, and it gives you:

  • Google Ads tag
  • WooCommerce support
  • Add any script
  • EDD support
  • 1-year license and more.

Facebook Pixel tips and tricks

Ok, so you’ve installed Facebook Pixel and now what? First of all, let it gather information for a while before you start with your first ads. Why? The longer the time passes, the more data you’ll have to create and tailor better ads and have better results. After you collect information like:

  • Demographics
  • Day and time of visit
  • Where they came from (Google, social media, directly, etc.)
  • Which device they use

you can use that data to configure relevant ads to the specifics of your audience. And you do that by creating Custom Audiences and Custom Conversions.

Custom conversions are manually added actions you want to track in order to track a specific call to action. We even made a detailed guide on what CTA is and why you need it 🙂 To illustrate, let’s say you want to gift your new subscribers with a PDF ebook that is on a specific landing page. You can create a custom conversion that tracks all visitors that come to that landing page. Later on, you can use that tracked data to tailor your messages and ads and further define custom audiences. You can find all about creating custom conversions on Facebook’s help guide.

Custom audiences are your website visitors you further group upon a specific action they performed. Email subscribers, new visitors, referred from Social Media, almost bought something from your site and so on. It’s really helpful to segment your visitors, so they receive only the most relevant ads from you. Again, a detailed how-to on their creation is in the Facebook Developers guide.

How to add Google Fonts to WordPress


Now, it’s advisable to say that you do need to comply with the GDPR, more of which we covered in this WordPress GDPR guide. Any data tracking and gathering need to comply with their rules. As they say, better safe than sorry.


Congratulations on sticking it all through the end 🙂 Now you know how to set up Facebook Pixel all by yourself! Moreover, it’s more clear why all those ads pop up even if you didn’t mean to buy or experience anything. Hopefully, this guide helps you set up everything you need to start a successful facebook marketing campaign. Feel free to share it with your friends and let us know in comments below how it all worked out.


Tags: , ,

Ivana Cirkovic

Ivana is a Digital Marketing, PR and Social Media consultant with over nine years experience in the field. She is also a WordPress enthusiast and an active member of WordPress community who lives online almost 24/7. In love with Twitter, WP, photography and NYC.

Try theme now for free!
  • Access to a copy of the demo website
  • Full access to the theme options
  • No credit card required

* We will send you an occasional newsletter with special offers, news & theme updates but you can unsubscribe at any time.