How to add the Facebook Pixel to WordPress

Facebook’s retargeting technology helps you to track conversions and build custom audiences to better target your Facebook ads. To get started, you need to implement the Facebook Pixel to your website. In this tutorial, you are going to learn how to do that in WordPress using Advanced Ads.

Create and get the Facebook Pixel

How to create the Facebook PixelThe very first step you need to do is to login in to your Facebook account and switch to the ads manager.

Open the tools section and click on Pixel to create your own Facebook Pixel. Enter a name for it and then press the Create a Pixel button to continue.

Afterwards, a popup window will appear where you can choose if you want to email the pixel code to your technical manager or if you want to install it yourself.

Click on this option (Manually Install the Code Yourself) and simply copy the Facebook Pixel code with your unique ID that Facebook will show you with the next window.

Implement the Facebook Pixel

To set up the Facebook Pixel, we need at least one ad unit and one placement.

Go to Advanced Ads > Ads > Create New Ad

Select the ad type plain text and code if it is not already pre-selected and insert the code from your clipboard.

Give your ad a title. We called ours “Facebook Pixel”.

Implement the Facebook Pixel in WordPress

After you published this ad, create a new placement for it.

Go to Advanced Ads > Placements and choose either the header or the footer code placement from the list and your just created ad unit as the item.

The impact of the Facebook Pixel on the load time of your website is negligible so you can put the code into your header. But if you want to load this script in your footer, you can do that too. It is working on this position as well.

After you have created the placement and selected your ad unit, the Facebook Pixel is successfully added to your website, and you can start to build Lookalike Audiences from your visitors. The pixel does not add anything visible on your website. It saves a browser cookie for retargeting or remarketing and tracks custom conversions.

If you are based in the EU, you will finally need to update your Cookie Law compliant Info Message.


Joachim started marketing his first local news website in 2009. Shortly after, he successfully monetized his travel blogs about Morocco. He is an expert in affiliate marketing in the tourism and travel industry. When he's not writing tutorials for Advanced Ads or supporting other users, he prefers staying in Marrakech or at the Baltic Sea.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.