How to install the new Facebook Pixel with Google Tag Manager for Conversion Tracking
Articles Blog

How to install the new Facebook Pixel with Google Tag Manager for Conversion Tracking

Hi there and welcome to another video of
– Where we teach you the data-driven way of digital marketing. My name is Julian and Today
I am going to show you how you can utilise the new Facebook pixel to build a retargeting
audience or track a conversion on your website. I show you how you can implement this retargeting
tag via Google Tag Manager and get the most out of this tracking pixel. Lets dive in! Facebook announced a while ago that they will
be changing their custom audience and conversion tracking pixel over to a new pixel that will
encapsulate both which will be called the Facebook Pixel. The major difference is that you only need
one pixel or one line of code which you then customise in order to build a custom audience
or track a conversion on your website. Now how does this pixel look like. If you go into your ad manager of your Facebook
campaigns you can go on the tools and here you will find the pixels and the tab and the
Facebook pixel and also the conversion tracking pixel which will soon go away. Therefore it
is recommended to use the Facebook pixel here. We can go on the Actions and click on view
the pixel code. Here you can see the new Facebook pixel code
which consists of a base-code which you can see here and you can go ahead and copy this. Now the new thing about this code is that
it actually has custom events which you can customise the code with. And these are shown down here – View content
search,add to cart and so on. But there is already a default – track page
view option. So if you deploy this kind of Facebook code
than every page view will be recorded which we actually want for our custom audience to
build – so all we need to do is copy this base code – and go over to our google tag
manager -and create a new tag. Then enter a name – my naming convention
is usually the tool and then the purpose of the tag which is an audience pixel and where
it will be deployed. An identifier to later recognise the Facebook account itself which
is obviously made up here but will be important if different accounts connected to this one
google tag manager account. Now we will go ahead and go with Custom HTML
tag as there is no tag template for the Facebook Pixel at the moment. Here we can enter our tag which we copied
over from our Facebook account. Now there is no real modification that we
need to do on this particular tag to build a retargeting audience – we just go with
continue and choose the all pages trigger already built in Click Create Tag and go into the preview and
debug mode.It should put our browser in a certain state in our page itself which is
in our case the demo – we will see a preview in the debug console. This console will tell you which tags have
just fired. In our case this Facebook tag just fired and
it also fired in all the pages where we google tag manager installed and in the next page
we see that the Facebook tag has fired Now we can go ahead and publish this to all
our users ass a conversion. A bit of quality control can be done with the Facebook Pixel
Tracker plugin from the Chrome store. Now the tag is deployed on all the pages and
we can go ahead and actually built a custom audience through this tag . This is all implemented – we could segment
it down to specific pages or a specific amount of time the user was on our website and this
was made possible by this simple implementation by our Facebook pixel. So far nothing new- what about the other options
we have here to customise the pixel and track custom events into Facebook directly Now if we look at all these different interactions
=viewed content/search or add to cart – these are very specific to the website. One that
is very important which is replaced by this new pixel is the purchase event. The purchase event – once you fire this
– replaces our conversion tracking pixel which you had before. All you have to do is
take our event code here. Copy this and will go back to Tag Manager and what we can do
is go into our Facebook audience pixel and copy it right here. Then we still need to
change the name so it will still be a Facebook pixel but this time its a conversion tracking
pixel. And it will fire upon a transaction. And now we just implement our custom action
here behind the last action we had with the track page view just add a line here and paste
our code. Now when this code executes it will track a page view which is normal . It will
also track a purchase with the value 00 and the currency Euros. Now we obviously want to customise this and
the best way to customise this is with variables. Now we already have built in variables which
we have here which I have available and pulls directly from the Data layer. Now if you want
to know how to set this up you can refer to our old Conversion Tracking Video with GTM
where I will show you how to set this transaction Total Variable. Now its safe to say since
this is in our system we can use it in our tag – all we have to do is replace the 00
with curly brackets and our name of our variable which is in our case the transaction total.
This currency will change according to our store- we don’t have multiple currency in
our case its dollars. We go with dollars and we are all set. Now
the next step we don’t want to fire this obviously in all the pages – only our transaction
page – and i have already made up a trigger with a custom event called transaction which
you can also see in the old conversion tracking video how i set this up. Now lets save this and create the tag. Go
into preview and debug mode – back to our page – this time we obviously need to go
through a transaction so I will add something to my card – view this cart. And place the order. We get to our transaction
page and we see here that our Facebook transaction conversion pixel has fired. we can also check
that up in our pixel helper where we can see both have fired and what values have transferred
to this pixel. We see the values 23 and the currency is USD as we have it right here in
our page. So what we can do is actually then go ahead and publish this as a version to
all our users. Now as you saw and maybe before in the pixel
code – we have other events you can fire such as add to cart/wishlist and search which
are all custom actions you can define in Tag manager and fire this modified tag so you
get this data available in your Facebook advertising campaigns and this data is actually very powerful.
Because you can now optimise your campaigns towards one or the other goals. And check
how many of the people who came through your Facebook ads converted into a purchase or
add to cart or search. The new Facebook pixel gives us great flexibility
in deploying only one code basis for all our different events that we may want to track
directly in Facebook. Now if you want to get a hold of all the different
tags that I just put into place in Google Tag Manager we have bundled them into a Tag
Template which you can download at and simply upload those
to your account.

53 thoughts on “How to install the new Facebook Pixel with Google Tag Manager for Conversion Tracking

  1. Why do you add the purchase code below the pageview-code in the pixel when you already have a pageview-pixel running on all pages?

    Wouldn't this one send the pageview with the transaction, so that you only need to fire the purchase in the second tag? (and also might get dual pageview tracking of the confirmation page)

    Also: If my site contains different types of leads, how will facebook count conversions in my campigns? Do i need to change the code to separate the three types of leads or can i use lead on all of them?

  2. i have the GTM tag firing with fb pixel, however, fb pixel helper chrome extension isn't showing any activity. Any idea why?

  3. You don't need to rewrite the whole code to enter the individual tracking codes 😉 Just tested it and it works 🙂 Nice videos though. Thank you for those… 🙂

  4. Is there any issue with both FB pixels firing with Page Views in them? Is there no chance it will send two page views? I know it's not critical, but still curious.

  5. Good morning,

    First of all, I really appreciate the fact that you shared this valuable information :).

    But I have a problem, I got only one Facebook pixel and it is tracking everything fine on one of my website.

    I want to create another website and I want to track things separately for the two sites


    How will that go ?

    I mean can a person get a separate pixel for each website? or Can one pixel do tracking for several websites ? If one pixel can do tracking for all business websites owned by a business or a person, how will the separation of visitors and purchasers for both the websites be achieved ?

    Can you Kindly answer these questions clearly ? I will be grateful!

  6. Great video, very useful! Was wondering what you would need to enter to as a trigger to fire on add to cart on WP e.g. instead of the "gtm4wp.orderCompleted" trigger for the transaction (I'm using all the same plugins etc). Thanks in advanced!

  7. Hi man, great explanation! everything seems fine, but when I open the console I have an error that says "Facebook pixel error: duplicate pixel ID" do you have the same message? Thanks!

  8. Hi, thanks for this great video. Is there any way we can get conversion value for FB on purchases similar to adwords?

  9. great video… Very helpful. the one thing I've been curious about is in both the Facebook pixel firing and the conversion firing pixel you include the page view code. wouldn't that make Facebook believe they were more page views then what they're actually were?

  10. Can you please have a look at my ad and let me know what am I doing wrong. here is the link

  11. Wouldn't this fire two (2) Pageview events in FB Pixel because you already have the Pageview code firing for all pages and then you have another event firing when a purchase is made.

  12. Awesome stuff. As a freelance marketing guy, this really save me (and my clients) some valuable time! Thanks for sharing!

  13. Great video, thank you! I don't see the "Ad conversion tracking" options when I view the code. We installed the new pixel via GTM, created Custom conversions in FB, but see much higher conversions in the Facebook reporting than the Google Analytics reports indicate. ( 668 in fb, 12 in GA). So my question is…How is this different from creating "Custom conversions" through the Facebook interface? And how I can we double check if the install is correct? Thanks so much in advance

  14. Thanks for the video. It was helpful. I have setup the Purchase and View Content event as a tag in GTM. When I go to Ads Manager > Pixels I see an overview of the events being fired. How do I see the breakdown of those events i.e. which event got fired from which page?

  15. Hi. I can't get the purchase data to pull into my Ads Manager dashboard. The FB pixel helper is showing the correct data and the data layer is set up exactly the same as yours. UA ecommerce tracking is working correctly as well and is firing on the same triggers. I can't seem to figure it out and FB is no help at all.

  16. Thanks for the informative video, Julian! It was very helpful.
    I notice that Google Tag Manager has history triggers. How would these work with the Facebook Pixel? Say, you only want the pixel to fire if the oldHistoryState was a specific value. Is this even possible?

  17. Would you mind posting the link to the video that shows how to set up the transactionTotal variable in GTM? Thank you! And great video.

  18. Thank you for this video, it's fantastic! Question – do we need to set up a Facebook tag in GTM for each goal e.g. transaction, if we have goals set up in google analytics, which can tell us how our campaigns are doing in regards to conversions for each goal anyway?

  19. Thank you for this video
    one question: after adding the events code to the tag manager, will I be able to see the conversions on the FB business manager?

  20. Great video as usual. However, I am worried that you will be double counting pageviews since you're firing it multiple times.
    1- on all pages
    2- on a purchase (you included the pageview event again)
    Let me know your thoughts.

  21. Hello Measure School,

    We have a wordpress website where donations are accepted, I want to track the donation values via FB code, but the problem is that its not set up using woocommerce, a donation plugin is used. How do I get the values on datalayer here? Please help!

  22. I dont think this is setup correctly. pixel base code should fire first /trigger all pages. then secondary tags for conversions , specific triggers.

  23. This is a great video. One thing I am unclear on is when I have conversion URL or event tracking, and using a CMS. Can I put the pixel code, containing event code in one place on (between head tags)? Because I am using a CMS, I don't need to worry about placing event/conversion code on a particular page, is this correct?

  24. Thanks for the video, i have two questions to ask about facebook pixel, Can i use the same pixel for multiple websites or its one pixel per website and the other what is the benefit of using a tag manager ??

  25. Terrific video! I've a question. So I've the Pixel in the header code injection in Squarespace and integrated Pixel with Tag Manager. With the 'Download app' button on my site, how would I go abt tracking that with Pixel and Tag Manager?

  26. Question on the custom events:

    Facebook says that each custom event has to be entered as a different tag. In your video, you implement the events within the base code.

    Is this because this video was from 2016?

  27. @measureschool , great video amazing content . what will be the best option to track 5 different goals for our Facebook marketing . all this 5 are applications that has 5 different outcomes. please some help. thanks

  28. Is it possible to configure the Facebook pixel code in the header of all my pages, and then in Google Tag Manager just call the Event Code fbq('track', View/Search/Lead/Purchase…) rather than having the pixel code block in every Tag?

  29. Duuude i've been watching so many of your videos, i cannot thank you enough for sharing all this knowledge, I'm taking Adwords, Analytics and GTA certificates, I already have my first client and i'm hooked on learning from your videos, thank you so much I appreciate you!

  30. i have a native iOS application and want to implement a Facebook pixel inside it using GTM.
    there is no HTML custom tag for apps, so… help?

  31. Hi Julian, thank for your great tutorials! I'm only a bit confused about one thing – in your previous videos you start by creating individual tags for add to cart, purchase page etc in GTM. In this video above you suggest to make another tags for Facebook on the same pages. Would this cause dublication of the results – double events on a particular page?

  32. watch the updated way to install the Facebook Tracking Pixel with GTM here

  33. Thx so much for sharing. And I dont understand why you guy dont delete the FB PageViews codes when you set up the conversion(Order) event srcipt?

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top