What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Add and Use Facebook Retargeting in WordPress

How to Add and Use Facebook Retargeting in WordPress

Facebook, with over 1 billion users, offers a great opportunity for you to market your website and business. To get the most possible traffic, subscriptions or sales, you may have tried multiple Facebook marketing methods including Facebook ads. Now the question is that, have you make efforts to maximize the outcomes of your ads? If not, you can try Facebook retargeting to get your ads more focused.

In this tutorial, we will explain Facebook retargeting first, and then show you how to get started with it to promote your WordPress site with Facebook ads.

What Is Facebook Retargeting?

You may have noticed that right after visiting a site, you see its ads when you land on another site with ad places. And that is retargeting, which is also called remarketing.

Facebook retargeting, therefore, shows the ads of your website or service on Facebook to users who have visited certain sections of your site no matter they have made purchases or not. Wondering why Facebook knows which pages people have read? That’s because those websites have some Facebook code inserted to help track the activities.

There are huge benefits of using Facebook retargeting. The most significant one is that it offers another chance for you to turn a visitor into a customer or subscriber by attracting and impressing him/her with your ads. Some other advantages are:

  • It increases your website traffic.
  • It helps you know what visitors are interested in, so you can create ads that are more concentrated on their needs, which then brings better engagement, more sales, more likes, and a higher conversion rate.
  • It is highly usable for not only large businesses, but also small sites.

To benefit your WordPress site with Facebook retargeting, you will need to follow the guide below to make use of Facebook pixel.

Create a Facebook Pixel

Facebook pixel, re-launched from the Custom Audience pixel, combines retargeting, conversion optimization and conversion tracking into one code to make it easy to apply the features to your WordPress site. The pixel does not add anything visible to your site, and instead, it sends your visitors a browser cookie.

With a Facebook pixel, you can not only retarget people who have visited your site, but also find many new customers with the similar interests as your visitors.

To create a pixel, you have to log into your Facebook account first, and then go to the Ads Manager. When you locate in the dashboard of the Ads Manager, find the menu for Tools, click on it to expand the submenus, and then choose Pixels.


On the new screen, click on the green button saying “Create a Pixel”. Make sure that you are under the “Facebook Pixel” tab instead of the old “Conversion Tracking Pixel”.

Create a Pixel

Then on the pop-up screen, enter a name for your new pixel and agree to the Facebook terms. The name could be anything: your website name, or the name of a product. When these are done, click on “Create Pixel”.

Pixel Name

Waiting for a few seconds, you will see a message telling that your Facebook pixel has been created. Besides, you will also be offered the pixel ID.

Pixel ID

As is shown in the screenshot above, now you have two choices. You can email the pixel code to others if you have someone else managing the technical parts of your WordPress site. Or in the case that your run the site by yourself, click on “Install Pixel Now” to continue.

The latter action will lead you to the pixel code which is a must for utilizing Facebook retargeting on your site. Copy the code for later use.

Copy the Pixel Code

Install Facebook Pixel on Your WordPress Site

Now that you have created your Facebook pixel, you can get it installed on your WordPress site by simply inserting the pixel code right before the closing </head> tag of the theme file. You can do this manually by editing the header.php file which could be found in Appearance > Editor. Or you can take advantage of a plugin named Insert Headers and Footers.

After installing the plugin, go to Settings > Insert Headers and Footers, and then paste the pixel code copied before into the text box under “Scripts in Header”. Also, remember to save the changes. The benefit of doing so is that you don’t have to touch the theme files.

Paste the Pixel Code in the Header

Now you have installed the Facebook pixel successfully, and the retargeting begins working. However, that’s not the end. There is still a task remaining in terms of the code.

Add Standard Events for Facebook Pixel

If you are careful, you may have seen in the popup of pixel code that Facebook provides 9 standard events for conversion tracking. These events allow you to track the views of your key pages, the way products are added to the cart, the purchases, leads, registrations, etc. With the proper use of these events, you are able to figure out the performance of your ads and optimize the advertising campaign more easily.

Standard Events

For each standard event, there is a corresponding event code. So if you want to track any of the events, you can simply add the event code to the pixel code, right before </scripts>. Below is an example.

Event Code

To track certain events, you only have to insert the code above on the pages corresponding to those events. For example, to track registrations, you need to add the code to the confirmation page, and to track purchases, the code needs to be on the page which customers are redirected to after completing a purchase.

At last, you can check whether your Facebook pixel is verified and whether the event code is placed properly by installing a Chrome extension named Facebook Pixel Helper.

Create Custom Audiences for Your Facebook Pixel

Custom audiences are an important feature of Facebook pixel that allows you to target people who are already interested in your website or products. They help a lot in the Facebook retargeting campaign.

To create a custom audience, click on Tools > Audiences in the dashboard of Facebook Ads Manager, and choose to “Create a Custom Audience”.

Create a Custom Audience

In the popup, you are given 3 choices about the type of audience. You can create a custom audience based on the customer list, the website traffic or the app activity. In our example, we have chosen “Website Traffic”, an option for most normal WordPress sites.

Audience Type

Now you are faced with more options. On the new page, you have to deal with the following things.

  • Select what kind of traffic you want to use. The available choices include all people having visited your site, those who visited specific pages, etc. Custom combinations are also allowed.
  • Choose the duration that people remain in your audience. Those who don’t visit your site during the specified time will be removed from the audience.
  • Give a name to your new audience for future identification.

After dealing with these things, click on “Create Audience”. You can repeat the steps above to create as many custom audiences as you like.

Audience Details

Show Ads to Custom Audiences for Better Retargeting

After the Facebook pixel is set up on your site and the custom audiences are created, you can now create targeted ads for your audiences and track the performance.

There are many objectives available for choosing when creating a new ad, such as getting traffic to your WordPress site, increasing the conversions, promoting your posts, etc. Depending on which objective you use, you will come to a step where you are asked to select the custom audiences. Now you should select the custom audience(s) that you want the ad to target. That’s it.

Target Ads to an Audience


Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Very often, you could find her in various WordPress event as invited speakers.