Maximize your Facebook ads using a pixel

February 28, 2017

If you plan on advertising on Facebook and want to track website visits then it is imperative that you install the Facebook pixel. In this blog post, we’ll show you how to set it up and how to add some custom parameters for more advanced tracking.

Create your Pixel

  1. Go to the ads manager by clicking ‘Create Ad’

  1. Close the ‘Create Ad’ by clicking ‘CLOSE’

  1. Select ‘Pixel’

  1. Select ‘Create a Pixel’

  1. Create a name for your pixel. You can only have ONE pixel per Facebook account (NOT per Facebook page) so make sure you’re using the Facebook account you want to use to run all the ads for your business
  2. Accept the terms and create the pixel

Install your Pixel Base Code

  1. Choose your type of Pixel
  2. Choose ‘copy and paste the code for tracking website activity’, which is what we’ll be covering today
  3. Go to your website, and if you have WordPress we suggest you install the plugin ‘Tracking Code Manager’ if you do not have a WordPress website, or do not want to use the plugin, locate the header code. The location of the header code will be different with different website user interfaces. For WordPress, you would go to Appearance > Editor then locate the index file.
  4. For WordPress users

    1. Install the Tracking Code Manager plugin
    2. Go to ‘Settings’ and select ‘Tracking Code Manager’
    3. Select ‘Add New Script’ or ‘New’
    4. Copy the Facebook pixel code and paste it into the box
    5. Leave default options
    6. For ‘where do you want this code?’ select ‘standard code tracking’
    7. For ‘which page do you want to insert this code’ select ‘in the whole website’
    8. Do NOT exclude any pages and click ‘save’
  5. For Other Website Interfaces

    1. Go to your header code for the whole website, which will have the tags <head></head>
    2. Copy and paste the pixel code right before the </head> tag
    3. You can also visit Facebook’s Guide for Installing Pixel’s Using Specific Third-Party Platforms to see where to paste your Pixel code.
    4. Save your settings

Customize the Pixel

The base pixel code ONLY tracks page views. If you want to track other events such as specific page actions, how many people add items to their shopping cart, etc. you will need to install specific event codes. Event codes must be added ONLY to the relevant pages. All the available events codes are as follows:

As an example, to add an ‘Add to Shopping Cart’ event you would do the following:

For Wordpress websites using the Tracking Code Manager plugin

  1. Go to your website and set things up so that everytime someone adds an item to their shopping cart they are brought to a page that confirms the item was added. This means there is a unique page that people will ONLY see if they add an item to their shopping cart. We would not want to use the shopping cart page because this would also track times when people view an empty shopping cart, and we only want times people actually add items to their shopping cart.
  2. Select the event code you want to use and copy it, in this case, the ‘add to shopping cart’ code
  3. Go to ‘Settings’ and select ‘Tracking Code Manager’
  4. Select ‘Add New Tracking Code’
  5. Copy and paste your event code ONLY. Not the entire pixel code. Your code will look like this:

  1. for ‘position inside the code’ select ‘AFTER BODY’
  2. Leave show on all devices selected
  3. For ‘where do you want this code?’ select ‘standard code tracking’
  4. For ‘in which page do you want to insert this code’ select specific pages or posts
  5. click the checkbox for ‘include posts page’
  6. Select the shopping cart confirmation page you created and ONLY that page. So delete the option that says ‘ALL’
  7. Save

For other websites

  1. Go to the ‘Pixel’ page
  2. Click ‘Actions’ and then ‘View Code’
  3. Copy your Pixel base code and paste it into a word processor
  4. Add the ‘add to shopping cart’ event code right before </script>. Your code will look like this:

  1. Go to your website and set things up so that everytime someone adds an item to their shopping cart they are brought to a page that confirms the item was added. This means there is a unique page that people will ONLY see if they add an item to their shopping cart. We would not want to use the shopping cart page because this would also track times when people view an empty shopping cart, and we only want times people actually add items to their shopping cart.
  2. Copy your code and paste it into the header, marked by tags <head></head> for the specific shopping cart confirmation page you create. You can also visit Facebook’s Guide for Installing Pixel’s Using Specific Third-Party Platforms to see where to paste your Pixel code.
  3. Save your changes

Confirm the Pixel is Active

  1. Download the Pixel Helper
  2. Go to the pages on your website where the pixel is installed and the helper will let you know if the pixel on that page is active and working

That’s all! Now you have a fully functional and customizable Facebook pixel to help you analyze your marketing on Facebook.