How To Use The Facebook Pixel Code

Knowing if your Facebook advertising is converting is extremely important. But understanding how to track those conversions requires some reading time and putting the website code in the proper places.

The Facebook Pixel code plus event tags are how you track your conversions and they are powerful tools to measure your results. You’ll need to create the Pixel code if you haven’t already.

In either the Ads Manager or the Power Editor go to the Tools pull down menu and select “Pixels.” Then select “Create Pixel Code.” You can then select to email the code to your developer or view it so you can install it immediately.

You’ll want to put this code on every page of your website or at least on all pages that will be part of conversions tracking for types of conversions you may conduct in the future such as website clicks, opt-ins, items in a shopping cart, purchases, etc.

Now here is where it gets a little confusing.  Let’s say you put the code on every page of your website and chose the ad campaign to track website clicks for a goal. Every Facebook ad that sent someone to your website would be tallied as a conversion.

It’s great to get website traffic but unless you only want people to view your content you need more refined tracking. That’s where the conversion tracking code comes in.

On the page that has your pixel code you’ll see the name of the events and the event codes. There is a decent number of them to work with including conditional tracking under the custom ones.

For each specific conversion you want to track use the appropriate event tag. Here’s an example.  I want to tally a conversion for someone who added a product to a shopping cart.  See the event tag below.

add to cart event tag

You’ll want to put this tag inside the Pixel code.  Here is a screenshot from the Facebook instructional page.  1 below is your site code. 2 is your Pixel code.  3 is the event code.

event tag code

You can see it goes above the Pixel code script tag. Do this for every page you want to track with this event tag. Notate the Event code in a document as this objective is what you will need to know when creating reports.  More on that in a minute.

If you want to use URLs that appear after a site visitor takes an action you can use custom conversions.

They are quite a bit easier to set up.  You just need to make sure your URLs utilize the behavior you are trying to track. Custom conversions are in the same Tools menu pull down under the pixel code link.

You can create some pretty powerful rules here. Notice how I can keep adding URL rules.custom-conversionsjpg

You’ll then choose a category for your conversion.

categories custom conversions


Now when setting up the campaign in the Power Editor, choose “website conversion.”

website conversion tracking


Then set up your campaign, ad group and ads as you normally would. With a conservative ad spend you can not only test your campaign but also see if your conversion code is tracking properly.

Once your campaign has been running for a day or so you can go see if it is tracking. Go to the Ads manager, select your campaign and then click on the Performance pull down menu.  Then select “customize columns…” and choose the objective that matches the event tag you placed in the Pixel code on specific pages.


In the above example it would be “Add to Cart.”

add to cart

Now your objective will tally in the reports you generate. As you can see you can track a wide variety of objectives with this process. Test and adjust and test and adjust until your campaigns are dialed in for performance!

Good luck and if you need help with social advertising, Google Ad Words or an analysis of your total internet presence, give me a shout and I’ll be glad to help. I specialize in creating reports of a company’s full internet presence and people love these reports.

Just use the form on the contact page and I’ll get back to you pronto.  Happy advertising!




Recommended Posts