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.

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.
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.
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.

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

Copy the unique Pixel ID or full code shown.


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.

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!
Create targeted groups from site visitors for precise ads.
In Ads Manager, go to Tools » Audiences.

Select 'Website' under custom audiences.

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

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

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.