Home » WordPress Tutorials » Customization » How to Add Facebook Pixel to WordPress

How to Add Facebook Pixel to WordPress

Customization

If you are running any type of Facebook ads for your WordPress website, it is crucial to add the Facebook pixel in order to optimize these campaigns.

Facebook Pixel is similar to Google Analytics, only it is for Facebook ads. Using it will allow you to better target your audience and evaluate the effectiveness of your ads.

Getting Facebook Pixel up and running with WordPress is way trickier than it is to add Facebook like Box. We figured that adding the pixel might overwhelm you, as it is an operation that requires some technical skills. Although we acknowledge that, we believe that after you read this article, you’ll know how to add the Facebook pixel to a WordPress website.

 

How to Add Facebook Pixel to WordPress

You can add the Facebook pixel to WordPress in one of two methods – you either do it manually, or you use a plugin that allows you to add code in your website’s header.

The correct way and the one that will less affect the speed of your WordPress is the manual, as the plugins, as little as it is, are weighing down any WordPress, and you, most often than not, should do what you need, without using them.

To add Facebook Pixel to WordPress, you’ll need two things:

  • Create a new Facebook Pixel, using the Facebook Business Manager (if you haven’t already)
  • Insert the code that Facebook pixel will present you into the <head> section of your WordPress website.

We’ll do this in two simple steps.

 

Step 1: Create a new Facebook Pixel via Facebook Business Manager

Go to your Facebook Business Manager, and once there, look for the Events Manager.

When the page loads, you’ll see the following data source options:

If you haven’t already, create your Facebook Pixel by clicking the get started button.

A box should appear that asks you for a name – then all you need to do is click Create.

After that, you should see some options for how to add the Facebook pixel to your website. Choose the Manually Install the Code Yourself option:

That should display the Facebook Pixel tracking code:

Now, don’t close that tab, while you go to your WordPress website.

 

Step 2: Add Facebook Pixel tracking code to WordPress <head> section

The method you’ll use to add your Facebook pixel depends on a large number of variables.

If you haven’t created a child theme, you should be able to edit the header.php file by using the Theme Editor:

  1. Login to your WordPress admin panel
  2. Hover over the Appearance option in the sidebar menu.
  3. Click the Theme Editor option at the bottom of the pop-up menu.
  4. Look for the php file, and open it
  5. Add the Facebook Pixel code just above the closing head tag – </head>

If, however, you have created a child theme, depending on the theme you are using, you may be able to add code to your header. This option should be available somewhere in the theme customizing page. As some themes have their own, backend, customization page, search for it.

On the other hand, if the theme that you’ve chosen doesn’t allow you to add a code in the header, you can use a plugin.

We recommend you to use the Header Footer Code Manager, as it is easy to use a lightweight plugin.

If you don’t know, here is how to install a WordPress plugin.

 

Test whether your Facebook Pixel is Working

Now that we’ve added Facebook Pixel to WordPress, you need to do one more thing:

Make sure Facebook Pixel is actually working!

Doing so, we can achieve by installing the  Facebook Pixel Helper Chrome extension. Install and activate the extension. Then visit your website. If there is an active Facebook Pixel on the website, you should see something like this, should you click on the extension:

Now you know all about how to add Facebook Pixel to WordPress.

Was this post helpful?

i

Relevant tags:

Create your WordPress website today!

Connect

Editor’s picks:

Gutenberg Tutorial: How to Move Blocks in WordPress

What you need to know: The WordPress Block Editor allows you to move blocks up and down the document structure in order to rearrange the content contained within those blocks. The most popular way of moving blocks is by dragging a block from one position and dropping...

Gutenberg Tutorial: Deleting a Block in WordPress

What you need to know: You can delete a block in WordPress by selecting it and pressing the Delete key on your keyboard. Alternatively, you can press the three-dot button in the Contextual Toolbar to access the Remove block option. Lastly, it is also possible to...

Gutenberg Tutorial: Using Block Patterns in WordPress

What you need to know: A block pattern in WordPress is a group of two or more regular WordPress blocks. These blocks come in a sensible layout that you wouldn’t need to modify in most cases. Instead, you just need to add your own content to the block pattern. You can...

Gutenberg Tutorial: Using WordPress Reusable Blocks

What you need to know: Gutenberg features reusable blocks that allow you to quickly insert the same content with one click. You can mark any block or block pattern as reusable. You can find your reusable block collection in the WordPress Block Library. Have you ever...



Create your WordPress website today!


Start now