installing facebook pixel WordPress

How can you tell if your Facebook ad is generating substantial traffic for your site and helping you boost your conversion?

How do you know if it’s worth your investment?

Tracking the success of your Facebook ad is pretty simple with the use of the Facebook pixel.

The Facebook pixel is a set of codes that can be embedded on your WordPress author website to track users’ actions after they click on your Facebook ads. You can automatically find out how many people signed up for your email lists, how many actually bought your products or services, how many searched on your website, and much, much more.

Using the Facebook pixel will give you all the data that you need to make good decisions about which ad campaigns to continue and which ones are worth ditching.

Setting up a Facebook pixel is pretty easy, but it’s crucial that you do it correctly. Proper placement of the event codes will ensure the reliability of your Facebook reports.

Let me show you how we do it.

Prepare your WordPress Site for Headers Tag

The Facebook pixel is best placed just below the head tag in WordPress. The fastest way to insert these codes into your website is by using a header and footer plugin.

There are two ways to install this type of plugin.

1. Install from the Plugin Page

Go to the website and type “header and footer” in the search box.

This will return a lot of results; you can choose any plugin you like. Keep in mind though, that some plugins are better than others: a high star rating, significant number of reviews, and a good number of active installs are good criteria for selecting a plugin.

For the sake of demonstration, let’s click on H&F.

install a header and footer plugin WordPress

From the H&F page, click on the Download button and just follow the Installation instructions from the download page.

follow steps for installing plugin for WordPress manually

2. Install from Your Dashboard

The second way to install the header and footer plugin is from your WordPress account itself. Login to your WordPress Dashboard and hover over Plugins. Click on Add New.

how to install WordPress plugins from dashboard

On this screen, you can search for the header and footer plugin and once you have the plugin of your preference, click on Install Now.

click install now to finish plugin installation

After installing it, you’ll need to click on Activate Plugin.

activate the plugin

Wonderful! You can now start embedding Facebook pixel codes on your WordPress site.

Install the Pixel Base Code

The Facebook pixel base code tracks the activities on your site and should be installed on every page on your website.

This isn’t too hard—just follow a few steps.

  1. Log in to your Ads Manager on Facebook. If you don’t already have a Facebook Ads Manager account, you can just go to to set up an account.

login to Facebook ads manager

  1. On the Ads Manager panel, click on Pixels.

go to Pixels tab on the Ads Manager window

  1. Click on Set Up Pixel.

click on Set Up Pixel

  1. On the “Install Your Pixel Code” window, click on Copy and Paste the Code.

Copy the Facebook pixel code

Click on Step 1. Install Pixel Base Code.

select option Install Pixel Base Code

  1. Copy the entire pixel base code and paste it on the website header. Click on the blue box to copy the code to your clipboard.

Copy the entire pixel base code and paste it in the WordPress header

To add the tags to the header section, go to your WordPress account, select Settings, click on the “Insert header and footer” option, and paste the code.

Note: You must put the pixel base code on every page you’re sending traffic to. If you are sending ads to Clickfunnels, Leadpages, shopping carts, or any other third-party website that you’re using to build squeeze pages or sales pages, the pixel base code must be added to those pages as well.

Verify the Pixel Using the Facebook Pixel Helper

The Facebook Pixel Helper is a browser plugin that works in the background to review web pages for the Facebook marketing pixel. It validates the Facebook pixels, verifies if the pixels are working properly, and tells you if there’s any pixel error.

  1. To install the Facebook Pixel Helper, you first need to make sure you have the Chrome web browser installed on your computer.

how to install Facebook Pixel Helper

  1. Go to the Chrome Store, search for Facebook Pixel Helper, and click on + ADD TO CHROME button.

Adding a chrome extension

  1. Go to the web page where you have installed the Facebook pixel base code to validate it. If the pixel is working properly, you would see a popup note similar to the image below. If it’s not working properly, you’ll see an error message.

verify Facebook pixel

Install the Facebook Pixel Event Codes

Once you have installed the pixel base code and verified that it is working properly, you’ll want to install the conversion pixels, called “event codes.”

Events are actions that happen on your website that you want to track. There are nine standard event codes that you can use to build your audience and track website conversions:

  • Search
  • View content
  • Add to cart
  • Add to wishlist
  • Initiate checkout
  • Add payment info
  • Purchase
  • Lead
  • Complete registration

There are also custom event codes that you can use, but since we’re just starting out, let’s focus on the regular codes.

There are two main codes that you probably want to use: the Lead and Purchase actions. The Lead event code is used to track new signups on your website and the Purchase event is used to track sales on your website.

  1. On the Install Pixel window, scroll down to the next step that says Install Event Code.

Install Facebook pixels Event code on WordPress

  1. On the Copy Event Code step, choose the action that you want to track. In this example, we’ll use Lead and Purchase. First, copy the Lead code. Click on the blue box to copy the code.

Copy action Pixel to WordPress

There’s only one place to install the Lead event code and that’s the “Thank You” page. So this code has to be on the page that your user is taken to immediately after they choose to opt in. You should not put it anywhere else because it will then create leads data on your Facebook Ads Manager that are not real leads.

The event pixel code should be added to the header just before the closing </script> tag of your base pixel code on the “Thank You” page.

Notice that the Lead code has an attribute called “value.” I usually set this to zero because I do not ask for customers to pay to be on my subscribers list.

  1. When you copy and install the Purchase code, add the code only to the checkout confirmation page on your site.

Before you save this event code on your website, you might want to consider changing the “value” area to the amount of your product so you can track how much money you actually earned from the Facebook ad. The purchases data will accumulate and show up on your Facebook reports.

change value of purchase event Facebook

Facebook pixel helps businesses track the return of investment (ROI) of your Facebook ads by reporting the actions people take on your website after they click on your ad. This simple set of codes creates an opportunity for you to actually measure the performance of your ads, skipping the guesswork.

Why don’t you give it a try and come back here and tell us about the before-and-after?

Read on for more website tips and tricks: