#AskAyima: How to Implement The Facebook Pixel

We recently ran a series of social competitions enabling you guys to tell us what you would ask Google about Paid Social. One of the most repeated questions was “how can I implement my Facebook pixel?” Well, we’re here to give you all the information you need to implement yours successfully.

As we all know, one of the major benefits of Facebook advertising is the ability to deliver highly targeted ads to users who are most likely to take a desired action. The Facebook pixel is an important contributor in this and allows you to track the performance of every ad you serve based on actions taken on your website, such as reading an article, purchasing an item or registering for your event. You can then break this data down even further by demographics, placement, device etc.

Great, right? Well, to get to this point you need to first  install your pixel and check that it’s firing correctly before running any campaigns. This step is vital to understand where your investment is getting a return and doing so will help when investing in actions that are important to your objectives as a business.

Every ad account comes with a default pixel which has two parts: the base code and the event code. While the ‘base code’ is placed on every page on your website and tracks all traffic to the site, event codes can be applied to particular pages on a website in order to track specific actions taken on that page.

Below is a four-step guide to creating, implementing and checking your Facebook pixel before you start your advertising journey.

Step #1: Create a Facebook pixel

#AskAyima: How to Implement The Facebook Pixel

Click on the Menu button in the top left-hand corner and head to the ‘Pixels’ tab under Measure & Report. If you don’t already have a pixel set up, you will be presented with the following page asking to create a pixel. All you need to do here is add a pixel name!

#AskAyima: How to Implement The Facebook Pixel

#AskAyima: How to Implement The Facebook Pixel

Step #2: Add Base Pixel code

As mentioned, there are two parts to the pixel code; the first is the Base Code (pictured blow).

#AskAyima: How to Implement The Facebook Pixel

The Base pixel is a snippet of code that must be installed onto all your website pages to send activity from the site back to Facebook and allow you to start tracking page views. The platform provides three options for doing this depending on how you usually make changes to your website’s code:

  1. You use an integration or tag manager
  2. You edit the code yourself
  3. Someone else edits the code for you

#AskAyima: How to Implement The Facebook Pixel

Integration or Tag Manager

If you use a third-party to manage your website, Facebook currently provides a choice out of nine supported partners. You also have the option of requesting a new partner if you prefer another. The benefit of having a site that uses a tag manager or is hosted on a popular website platform is that you can set up your pixel without having to manually edit the website code.

#AskAyima: How to Implement The Facebook Pixel

How you install the code will depend on which of the above options you take. For example, if you use Google Tag Manager, you will be given the option to either do a Quick Install (using the FB interface) or a Manual Install (using the GTM interface). The former lets you select your GTM account and publish tags to the appropriate container, with the base pixel tag added by default. The latter allows you to copy and paste the base code into a Custom HTML tag within the GTM platform.

Alternatively, if your website is hosted on one of the website platforms above, you may be directed to the site manager/dashboard or required to download a plugin file to upload onto the interface. Facebook provides step-by-step instructions for whichever partner you choose.

Manually install the code yourself

If you normally make changes to the website code yourself, you can go with the second option mentioned above. This involves manually adding the base code to the global header of your website so that it loads on every web page.

Firstly, find the header code for your website or look for the header template in your CMS or web platform. This code/template may be found in different places depending on the web management system you use.

#AskAyima: How to Implement The Facebook Pixel

Once you have located the <head> </head> tags within the website code (pictured above), insert the base code at the bottom of this section, just above the </head> tag. If you have other tracking tags here also (e.g. GA), the Facebook code can go either above or below it, as long as it comes before the </head> tag.

Email instructions to a developer

Alternatively, if you aren’t comfortable with the coding aspect, you can send the installation instructions to a trusted friend or a developer who can set it up for you.

Advanced Matching

Another thing you may have noticed when setting up the base pixel is the option to select ‘Advanced Matching’. This feature enables you to send even more data from your website, such as a phone number or email, and thus improve the ability to match users visiting the site to those users on Facebook. This feature is particularly useful for ecommerce websites where there is usually more information about the visitors than other websites.

Check status of pixel

Whichever option you choose above, it’s always a good idea to check that the pixel has been installed correctly before moving on and adding more specific event tracking. If your base pixel isn’t firing properly, the rest of your tracking won’t work. To check this, head back to the Pixels tab and check that the pixel status is active. It can sometimes take up to 20 minutes for this to be updated, but if it says ‘No activity yet’, the code may not have been installed properly.

Step #3: Add Standard Events

Congrats! You’re now tracking all page visits to your site. However, the attraction of Facebook advertising is that you can create highly tailored ads in relation to specific pages a user has visited or a certain action that has been taken. For this, Facebook provides nine standard events for tracking different actions in the consumer’s journey.

Depending on your business and advertising goals, you can use as little or as many of these as you need to track a user’s journey on your site; it’s all about the actions that are important to you. The main events that Facebook provides are as follows:

#AskAyima: How to Implement The Facebook Pixel

Facebook has also recently added ‘custom events’ to the list, which allows the advertiser to set up their own customised event if the other standard events are not quite suitable or are already in use within the account.

When setting up standard events, you will be given the option between ‘basic, recommended and advanced’. When using the default recommended settings, parameters are included within the code which lets you add terms or conversion values for further tracking.

For example, if you have an eCommerce site and you’ve placed the ‘purchase’ event code to fire on an ‘order complete’ page when someone finishes their checkout, the following will occur:

  • The ‘basic’ code will simply tell you how many times this page has fired (the number of orders).
  • The ‘recommended’ code includes an extra line which tracks the value of that purchase (how much the user has bought with that order).
  • The ‘advanced’ code allows yet another layer of data to track more specific things (when someone purchases a specific product or specific style from your site).

If you are manually placing the event code yourself, there are two options:

  • Track event on Page Load: When a user is taken to a new page/URL after completing an action. For example, making a purchase and being taken to an ‘order confirmation’ page.
  • Track event on In-line Action: When a user performs an action but is not taken to a separate page/URL (dynamic page elements). For example, clicking on the ‘Add to Cart’ button may not open another page, but they have still completed the action by clicking.

#AskAyima: How to Implement The Facebook Pixel

Once you have placed the base code, you will be given the list of events and prompted to select the ones you would like to use and choose how you’d like to track them. For example, with the purchase pixel, you may opt for ‘page loads’ and include the value of the order within the parameters. This additional line fbq(‘track’, ‘Purchase’, (value: ‘0.00’, currency: ‘GBP’)); should go after the </head> tag of the base code.

#AskAyima: How to Implement The Facebook Pixel

For ‘Add to Basket’ you may go for ‘in-line action’ and similarly track the value of the order being added to basket. This additional line should be added to the HTML element for the Add to Basket button as shown in the image.

If you’re using a tag manager such as GTM, you can create a tag and copy and paste the standard event code e.g. fbq(‘track’, ‘CompleteRegistration’); underneath the fbq(‘track’, ‘PageView’); line of the base code. You can then link up the tags to specific triggers which fire when certain URLs are loaded (e.g. /thank-you).

Step #4: Check tracking is working

As with the base code, it’s important to check that everything is firing where it is supposed to. The best way to do this is to download the Facebook Pixel Helper extension for Chrome. Once downloaded, you can go to the various pages on your site (or test some desired actions) and the extension window will show you exactly which pixels are firing on the page as well as any errors, if any.

#AskAyima: How to Implement The Facebook Pixel

The Pixels tab also displays all pixel activity within the account, but there can be a delay in the event data being updated. However, this is a useful way to check that all pixels are firing and the URLs of the pages that the events occurred.

#AskAyima: How to Implement The Facebook Pixel

Once you have confirmed that your pixel and standard events are tracking correctly, you are ready to go! You should now be able to collect and analyse the performance of your ads within reporting. Facebook also provides options for further segmentation of this data by time, delivery and action which can provide useful insights into your target audience and those users most likely to convert.

Remember, even if you haven’t laid down your advertising plans yet or you’re not sure of the best strategy for your campaign, install the Facebook base pixel anyway so you are tracking from the start. That way when you do come around to serving your ads, you will have valuable information on how users are interacting with your website as well as an audience of engaged users that you can start retargeting right away.

Facebook is primarily a people-based marketing tool, so utilising their pixel will ensure you get the most of the platform and actively reach those users who may be interested in what your business has to offer.

Have a paid media question you want to #AskAyima?

Send us your question in the box below and we’ll get the answer onto our site soon!

[contact-form-7 id=”6587″ title=”Ask Ayima”]