PHPMatters Help You Better Hosting Your PHP-based Sites
How to Use Facebook Pixel in WordPress to Track Your Online Business

How to Use Facebook Pixel in WordPress to Track Your Online Business

Facebook, one of the most widely used social networking platforms, now handles millions of active users on a daily basis for information sharing and online connection. Due to its massive user base, this platform gives you the great chances to better promote and market your online business with increased traffic, sales and revenues.

Even, to maximize these benefits, Facebook also allows you to easily create the Facebook ads for the launching of the promotional campaign and releases the useful pixel for the tracking and conversion optimization purposes mainly.

This time, we’d like to make a detailed introduction of the Facebook pixel, along with how to use Facebook pixel in WordPress to benefit your online business.

Benefits of Facebook Pixel

In fact, the Facebook pixel is a special tool offered by this social platform to help you carry out the following three practices.

  • Start the comprehensive analysis on the return you can get from the investment of Facebook ads. Then, optimize and adjust your advertising strategies accordingly for the better conversion rate.
  • Track your customer actions to know whether they have clicked on the product links, added the products to the online carts and placed the orders, etc.
  • Build the custom audiences with multiple groups, and then, deliver different advertisements to them bearing the ultimate interests.

Create the Facebook Pixel

Here, we need to mention that the Facebook pixel actually is in the form of the JavaScript code that you can use throughout your website for taking some actions.

To create one, you firstly should log into the Ads Manager page using your Facebook account. In the navigation menu, you can find the Tools tab. Now, you need to click it and hit the Pixel button from its drop-down list, and then, press the Create a Pixel button.

Create Pixel

Now, you can find a popup window that requires you to name the pixel that can represent your business perfectly. Note that you can only create one pixel for each ad account and do not forget to tick the checkbox to accept the terms.

A few seconds later, your Facebook pixel can be generated properly. You can install it to your site promptly or email the code for the further utilization.

Install Pixel Now

Add Facebook Pixel to WordPress with Standard Event Track

Now, you can start adding the Facebook pixel to your WordPress site by copying and pasting the pixel code into your website HTML. Note that you can do this manually or automatically.

Add Facebook Pixel Manually

For this practice, you simply need to edit the header.php file of your WordPress theme, and then, paste the code before the close tag.

In addition, if you want to add some events for tracking some specific actions, you also need to enter the corresponding event code. Note that Facebook pixel allows you to add 9 actions currently, such as Search, Add Payment Information, Add to Wishlist, Add to Cart and many others. The detailed event code can be found at where you copy the pixel code.

Check the below diagram to learn how to paste the required code with the proper format.

Facebook Pixel Code

Add Facebook Pixel Using the Plugin

If you feel difficult to add the code manually, you can choose to leverage the Pixel Your Site plugin, with which you can insert the Facebook pixel and add some events based on your needs easily.

Here, you simply need to click the Pixel Your Site button from your WordPress admin, then, enter your Facebook pixel ID, check the box to enable the pixel function and click the Save Settings button. Now, you have successfully added the Facebook pixel on all the pages of your site.

Add Pixel ID

Note that your pixel ID can be found on your Facebook Ad Manager dashboard.

Pixel ID

In addition to the Facebook pixel, you can also add the events for more specific tracking. Note that this plugin allows you to add the standard 9 events offered by Facebook along with some custom events based on your needs.

For this, you simply need to click the Post/Page Events button from the settings page of this plugin. Here, you should firstly add the URL of a webpage where you want to add an event and to track the actions. After that, you should choose the event type from the list, and enter the product value, currency, content name and category.

Note that you do not need to fill all of these fields but also some aspects you need. In addition, you can add multiple events on a single webpage by clicking the Add More Event button.

Add Event

Now, you can check the box at the bottom to activate the event setup and save the settings.

Test the Facebook Pixel for Your WordPress Site

In fact, you have already added this special Facebook tool to your WordPress site. To test whether it works properly, you can leverage the Pixel Helper extension offered by the Google Chrome. Check how it will report you the actions taken by online visitors from the below screenshot.

Pixel Helper Extension

Add and Track Custom Conversion using Facebook Pixel

By default, Facebook pixel allows you to track 9 valuable actions people will take on your site, thus, you can better optimize your ads for these actions. However, if what you want to track is not within the available 9 options, you need to create the custom conversions.

For this, you should go to the dashboard of your Facebook pixel and click the Create Conversion button. Here, you have two options in the popup window – Standard Events and Custom Conversions. You need to choose the second one.

Track Custom Conversion

Next, you should enter the page URL that you want to track the event. Here, you can choose to enter the exact URL or the URL keywords that all your target pages have. In addition, you need to choose the conversion category that can describe the event you want to track the most.

Custom Conversion URL

Now, you can give a name to this custom conversion, add the description if you want and enter the value if needed.

Custom Conversion Details

Upon the successful creation, you can click the Tools button from the Ad Manager page and hit the Custom Conversions button to check the tracking result.

Custom Conversion Tracking Results

Here, you need to know that the maximum number of custom conversions you can create is only 20.

Add Custom Audiences using Facebook Pixel

In addition to the custom conversions, you can also create the custom audiences to track. To do this, you should click the Create Audience button from the Facebook pixel page. Here, you need to choose who can be your target audience, decide how long they will be remained as your audience and enter the audience name.

Add Custom Audiences

To check the tracking results of your custom audiences, you can click the Tools > Audience from the Facebook Ads page.

Custom Audience Tracking Results

Create Ads Based on Track Results of Facebook Pixel

Now, you can get an in-depth tracking result of how Facebook ads perform on your WordPress sites by utilizing Facebook pixel. Therefore, you can start optimizing your advertising strategy accordingly.

Facebook Pixel Dashboard

Even, you can create ads based on your custom conversions and audiences. In this case, the Facebook ads can be effectively delivered to your target readers who are much more likely to take your wanted actions.

To do this, you need to choose the below showcased option in the Facebook Ad Manager page. Here, you are required to enter the domain of your promoted website. After that, you can choose your created custom conversions from the drop-down list.

Create Conversion Ads

After targeting the right custom conversion, you can finish the detailed information of your ads. The only requirement is that when defining the ads audience, you’d better choose your custom audience by clicking the Browse button.

Choose Custom Audience
After finishing all the steps for the creation of Facebook ads, you can display the advertising information totally based on your needs for the increased conversion rate.