What is a Facebook Pixel Code?

The Facebook Pixel can seem over-complicated. That’s why we here at Busybee Marketing wanted to provide you with a simplified solution. A Facebook Pixel is a code that you place on a website that collects data to help you track conversions from Facebook Ads. It’s also used to build targeted audiences for future ads, and remarket to people who have already taken some kind of action on your website.

facebook pixel

How Does it Work?

Short and sweet:

It works by placing and triggering cookies to track users as they interact with your website and your Facebook ads.

Best Way to Install Facebook Pixel

Create a Facebook Pixel

The best way to setup the Facebook Pixel is to put it in the head of your website.

Here are the steps to setup Facebook Pixel:

1. Go to Appearance > Theme Editor and click on the functions.php folder on the right-hand side under Theme Files.

It’s best practice to add the Facebook Pixel to the functions.php folder. If you follow Facebook’s instructions it says to add the pixel directly to the head of your site. This would work too, BUT if you update the theme of your site (which you should) the pixel will be overwritten and you will have to reinstall it.

2. After accessing the functions.php file, scroll down to the bottom of it and you will need to insert a piece of code surrounding the Facebook Pixel code. Below is a snippet of code you can enter around the Facebook Pixel script, simply replace the comment with your own generated script.

function child_theme_head_script() { ?>
  <!-- Add Facebook Pixel Code Here -->
<?php }
add_action( 'wp_head', 'child_theme_head_script' );

Facebook Pixel Frequently Asked Questions:

Can I have multiple Facebook Pixels?

You only need the 1 pixel per 1 website. If you have multiple sites you can install a Facebook Pixel on multiple websites to track those sites separately.

Does Facebook Pixel only track traffic from Facebook?

The Facebook Pixel tracks all traffic. When a webpage that has a Facebook Pixel installed is visited by a user, Facebook is able to record that at a given time, a user with a certain signature visited the page, just like Google Analytics does. Chances are that Facebook can match that signature with a Facebook ID.

To Wrap it Up

If you promote your WordPress site on Facebook, you should add Facebook Pixel to analyze the effectiveness of your Facebook ads. To add the Facebook Pixel to WordPress, best practice is to place it in the functions.php file within your Theme Editor.

Once you’ve added the tracking code, make sure to test it out using the Facebook Pixel Helper. Hope you find this post helpful. Feel free to reach out if you have any issues during setup. Good luck!

Further reading: