Family Encyclopedia >> Electronics

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Want to retarget your Facebook ads effectively? Installing the Facebook Pixel (also known as the remarketing or retargeting pixel) on your WordPress site is straightforward. As experts at WPBeginner, we've helped thousands of sites boost their social traffic—follow our proven steps below.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Why Use the Facebook Pixel to Supercharge Your Social Reach?

Our founder and CEO, Syed Balkhi, shared a case study on how we grew WPBeginner's Facebook traffic by 332% in 2015. Readers loved it and asked how to replicate it. Boosting Facebook Page posts via Ads lets you target broadly, but retargeting narrows it to interested visitors for better ROI and lower costs.

Show ads to people who've already engaged with your site—they're primed to convert.

What Is the Facebook Retargeting Pixel?

Ever visit a site and then see their ads on Facebook? That's retargeting powered by the Facebook Pixel.

This invisible code drops a browser cookie on visitors, enabling Facebook to serve your ads to them later.

Creating Your Facebook Pixel

We've made it simple with a video tutorial using a WordPress plugin—watch below. Prefer text? Follow these steps.

Log into Facebook Ads Manager, then click Tools » Pixels to create one.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

In the popup, name your pixel (e.g., your site or product name) and click Create.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Copy the unique Pixel ID or full code shown.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Installing the Facebook Pixel in WordPress

Add the code just before the closing </head> tag. Use the free Insert Headers and Footers plugin for ease.

Install/activate it, then go to Settings » Insert Headers and Footers.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Paste the code in the header section and save. See our full guide on adding header/footer scripts for details.

Your Pixel is now live!

Next: Build Custom Audiences with Your Pixel

Create targeted groups from site visitors for precise ads.

In Ads Manager, go to Tools » Audiences.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Select 'Website' under custom audiences.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Choose visitors (all, specific pages, etc.), set retention days, name it descriptively, and create.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

Repeat for more audiences.

Target Custom Audiences in Facebook Ads

Create a new ad campaign (e.g., traffic, conversions). During audience selection, pick your custom ones.

How to Install the Facebook Pixel for Retargeting on WordPress: Step-by-Step Guide

This is where the magic happens—higher engagement from warm leads.

Need more? Check our guide to Facebook comments in WordPress.

Subscribe to WPBeginner's YouTube channel for video tutorials, and follow us on Twitter and Facebook.