How To Add The Facebook Pixel to WordPress

Adding the Facebook pixel(now called the Meta pixel) to your website is a brilliant way to optimize your Facebook ad campaigns. The pixel enables you to create ads that are targeted at users who have previously been on your site.

It is sort of an analytics tool that helps you to measure the effectiveness of your ads by keeping track of visitors’ interactions on your website.

The Facebook pixel is a piece of code. When installed on your website, it sends browser cookies to your site visitors and, then, transfers the collected data to Facebook for ads retargeting. So, these site visitors start seeing those customized ads on Facebook subsequently.

I am going to walk you through the two methods to add the Facebook pixel to WordPress, which are:

  1. without a plugin/using a manual code
  2. using a plugin

How to Add Facebook Pixel to WordPress without a Plugin

There are two straightforward steps for adding the pixel to WordPress with a manual code:

  1. creating the pixel
  2. adding the pixel in WordPress

How to Create a Facebook Meta Pixel

To create a new Facebook Pixel, head to the Facebook Events Manager here.

Connect Data Sources

When you hover your cursor over the sidebar, it expands to show you its options:

Click the green button to Connect Data Sources, and you will get a popup prompt:

In the prompt, choose the option for Web and click the Connect button:

Create the Pixel

Then, name your pixel and click the Create Pixel button:

You will be prompted to add your website’s URL. Input the URL and click Check to see the partner integrations that are available for your website. Click Next to proceed with choosing how to install the pixel on your website: 

Choosing Install Options

Choose Meta Pixel only, then click Next:

Now, you need to select a method for adding the pixel code to your website. Click on the Install code manually button:

Opting to install the code manually will display the Facebook pixel tracking code, which you need to input into the <head> section of your WordPress website. Copy the code:

Adding the Facebook pixel code in WordPress

The simplest way to add the pixel code to WordPress is by using a plugin. I chose the WPCode for this post. It is free, easy to use, and does not require you to edit your theme files.

After you have had WPCode installed and activated, locate the Code Snippets feature in the sidebar navigation in your WordPress dashboard. Then, go to the Header & Footer page:

Paste the copied Facebook pixel code into the Header box, then click on the Save Changes button:

That is all for adding the Pixel to WordPress without a plugin.

How to add Facebook Pixel to WordPress with PixelYourSite plugin

PixelyourSite simplifies the process of adding and setting up tracking codes such as Facebook Pixel, Google Analytics, and the Pinterest Tag on your website.

The tool integrates with WooCommerce and Easy Digital Downloads. It is also compatible with GA4(Google Analytics 4) and GDPR compliance features, including cookie consent.

Start by installing and activating the plugin.

Then, locate the PixelYourSite in your WordPress dashboard sidebar. Click the Click for settings button in the Your Facebook Pixel section:

Next, you will get an interface where you can add the Facebook pixel ID, which you can copy from the Facebook Event Manager interface.

You can choose further options, like Enable Conversion API and Enable Advanced Matching. There are videos for each of these settings, so you can understand what they are about. Towards the bottom of the interface, there also are numerous other videos about the settings and features of the plugin, related issues, and how to resolve them.

The Events and WooCommerce tabs, respectively, are where you can configure settings for each of those.

When you are all set, scroll down to the bottom of the page to Save Settings, and you are done.

a screenshot of   adding facebook pixel ID

How to Create Custom Audiences Using Facebook Pixel

Custom audiences are needed for Facebook retargeting campaigns. They allow you to target users who have already shown an interest in your business. These users can be your website visitors or people on your mailing list.

Head over to the Meta Business Suite dashboard to get started. Go to All Tools, then Audiences:

click on Create a Custom Audience:

You will get a popup in which you are to choose from different custom audience sources. Click Website, then Next:

Since you chose website visitors as a source, you are going to get a dropdown menu of criteria on which your visitors should be selected as custom audiences:

  • All website visitors
  • People who visited specific pages
  • Visitors by time spent

You can state the number of days, from 1 – 180, for which you want these people to remain in your audience after meeting the website traffic criteria you specified.

Name your audience, make any other needed choices, and click on Create audience.

And that’s a wrap for adding Facebook pixel to WordPress.

Now, go ahead, and install the pixel to better understand your audience and target your ads towards them.

If you found this guide helpful, and want to explore more ways to enhance your WordPress site for business growth, check out our previous post on the best lead generation WordPress plugins.

favour Etinosa
favour Etinosa
Articles: 2

Leave a Reply

Your email address will not be published. Required fields are marked *