How to Add Facebook Pixel in WordPress (+ eCommerce Tracking)

Are you looking into retargeting ads on Facebook? Do you want to install the Facebook pixel in WordPress?

Setting up Facebook Ad campaigns that are targeted toward people that have previously viewed your content is a great way to drive more traffic back to your site.

In this article, we’ll show you how to add the Facebook pixel in WordPress, step by step, to set up retargeting ads.

Adding Facebook Retargeting Pixel in WordPress

Why Use Facebook Retargeting Pixel to Boost Your Social Reach

Syed Balkhi, our founder and CEO, published a case study on how we boosted WPBeginner’s Facebook traffic by 332% in 2015. This sparked an overwhelming interest from our readers, who wanted to know how they can do the same for their websites.

When you boost Facebook page posts using Facebook ads, you can select a wide range of target audiences. Retargeting allows you to narrow your audience and get better results with less spending.

You can show your ads to people who are already interested in your website. These people are much more likely to respond to your boosted posts and advertisements on Facebook.

What is a Facebook Retargeting Pixel?

Have you noticed that after you visit a website, you start seeing its ads on Facebook? This is called retargeting or remarketing.

Those websites use Facebook’s retargeting technology, commonly known as Facebook Pixel or Meta Pixel.

The retargeting pixel does not add anything visible to your website. It simply sends a browser cookie to your visitors.

This allows Facebook to retarget users visiting your website on Facebook.

Let’s take a look at how you can add a Facebook retargeting pixel to your WordPress site.

Step 1. Creating a Facebook Retargeting Pixel (Meta Pixel)

To make it easy, we have created a video tutorial on how to install a WordPress plugin that you can watch below.

https://youtube.com/watch?v=2wQ6I0xOGtA%3Fversion%3D3%26rel%3D0%26fs%3D1%26showsearch%3D0%26showinfo%3D1%26iv_load_policy%3D1%26wmode%3Dtransparent

Subscribe to WPBeginner

https://www.youtube.com/subscribe_embed?usegapi=1&channel=wpbeginner&layout=default&count=default&origin=https%3A%2F%2Fwpbeginner.com&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.vQiXRrxCe40.O%2Fam%3DAQ%2Fd%3D1%2Frs%3DAGLTcCMBxIGVyXSdvvcs43a64yHt_P7dfg%2Fm%3D__features__#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh&id=I0_1448178294715&parent=https%3A%2F%2Fwpbeginner.com

However, if you just want to follow text instructions, then you can follow our step by step tutorial on how to install Facebook’s retargeting pixel in WordPress.

First, you need to log in to your Facebook account and visit the Meta Business Suite. Then, click on All Tools » Events Manager.

Open Meta Business Suite and click on Events Manager

Next, click on the ‘+ Connect to Data Sources’ button in the left-hand menu and select the ‘Web’ option.

After that, click the ‘Connect’ button.

Connect to Data Sources in Facebook Events Manager

In the next popup window, you need to enter a name for your pixel, which can be the name of your business or product.

Then, click the ‘Create Pixel’ button to continue.

Enter a name for your pixel

Next, simply enter the URL of your website and click the ‘Check’ button to see if your site is eligible for integration with supported partners like WordPress and Shopify.

Enter your website URL to create Facebook Meta pixel

If your site is to be eligible for integration, you’ll see a green checkmark and you can click the ‘Next’ button to continue.

Next, you need to choose how to connect your website and send activity to Facebook.

For this tutorial, we’ll select the ‘Meta Pixel only’ option. You can always set up the Conversion API in addition to your pixel later.

Choose how to connect your website Meta pixel

Click ‘Next’ to continue.

Now, you need to select a method for adding the pixel code to your website.

If someone else manages the technical things on your website, then you can email them the pixel code. Otherwise, click on the ‘Install code manually’ button to install it yourself.

Choose the option to install Facebook Meta pixel code manually

Facebook will now show you the pixel code that you need to install on your WordPress site.

Simply click the ‘Copy Code’ button to copy the pixel code, and we will show you how to install it in WordPress.

Copy the code for the Facebook Meta pixel

Step 2. Installing Facebook Pixel in WordPress (+ eCommerce Tracking)

You need to add the Facebook pixel code just before the </head> in your WordPress theme.

The easiest way to do this is by using the free WPCode plugin.

WPCode is the best code snippets plugin for WordPress. It makes it easy to insert code into your WordPress site’s headers and footers without needing to edit your theme files.

To get started, you need to install and activate the WPCode plugin. For step by step instructions, see our guide on how to install a WordPress plugin.

After installing and activating the plugin, you need to go to the Code Snippets » Header & Footer page.

Then, simply paste the Facebook pixel code into the Header box.

Paste Facebook Pixel in WPCode header box

When you’re finished, don’t forget to press the ‘Save Changes’ button.

See our guide on how to add header and footer code in WordPress for detailed instructions.

With that, you have successfully installed Facebook pixel on your WordPress website.

Alternative: Adding Facebook Pixel for WooCommerce with eCommerce Tracking

If you have an online store, you can upgrade to the premium version of WPCode to add eCommerce tracking pixels and improve your ad performance.

WPCode Pro version

WPCode’s Conversion Pixels addon allows you to easily add eCommerce tracking pixels for popular platforms like Facebook, Google Ads, Pinterest, and TikTok in 1-click.

It seamlessly integrates with WooCommerce and Easy Digital Downloads, so no additional setup is required.

You can quickly choose which eCommerce events to track, such as product page view, add to cart, checkout, and purchase, so that you can better understand how your ads are performing and improve your return-on-ad-spend (ROAS).

First, you need to install and activate the premium WPCode plugin. You need the Plus plan or higher to access the Conversion Pixels addon. For step by step instructions, see our guide on how to install a WordPress plugin.

After that, follow the same instructions in step #1 to create a Facebook pixel for WooCommerce.

Next, copy the pixel ID, which you can find under ‘Data Sources’ in the Facebook Events Manager of your Facebook Business account.

Copy Facebook Pixel ID

Then, go to Code Snippets » Conversion Pixels from your WordPress dashboard, and paste your pixel ID into the ‘Facebook Pixel ID’ field.

Paste your Facebook Pixel ID

After that, you need to add your Facebook Conversion API Token to set up eCommerce tracking.

To do that, go back to the ‘Data Sources’ screen from the Facebook Events Manager and click on your pixel. With your pixel selected, click on the ‘Settings’ tab, and then click on the ‘Generate Access Token’ link.

Generate access token for Facebook Conversions API

After clicking the link, your access token will be automatically generated. Simply copy the access token and paste it into the ‘Conversions API Token’ field in WPCode.

Paste Conversions API Token in WPCode

Now, you can scroll down the page to choose what type of eCommerce events to track.

By default, all events tracking is enabled. But, if you want to turn off events tracking for any of the options, simply toggle the switch to ‘Off.’

Enable or disable events tracking in WPCode

Don’t forget to hit the Save Changes button at the bottom of the page.

That’s it, you’ve successfully added the Facebook pixel for WooCommerce and you’re ready to track eCommerce events.

Step 3. Creating Custom Audiences Using Facebook Pixel

Now that you have successfully installed Facebook Pixel on your WordPress site, the next step is to create custom audiences for your retargeting campaigns on Facebook.

Custom Audiences allow you to target users you already know for your Facebook ads. These users can be your website visitors, users who like your page, or users who signed up for your mailing list.

Here is how you can create custom audiences on Facebook.

Simply visit the Meta Business Suite dashboard and go to the All Tools » Audiences section.

Click on All Tools and choose the Audience option

On the next page, click on the ‘Create a Custom Audience’ button.

Click the Create Custom Audience button

This will bring up a popup where you need to choose the audience source you want to target on Facebook.

You can choose your website, customer list, app activity, and more. For this tutorial, we’re going to choose the ‘Website’ option.

Choose the source for your custom audience

After that, click the ‘Next’ button.

Now Facebook will ask you which website audience you want to target. You can choose all website visitors, people who visit specific pages, or visitors by time spent.

Choose the events for your custom audience

Next, you need to choose a duration of a number of days. Lastly, you need to provide an audience name. Use something that helps you easily identify this audience in your insights.

Once you are done, click on the ‘Create Audience’ button to finish creating your first custom audience.

Repeat the process to create more custom audiences by Facebook retargeting.

Step 4. Showing Your Ads to Custom Audiences Using Facebook Retargeting Pixel

The real fun begins with engaging your custom audiences by using Facebook ads.

Start by creating a new ad in Facebook. You can run different kinds of ads for different objectives. Like boosting your page posts, sending traffic to your website, increasing conversions, and so on.

Depending on what objective you choose, you will be able to select the target audience at some point during the ad creation.

In the same audience selection, Facebook will show you a custom audience, and you can select it to be targeted with your ad campaign.

Retargeting custom audience on Facebook

We hope this article helped you install Facebook remarketing/retargeting pixel in WordPress. You may also want to see our guide on how to install and set up Facebook comments in WordPress and our expert picks for the best WordPress Facebook plugins to grow your blog.

Are you looking into retargeting ads on Facebook? Do you want to install the Facebook pixel in WordPress? Setting up Facebook Ad campaigns that are targeted toward people that have previously viewed your content is a great way to drive more traffic back to your site. In this article, we’ll…

Are you looking into retargeting ads on Facebook? Do you want to install the Facebook pixel in WordPress? Setting up Facebook Ad campaigns that are targeted toward people that have previously viewed your content is a great way to drive more traffic back to your site. In this article, we’ll…

Leave a Reply

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