Search
Close this search box.
Search
Close this search box.

How to Install the Facebook Pixel in WordPress

To utilize Facebook’s powerful advertising capabilities and especially the remarketing/retargeting campaigns, you first need to install Facebook’s pixel code on your Website.

What is a Facebook Pixel?

A ‘pixel’ is just a piece of javascript code that gives Facebook the ability to track visits to your website and associate these with actions (web page visits, conversions etc.) and Facebook accounts.

When you install the Facebook Pixel to your website, you will be able to measure conversions, build custom audiences and optimize your Facebook ad campaigns.

In simple terms, the pixel will give you a lot of metrics and data related to visitors coming to your website from Facebook.

Without installing the Pixel, you won’t be able to measure the effectiveness and profitability of your Facebook campaigns.

Step 1: Create a New Pixel

  1. Go to Events Manager.
  2. Click the green check button to Connect a New Data Source. Then select your data source (usually web).
  3. Add your pixel name.
  4. Enter your website URL to check for easy setup options.
  5. Click Continue.
  6. Don’t check wordpress and click next.
  7. Leave conversions api checked.
  8.  

STEP 2: Install Facebook Pixel Code in WordPress

  1. Install and activate the AddFunc Head & Footer Code from the WordPress Repository (it’s free). This will allow you to easily add the script to the website header.
  2. Under Settings (WordPress Left Menu), find and click HEAD & FOOTER CODE.
  3. Just COPY/PASTE the Pixel code provided by Facebook in the “SITE-WIDE HEAD CODE” section and click the SAVE CHANGES button.

STEP 3: Check that the Facebook Pixel is installed correctly

Before proceeding with the next steps, we need to check and ensure that the Facebook Pixel is installed and working ok.

The easiest way to do this is to use the Facebook Pixel Helper. The Pixel helper is a free extension provided by Facebook but works only on Chrome Browsers.

After you install the Pixel Helper you will notice a small icon in your browser address bar.

Navigate to a page of your website (that the pixel is installed) and click that icon.

If everything is ok, you should see something similar to the screenshot below with the message ‘Pixel loaded successfully’.

STEP 4: Verify your domain

You can either upload an HTML file on your server or add this in your functions.php:

add_action('wp_head', 'add_meta_tag');

function add_meta_tag() {
    echo '<meta name="facebook-domain-verification" content="76gnnlq0nswxi9rjch96aiddeq3n6i" />';
}

STEP 5: Add complete order conversion

  1. Go to your Go to your Pixels tab in Events Manager
  2. Click Create Custom Conversion
  3. select URL CONTAINS and add “/checkout/order-received/” in the URL. This will create a custom conversion to track purchases made from your woocommerce website.
  4. When you are done, click NEXT and give a name (eg. WooCommerce purchases) to your Custom Conversion and click CREATE.