Facebook Pixel WordPress Installation & Best Practices: The Definitive Guide

David Hehenberger April 25, 2017

This is the definitive, constantly-updated guide to the Facebook Pixel. This not only touches on Facebook Pixel installation on WordPress & other platforms, but also teaches how to use the Facebook Pixel to grow your business by tracking conversions and setting up Facebook Retargeting ads.

As online marketers and business owners, it’s important to stay up-to-date on the latest online marketing methods. You need it to maximize your returns and stay ahead of the competition.

One of the latest tools online marketers use with great effectiveness is Facebook Advertising, and – by extension – the Facebook Pixel. By installing a little piece of code on your website, you’ll be able to track the effectiveness of your Facebook ads across all devices, optimize marketing campaigns and remarket directly to old visitors to your website,.

Facebook remarketing and Facebook retargeting have gained great popularity in the online marketing world in recent years, with good reason: they’re extraordinarily effective, often significantly outperforming standard ads to a cold audience.

This guide explains what the Facebook Pixel is in detail, how to set it up on your website, how to track conversions and create powerful retargeting campaigns.

This guide is very detailed and takes about 28 minutes to read. Don’t have the time right now? No problem. Click here to send a PDF to your email inbox, so you can read it later.


Why Use The Facebook Pixel?

Advertising is a notoriously wasteful industry, and online advertising is no different.

Many companies spend a whole lot of money advertising to people that are not interested in what they have to offer through channels that don’t convert. If you’re putting your ads in front of the wrong people, your conversion rates will be low.

To make matters worse, more often than not, advertisers don’t even have the proper tracking tools in place to accurately measure the effectiveness of their campaigns to begin with.

What if you could do something different? What if you could market specifically to the people who’ve already visited your website in the past, and considered buying something from you before?

With the Facebook Pixel, you can.

What Is The Facebook Pixel?

The Facebook Pixel is a little piece of code you embed on your website, allowing you to track your visitors’ behavior across your web – no matter if your visitors use desktops, tablets or mobile phones. This information is valuable because it allows you to:

The Facebook Pixel helps you discover what each visitor’s behavior on your website was, what pages they visited, whether they converted and bought something or not, and ultimately, how effective your Facebook ads are. You can use that information to track your Facebook ad ROI, improve your marketing funnel or your ads, and ultimately convert more and get a greater return on your investment.

Most of all, the Facebook Pixel lets you remarket (or retarget) to past visitors. You can create new ads that are only shown to past visitors of your website who visited a certain page or performed a certain action. People who have visited your site before in the past are likely interested in what you have to offer, and therefore likely to yield a greater return on investment than a cold audience.

Why Facebook Retargeting Is Highly Effective

The Facebook Pixel is an all-in-one retargeting pixel for Facebook ads. It lets you create Facebook ads that retarget to your old website visitors, which is insanely effective.

The potential of retargeting to your old visitors based on their past behavior makes the Facebook Pixel a must-have for anyone trying to sell something through their website.

What Is Retargeting On Facebook?

People who have already visited your website in the past are likely to be more buy what you have to offer. Retargeting on Facebook lets you show ads to those past visitors.

It’s a powerful marketing tactic that few business owners use to its full potential. Research shows that retargeted customers are 3x more likely to click on your ad as people who have never interacted with your business before, and they are 4x more likely to convert.

It’s also a unique way to get a second chance with your visitors. Only a small percentage of your website visitors will convert on their first visit, and retargeting is a very effective way to recover part of the 95+% you thought were lost forever.

For example, after browsing the WooCommerce.com site and viewing their “Subscriptions” extension, you might see this ad in your Facebook feed.

The Facebook Pixel allows you to create Facebook ads that remarket to your old website visitors – and a whole lot more.

How The Facebook Pixel Works

The way the Facebook Pixel works is quite simple. You place a piece of JavaScript code within the HTML code on your website. By doing so, you embed an invisible 1×1 pixel image on your website.

Whenever a visitor visits your site, or takes a specific action, their browser sends a request to download that image, which the owner of the servers the image sits on – in this case Facebook – can track. Facebook can track exactly how often it’s been downloaded, when, and by who.

Facebook can see:

Combining all this information, Facebook constructs an overall digital signature of the visitor’s technology. If that visitor uses that same browser to also log in to their Facebook account at some point (which nearly everyone does), Facebook can cross-reference it and match it to a specific Facebook ID. This way, Facebook can identify which specific Facebook user that browsing behavior belonged to, – even across devices.

No matter if you’re running Shopify, setting up a Facebook Pixel WordPress integration, or using any other kind of website, the Facebook Pixel will help you grow your business.

Installing The Facebook Pixel: Basic Setup

This part of this guide talks you through installing the Facebook Pixel on Shopify, setting up a Facebook Pixel WordPress integration, or installing the pixel on any other site.

How To Install The Facebook Pixel Using The Tracking Code

Implementing the Facebook Pixel code can be quite tricky if you do it manually, which is why we created our Facebook Pixel WordPress plugin to do it for you in just a few minutes.

Basically, you have to grab the right base code from your Facebook Ads account, add it to your website, and then modify and embed event code as well for each of the events you’d like to track.

You can find the most up-to-date explanation here, but here’s how you do it:

Step 1: Create a Facebook Pixel

  1. Go to your Facebook Pixel tab in your Facebook Ads Manager.
  2. Click “Create a Pixel.”
  3. Enter a name for your pixel.
  4. Click “Create Pixel.”

Step 2: Add the base code to your website

The base code is the part of the pixel code that tracks activity on your website. It should be installed on every page of your website (similar to the Google Analytics code, if you use it).

To install the base code:

  1. Go to the Pixels page in Ads Manager.
  2. Click Actions > View Code
  3. Copy the base code
  4. Paste it between the <head> tags on every page on your website.

How To Install The Facebook Pixel On Shopify

Adding the Facebook Pixel to Shopify is super easy. Simply follow the instructions here.

How To Install The Facebook Pixel On WordPress

There’s two main ways of setting up a Facebook Pixel WordPress integration.

Option 1: Adding the Facebook Pixel JavaScript to your WordPress site

  1. Follow the instructions under “How To Install The Facebook Pixel” and copy your Facebook Pixel code.
  2. Add the code to your site’s header using the free Header and Footer Scripts plugin.

While Option 1 is fine, using a dedicated Facebook Pixel WordPress plugin is what I recommend. General purposes “WordPress header script plugins” aren’t built from the ground-up to support Facebook’s Pixel, so you’ll be better off with a dedicated Facebook Pixel WordPress plugin.

The Quick & Easy Way To Install The Facebook Pixel On Your WordPress Website

We may be slightly biased here, but our own Pixel Cat plugin is a free lightweight Facebook Pixel WordPress plugin that does all the hard work of embedding the Facebook Pixel code into your website for you, so you don’t have to.

With a few clicks of the mouse, you can select exactly what events you’d like to track on which pages, and it works right out of the box – just the way you want it.

It’s the easiest way to setup a Facebook Pixel WordPress integration and start boosting the performance of your Facebook ads!

Using Pixel Cat, all you need to do is to paste your Pixel ID into our Facebook Pixel WordPress plugin.

Debugging The Facebook Pixel & Troubleshooting

The best way to check if your Pixel is working is using the Facebook Pixel Helper Chrome plugin.

The Facebook Pixel does not always work in real-time. In our experience, pixel data takes up to 30 minutes before it shows up in your Facebook account. That’s why you’ll first want to use the Facebook Pixel Helper Chrome plugin to check if your pixel is working.

After a couple of hours, log in to your Facebook Pixel Page in Facebook’s Ad Manager to see whether it’s working correctly.

Check to see:

  1. Whether your pixel status is now set to “active”
  2. Whether the data you see in the graph roughly aligns with the overall visitor volume you see in your other analytics tools (like Google Analytics).
  3. Whether the events you’ve set up show up in the “Events” tab below the graph.

If it does – you’re all set!

Facebook Pixel Events Explained

The key to getting the most out of the Facebook Pixel is to understand events. The Facebook Pixel lets you easily track your website visitor’s behavior using events. With events, you can track conversions and build Custom Audiences for retargeting purposes. These events are tracked across mobile phones, desktops and laptops.

Facebook Pixel Standard Events

By default, the Facebook Pixel lets you track nine different types of events (called “Standard Events”) that closely relate to the performance of your website. Did the visitor:

  1. View content by visiting a key page of your site?
  2. Search for something (and if so: what for)?
  3. Add a product to their wishlist (and which one)?
  4. Add a product to their shopping cart (and which one)?
  5. Initiate the checkout process?
  6. Add their payment info?
  7. Complete the purchase?
  8. Sign up as a lead?
  9. Complete a registration form?

Most of these standard events are the key actions you want visitors to take on your website, because they either indicate interest in what you’re selling, or boost your revenue. Tracking them gives you insight on what your visitors are doing on your website.

Facebook Event Parameters

Each Standard Event comes with a list of optional (and, sometimes, required) parameters. Parameters contain useful information such as $ value of a purchase event, or the search query of a search event.

Here is a description of required and optional parameters for Standard Events.

You can add whichever parameters you want to Custom Events.

Facebook Pixel Custom Events

If you want to go beyond these standard events, you can do that by defining custom events (also called “Custom Conversions”). Custom Events can be used for audience building and custom conversions.

You can give your Custom Event whatever name you want, such as “ContactFormSubmission”, “AddToCartClick”,”FrequentShopper”, “Prospect” etc.

Facebook Pixel Dynamic Events

Dynamic events are an event that will activate based on a specific action taken by your visitors on your site. For example, you could trigger the “Add to Cart” Standard Event when someone clicks on your buy now button.

Or, you could trigger a Custom Event called “Prospect” if someone spends more than 60 seconds on a landing page.

Setting Up Facebook Pixel Conversion Events

Now that you’ve added your pixel to your site, you’ll want to add some events so you can track conversions, run dynamic product ads, and build custom audiences.

Installing Pixel Events Using JavaScript

Events are all the actions that happen on your website which are important to your business objectives

You can track 9 different types of Standard Events in total, in these categories:

  1. Content: Whether visitors viewed content or searched for something (and what they searched for).
  2. Purchase: Whether visitors added a product to their wishlist, their cart, initiated checkout, added their payment info or completed their purchase.
  3. Subscription: Whether visitors completed a registration or signed up as a lead.

Which one of these you want to set up depends on what’s relevant to your specific business.

To track these events, you need to add the event code to your website:

  1. Go to the Facebook Pixel tab in Ads Manager.
  2. Click Create Conversion > Track Conversions with Standard Events
  3. Select the events that matter to your business
  4. Copy the event code of the events that matter to you.
  5. Paste it within the Facebook Pixel code (right above the </script> tag) on the relevant pages on your website.

For more information on how events work, refer to the “Facebook Pixel Events Explained” section of this guide.

Installing Custom & Dynamic Events using JavaScript

You’ll have to write some JavaScript to track Custom Events & Dynamic Events. Please refer to Facebook’s Pixel Event documentation for more information.

Facebook Pixel Event Setup For Shopify

If you install your Facebook Pixel on Shopify using these instructions, Shopify will automatically track all relevant e-commerce Standard Events. For more information, click here.

How To Install The Facebook Pixel For WooCommerce

To get the most out of a Facebook Pixel integration for any e-commerce store, you’ll want to track all Standard Events that are relevant to shopping behavior. We recommended you set up the following Standard Events:

You could manually code a WooCommerce integration, but that could easily take hours, if not days, of work.

We’re – of course – slightly biased here, but the easiest way to integrate WooCommerce with the Facebook Pixel is our own plugin – Pixel Cat Pro. With a single click Pixel Cat Premium, lets you correctly configure the Facebook Pixel for your WooCommerce store.

Once setup, Pixel Cat Pro will send all of the following data:

Tracking Conversions Using The Facebook Pixel

The Facebook Pixel lets you easily track your conversions and measure the effectiveness of your ads down to the dollar. It helps you figure out which of your ads are performing well, and which aren’t.

Conversion tracking using the Facebook Pixel comes with the following benefits:

How To Set Up Facebook Pixel Conversion Tracking

Conversion tracking is reliant on setting up Standard Events or Custom Events. You want to make sure to configure the value & currency parameters of your events, so you can accurately measure your ROAS.

Using Pixel Cat, you’d edit the value & currency here:

Now you’ll be able to create a new Facebook ad campaign (or update an existing campaign) that optimizes for conversions.

Once you’ve set this up, you’ll be able to see at a glance exactly how successful each of your Facebook ads is by seeing what happened as a direct result of that ad. All that information is right there at your fingertips within your Facebook Ad Manager.

You can use this insight to optimize your ads, killing the losers, doubling down on the winners, and boosting your overall return on investment of your advertising efforts.

Retargeting Using The Facebook Pixel

The real magic of the Facebook Pixel is that it lets you create ads retargeting to specific past visitors.

Keep in mind that not all visitors to your website are of equal value to you. Some people are just visitors. They browse around your website, but leave shortly after arriving without buying anything or ever intending to do so in the future. They’re just not that interested in what you have to offer, and trying to sell to them through advertising is a hard-fought battle, wasting many advertising dollars in the process.

But there are other people that are interested in what you have to offer. They are more engaged and more likely to convert. This group of people displays different behavior on your website than the uninterested group which you can use to identify them by:

Such a highly-engaged group of people is more valuable to you as a marketer, because they’re more likely to convert. You can increase your bid to reach out to those people, because your conversion rate and revenue is higher from that group of people than from regular cold ads!

Facebook Retargeting Using Custom Audiences

The Facebook Pixel lets you identify such engaged groups with website custom audiences, and then create ads that are only shown to those people. This allows you to specifically (re-)target people who had a certain level of engagement on your website.

In essence, you can create a custom audience out of visitors that triggered any combination of events and target them specifically.

Most people don’t buy the first time they visit your site. However, a study showed that website visitors who are retargeted with ads are 70 percent more likely to convert on your Web site.

You can create Facebook ads that are shown to all people who’ve visited your website in the past, or only to visitors who reached a certain level of engagement. You could target:

…and a lot more.

Setting Up Custom Audiences For Facebook & Instagram Retargeting

First, you’ll need to install the Facebook Pixel on your site. For best results, set up some Standard & Custom Events relevant to your business.

Now, log into Facebook’s Ad Manager and go to Audiences.

Now, go to Create Audience -> Custom Audience.

Choose “Website Traffic”.

Here, you have 5 options:

By being creative with these targeting options, you could pinpoint the visitor segment that’s most likely to convert (and boost revenue) with laser-like precision and present them with a custom-tailored ad that speaks to them specifically.

Now that you’ve created a custom audience, you can create a Facebook campaign that will specifically target members of that audience. Note that a custom audiences needs at least 20 members before you can start serving ads – meaning you’ll have to wait anywhere from a few hours to a few weeks before being able to serve ads to your audience.

Facebook Remarketing Using Dynamic Product Ads

What Is A Dynamic Product Ad?

Dynamic product ads are ads that promote products from your product catalog. These ads work particularly well for retargeting shoppers who have viewed a product, but didn’t make a purchase.

If you’re running an online shop with more than 3 products, you’ll want to use Dynamic Product Ads. This video gives you a good introduction on how Dynamic Product Ads work.


Step 1: Create A Product Catalog

In order to run Dynamic Ads for your online store, you’ll need to set up a Facebook Product Catalog. In order to create a Product Catalog, you’ll need to create a Facebook Product Feed for your store.

Creating A Facebook Product Feed for Shopify

If you’re using Shopify, use this app to create a Facebook Product Feed.

Creating A WooCommerce Facebook Product Feed

The easiest way to create a Facebook Product Feed for WooCommerce is our Pixel Cat Pro plugin. With a single click, you’ll be able to set up a product feed.

Pixel Cat also comes with a bunch of options that let you configure your WooCommerce Facebook Product Feed in granular detail, please refer to our knowledge base for more details.

Using this WooCommerce Facebook Product Feed, you’ll be able to create a WooCommerce product catalog

Configuring Your Product Catalog

First, open your Facebook Business Manager’s settings. In the left hand navigation, select Product Catalogs.

Then, go to Add New Product Catalog -> Create a New Product Catalog.

Next, give your Product Catalog a name, make sure Type is set to Products and click “Create Product Catalog”.

Decide whether you want to give people access to your catalog, or skip through and click OK.

Next, choose which Pixel to associate with your Product Catalog. Make sure this is the same pixel that you used when setting up Pixel Cat.

Well done. You’ve just created your Product Catalog. Now click Add Product Feed.

Select your new product catalog and choose Add Product Feed. Choose your Feed Name and Currency. Under Upload Type, choose Scheduled Recurring Uploads. Click Next.

Set “Schedule Uploads” to Hourly, to make sure your product catalog always stays up-to-date.

Then, go copy your Feed URL. Paste the URL into the Feed URL field. Leave the username & passwords fields empty, and click Create Feed.

That’s it. No matter if you use Shopify, or created a WooCommerce product catalog, you’re done with this step.

Step 2: Setup Shopping Events

Next, you’ll need to configure your Facebook Pixel events. The following 3 events have to be tracked if you want to set up Dynamic Product ads

Setting Up Facebook Standard Events for Shopify

Using Shopify’s built-in Facebook Pixel integration, you’ll be able to track all relevant shopping events. Learn more here.

Setting Up Facebook Standard Events for WooCommerce

The easiest way to set up Facebook Pixel Events for WooCommerce is our Pixel Cat Pro plugin.

With a single click, you’ll be able to track all of the following events:

Step 3: Create Your Campaign

In the Facebook Ad Manager, create a new ad. Choose Product catalog sales.

Select your product catalog and press continue.

If you want to promote only specific products, you can create a product set. This step is optional.

Click on “Use info from your pixel or app to create a retargeting audience.”

Next, select an Audience. Facebook’s “Viewed or added to Cart But Not Purchased” is a good place to start.

Under “Placements”, either choose “Automatic Placements”, or “Edit Placements”. For example, if you know that most of your customers don’t purchase on Mobile, you’ll want to set “Device Types” to “Desktop Only”.

Next, you’ll want to configure your Budget & Schedule. A few things to keep in mind:

Click “Continue” and finish setting up your ads. Then, click “Place Order” to start your campaign.


Advanced Matching

The Facebook Pixel’s Advanced Matching feature lets you leverage your customer data (email, phone number, etc…) to more accurately track conversions. When beta testing Advanced Matching, Facebook observed a 10% increase in attributed conversions and a 20% increase in reach.

To enable Advanced Matching, you’ll have to make some modifications to your Facebook Pixel code. You can learn more here.

Creating Lookalike Audiences

Using the Facebook Pixel, you can find customers who are similar to people who converted on your website. Once you’ve tracked at least 100 conversions, you can create a lookalike audience.

How To Migrate To The New Facebook Pixel From The Old Conversion Pixel

Ingenious little tools, Facebook Pixels help you boost your marketing efforts in a variety of ways. They let you measure the performance of your ads, improve them to convert more and get better results, and even create highly converting ads retargeting to your past visitors.

Initially, Facebook used several different pixels to accomplish these goals. In 2015, they combined them all into one new, better Facebook Pixel to replace all old ones. And recently, in March 2017, Facebook retired the old pixels altogether.

The new Facebook Pixel is the only pixel you need and offers tracking, optimization and retargeting all built in one.

That means that if you’re still running the old pixels, it’s time to replace them. This article explains how you can migrate safely to the new Facebook Pixel – the quick and easy way.

The Old Facebook Pixels

Facebook used to offer several different pixels that each had limited functionality.

The Conversion Pixel lets you track conversions and optimize them. And the Custom Audience Pixel let you retarget to a custom audience and create dynamic ads.

While useful, it was annoying and inefficient to have to install two different pixels on your website. Facebook had enough of this mess, and combined them into one.

The New & Improved Facebook Pixel

The new Facebook Pixel does everything the old Conversion and Custom Audience pixels did and more. It offers tracking, optimization and retargeting all built in one, and is the only pixel you need going forward.

Not only is it more powerful, it’s also lightweight to keep your page load speeds up and easier to install on your website and modify than the old pixels were.

All the old pixels have been depreciated in early 2017, so if you still have them on your website, you NEED to migrate to the Facebook Pixel.

How To Migrate To The New Facebook Pixel

So, how do you migrate to the new Facebook Pixel?

Don’t worry – it’s not that complicated if you follow the steps. But it can be annoying at times and take a little while to make the switch.

Make sure you do it right, because else you might track incomplete or inaccurate data, and break some of your previous settings – potentially ruining your ads performance.

Step 1: Install The New Facebook Pixel

First thing’s first, you need to install the new Facebook Pixel on your website. You do that by adding some code within the <head> tag of the HTML code of all the pages you want to track.

For detailed instructions, refer to the “Installing The Facebook Pixel” section of this guide.


Step 2: Replace Conversion Pixels With Events

For each and every old conversion pixel, you need to create a corresponding Pixel event.

Follow the instructions in the “Setting Up Facebook Pixel Conversion Events” section of this guide.

Step 3: Switch Your Existing Ads To The New Pixel

All the ads you have running that use the old conversion pixel need to be switched to the corresponding event in the new Facebook Pixel (or else the tracking might stop working altogether).

Switching this is pretty easy:

  1. Open the Facebook ad set you need to fix.
  2. In the top section called “Optimize for a conversion”, delete the existing conversion event.
  3. Add the new Facebook Pixel Event in that same section.
  4. Click the “Save and Close” button.
  5. Do this for all your ad sets that you need to update.
Step 4: Switch Your Promoted Posts To The New Pixel

All the promoted posts you have running right now also must be switched to the new pixel.

You’ll have to edit each ad individually (one by one) as follows:

  1. Open the promoted post you need to fix.
  2. Go to the section called “Pixel Tracking
  3. Select “Track all conversions from my Facebook Pixel.”
  4. Update and save your changes.
  5. Do this for all your promoted posts that you need to update.
Step 5: Verify the pixel

Once you’ve changed all of that, quickly verify that your new pixel is working correctly. An easy way to do that is with the free Facebook Pixel Helper chrome extension.

When you’re sure that it’s working the way it should, it’s time to delete the old conversion pixels.

Just remove all the code of the old Facebook Pixels from your entire website.

The new Facebook Pixel should do the job and take care of everything.

You’re All Set!

That’s all there is to migrating safely to the new Facebook Pixel. Feel free to explore the new features of the new pixel, and set up advanced events and custom audiences to improve your overall marketing strategies.

Tying It All Together

In this guide, we’ve discussed what the Facebook Pixel is, and how to get the most out of it.

Just getting started? This is how you set up a Facebook retargeting campaign with the Facebook Pixel:

  1. Install the Facebook Pixel on your site.
  2. Add Facebook Pixel conversion events to your site.
  3. Wait a couple of days for the Pixel to collect enough data.
  4. If you’re running an e-commerce store, set up a product feed and create a Dynamic Product Ads campaign.
  5. Otherwise, set up a Custom Audience and create an ad campaign that optimizes for conversions.

Hopefully, you’ve found this guide useful. Do you have any questions? Leave a comment below.

Using WordPress? Check out our Facebook Pixel WordPress plugin, Pixel Cat. It’s a lightweight WordPress plugin that does all the hard work of embedding the Facebook Pixel code into your website for you so you don’t have to add the code yourself.

With a few clicks, you can select exactly what events you’d like to track, and it works right out of the box – just the way you want it. And, if you’re using WooCommerce, Pixel Cat helps you set up the Facebook Pixel for WooCommerce, and create a Facebook Product Feed.

It’s the easiest way to add the Facebook Pixel to your WordPress website and start boosting the performance of your Facebook ads! Get Pixel Cat here.

You may be interested
in these articles

Free PDF Download
Send the "Facebook Pixel WordPress Installation & Best Practices: The Definitive Guide" to your email inbox so you can read it later.