March 28, 2020
🔴 Facebook Pixel Tracking with Google Tag Manager (2018)

🔴 Facebook Pixel Tracking with Google Tag Manager (2018)

In this video, we’re gonna talk about how
to install the Facebook Pixel with the help of Google Tag Manager. All and more, coming up. Hey there and welcome back to another video of teaching
you the data-driven way of digital marketing. My name is Julian. We are live right now talking to you about the Facebook Pixel on how to install with the help of Google Tag
Manager. And before we get started with this training,
why would you install the Facebook Pixel? If you want to do any kind of Facebook advertising and you want to take a capability of retargeting your users on
Facebook, so somebody who visits your website and does something on your website, and then
you want to reach it and use it again on Facebook, so you can drive them back to your website,
then you want to install the Facebook Pixel. It’s also very good to install the Facebook
Pixel because you want to have conversion tracking on your ads. That means did the user, in the end, take
the action that you want him to take on your website which could be a purchase, a sign-up
to something or a click of a button. And that is something we can all track with
the Facebook Pixel and especially with Google Tag Manager makes it a whole lot easier. So the Facebook Pixel is really a standard
tracking pixel nowadays for Facebook advertising. But you also have the capability when you
install the Facebook Pixel correctly to utilize Facebook analytics. Nowadays, Facebook analytics is something
that was born out of Facebook ads and the pixel that was installed anyways already,
and you can get more statistics on your website and the user behavior on your website. And there are a lot of different functionalities
within Facebook analytics, which we won’t get into today. Because we really want to take care of the
measurement part of installing Facebook Pixel today with the help of Google Tag Manager. Now, this is an updated version of a video
that we did before because there’s always something changing. And I wanted to give you always the best practice
tracking is an art. So you can always do things in different ways. And we have done them in different past videos
differently. But this is how I would install the Facebook
Pixel nowadays with the help of Google Tag Manager. So let’s dive into today’s training. Without further ado, here’s our Google Tag
Manager account. I have Google Tag Manager installed on our
demo shop here. As you can see, with the preview and debug
mode open. And now we want to install the Facebook Pixel. Now, the first thing is you need to get the
tracking code for the Facebook Pixel. Here in our Google Ads account, you can go up here and
find your pixel settings on all tools, you have your event manager, and then here your
pixel settings. And depending on which pixels you have installed,
this has the measureschool pixel, I actually want to take the one from my other ad account for testing, you would build a new Facebook
Pixel. Now you can only have one Facebook Pixel per
account. But once you have it already installed, you
will see that here and you can go to details. And in the details, you have the setup functionality. Now there are different ways to install the
Facebook Pixel. The first thing is through plugins. And there are different plugins available
and different methods available. What they also tell you is here, the Google
Tag Manager plugin. If we go on this option, what this will actually
do is upload a container tag template into your Google Tag Manager account. Would I recommend this? Definitely not, I think that Google Tag Manager
gives us great control. And therefore we should install it ourselves. And I would also differ from the default installation
of the Facebook Pixel with this upload functionality. And it really gives you a black box here,
what is this thing doing it’s just uploading into your account, and then publishing, which
could be a security risk. So if you are building a bigger account in
a bigger company, then you definitely want to go with the manual installation, which
I’m going to show you today. So not something that is recommended from
my side to do this via this automatic upload functionality. So I’m going to go with the manual installation
of the tracking code itself. So here we get a bit of an instruction, we
need to install this in the head section of our code, you have Google Tag Manager installed. So you can do this through Google Tag Manager,
and it will automatically place it inside of your website, and then fired as early as
possible. So you don’t really have to care about the
placing of the code, you will just place it in Google Tag Manager. And then we get to our code portion. Now, I want to talk about this really briefly,
because I get a lot of questions about why are we splitting the codes up, which we’ll
do in a second inside of Google Tag Manager, just gonna copy this. So I’m going to click on this and then go
to my Google Tag Manager account and go to new tag. So we want to add a new tag. And since there is no tag template available here, when they’re going to do this depends on Facebook,
if they are actually submitting this to the open program that Google tag manager has. But for now, we’re stuck with the custom HTML
version. So here’s where you can place a custom HTML. And I’m going to paste the code in here. Now, I want to talk a little bit about this
code. This code actually does two things, it loads
the library and then it sends a request to that library saying, Okay, please track a
certain event. And in this case here, in the standard tracking
code, we see, first of all, the script portion, then we see a no script portion. Now, inside of the Facebook Pixel, if you
would place it on your page itself, you would place this whole code on there. Now, the script portion is actually for browsers
that have JavaScript enabled. And no script portion is for browsers that
don’t have JavaScript enabled, and it will try to still
send a tracking request here. Now, in most cases, JavaScript will be enabled. So my best practice is actually to delete
this code altogether, the no script tag, you could place it into an image tag within Google
Tag Manager. But since Google Tag Manager is just deploying
script codes and JavaScript and it’s a JavaScript tool, in the end in JavaScript needs to be
enabled for Google Tag Manager to work. And this is probably the case with 99% of
the browsers, the others are bots, and therefore we can delete this no script
part. And this is just something that I do because
I don’t really say that I need to have super accurate tracking here. If you want to install the no script part,
then you should place it into an image tag, which is also available within Google Tag
Manager. So that’s one part of it. I won’t show you this today. If you have more questions about this, I’m
going to link up something below to tell you how to install this. But then we get to our JavaScript. And this is actually two-fold. As I said, there is a library loading. And this is the library code, it actually
downloads the library code from this URL down here. And then it takes them, it sends some commands
to that library. And that library then does something or a
sense code over to Google Analytics, Google, Facebook, Facebook analytics, or Facebook,
the Facebook Pixel. So the first line that you see here is what
I marked here is the library itself. And then we get to the init call. The init call is the initiation of the tracking
code, so knows where to send this information to which account and this is where you have
your account number in you. Now, this is something that that happens on
every page, who needs to load the library, and then you can send commands. And then we have our second part here, which
is the track call, the page view track call. Now what you could do is obviously, for every
track call, you would load the library again, and again. But this is unnecessary because we just need
to load the ones on the page view. So at the beginning of the page, and then
we can send different track call. So for example, the user has clicked on something,
the user has purchased something the user has viewed the page. And therefore I would recommend to split those
two quotes. So you only load the library once. Now, the library needs to load before the
actual track call. So that’s why this is an order here, we have
first the library loading, the init call, and then the Facebook track call. And what I’m going to do is actually copy
out that track call here and just have my init call and the library loading
on this particular tag, I’m going to call this tag Facebook General or Base tracking. So and we’re going to have this run on all pages. Now we want to deploy this before our track call, actually. So we need to put in another configuration
down here, which is the tag priority. Now, you could also do tag what’s called a tag sequencing a little bit
more complicated to set up. Therefore, I would go with the tag firing
priority and just put in a high number here or it needs to be higher than the other tag
that we will set up, I will just put in 100. So it Google Tag Manager knows, okay, I need
to fire this first, it’s a bit of a method to sequence your tags. So to put them in order, but not as stringent
as the tag sequence in feature which I would set up in certain circumstances if you really
need to get this in order. Now what we can do, since we want to deploy
this on all the pages so the library loads on all pages and is ready to fire of any track
call, we go to the triggering side here and select our pages triggered. This is predefined in Google Tag Manager. So this is all we need to do. If we save this and refresh our page and refresh our demo
shop here, we will get our preview and debug mode down here. And we see our Facebook tracking all pages
fired, but nothing really happened. So we have this tool installed on our browser. This is the Facebook Pixel helper that would
tell us what events have fired. Nothing has fired just yet. But what we can now do is send any kind of
track calls because our base tracking or library is now deployed. And we don’t have to repeat the library over
and over again. So what we can do now is just simply build
another Facebook Pixel that tracks the pages also on all pages. And here, we are going to go with the custom
HTML tag. And I’m going to paste in what I’ve taken
out before. Now, since this is a Facebook tracking, since
this is JavaScript, and this is a custom HTML tag, we need to surround it by script tags. So let’s do this right here. I don’t know if you hear the construction
work. But there’s something going on. And they’re changing the windows here. So I hope it’s not gonna go too loud. And then I’m going to choose the trigger again,
here, we could choose a tag priority that is lower than what we have inputted by our
Facebook base tracking pixel. But since the baseline is zero, really, it would just
fire after the highest tag priority, which is 100. So I can leave this empty for now. So here in a triggering option, I’m going
to go with all pages again and save this. All right, and refresh, and preview and debug. And now we have our two tags firing and our
page Facebook Pixel. As you see up here in the Facebook Pixel helper
data is sent over to Facebook. Now, we should also be able to see that in
Facebook either inside of our tracking pixel, there is a debug functionality down here on the diagnostics? No, normally you can see a debug window. Okay but the second option that we can see
appears view analytics. And this is like the real-time there’s a functionality
in there, like the real-time reporting within Google Analytics. So under the event settings, here, we have
event debugging. And we should see somebody just came to our
website or fired our pixel with a Mac OS, which I’m on it right now. And the site that has been sent over his And that way, we have already now set up our
Facebook Pixel and the base tracking of Facebook, the Facebook Pixel, and we have two tags installed
obviously. One is for the library that is being loaded. And then is the page view that’s been loaded. Now, if you just want to have the base tracking
code installed with the help of Google Tag Manager, and want to have an easy Facebook
installation, you are already done. So you just need to go to the submit button
here. And a description preferably. And this is for version keeping. So you can go back if something goes wrong,
then you can publish this and this will now go live to all your users. Now, since this is now installed, all the users
that come to the demo shop will be pixeled or will send off requests to Google to Facebook. So this is the Facebook tracking based tracking
pixel. Now, you could stop here and say, okay, call
it a day, I have the Facebook pixel tracking installed, you can do a lot with this already. Because once you have this installed, and
it’s working correctly, and all the pages tags correctly, you will be able to build
things like custom conversions. So you can just say, we can create a custom
conversion here and say, all the traffic that gets to my confirmation page. So maybe /confirmation I want to call a purchase. And this will simply do it. And here we can choose our purchase. And if you have a value for this, so every
time somebody buys something, they spend $1, we can already do this. You can also build custom audiences. So over here, we can go into our audience section. And since we have the Facebook Pixel installed,
we can create a new audience, a custom audience where we’re going to use the Facebook Pixel. So we have different methods here to build
custom audiences where we can choose his website traffic now, because we have the Facebook
Pixel installed, and we can say, okay, we want to have everybody in the audience who
ever visited our website in the past 30 days. So all website visitors, you will call us
all website visitors and then create your audience. And Facebook will then gather the people who
have who have visited your website. And the Facebook Pixel was fired inside of
this audience. And you will be able to use that in your ads. So a lot already that you can do you can retarget. You can set up custom conversions, you can even do
more. But this is a bit where it gets tricky, because
Facebook, has the capabilities of auto tracking now. So if you have the Facebook Pixel installed
and it’s just a base tracking and there are no events being sent over Facebook will actually
or the Facebook Pixel will actually pick up certain data points. So for example, here microdata was automatically
attached, when you see that that lightning thing, then you will see that there’s been
Facebook tracking pixels data that’s been sent over. Well, this is really loud, I didn’t know that
they are going to do this right next door. Anyways, so if I show you right now, if I
click on this add to cart, maybe this will work. I’m just going to click on it. So can you see that there was a new event
right here and there was a button click that was automatically picked up and sent over
to Facebook. What will happen then if you don’t have any
other events set up? In Facebook, you will be able and the ads
manager later in your pixel section, you will see which events are being sent over. So here and the pixel events, you should see
more events down here. And these are we see that, no, these will show up as button clicks. Now, when that does am here, it’s not yet
here. Because Facebook will first see how many events
out there and filter out which ones are good, and which ones are bad, or which ones are
usable. And then we’ll set up auto tracking for you. And it will be indicated by a little blue
thing can’t really show you it in my account. But this is the auto event tracking, really. So this is really automatic. And my experience with it is that it’s quite
inaccurate. So if you’re not sending it over manually, or sending it over via Google Tag
Manager. And, and really consciously, then a Facebook will
try to pick it up. Because no little bit of data is better than
no data. But I haven’t found it to be too accurate,
to be honest. So I wouldn’t rely on the auto tracking feature,
I would rather go the next step of actually sending over events in manually or with Google Tag Manager. And consciously and purposely so you will
be able to have them in your account. So let’s dive into how to do that. In Google Tag Manager, we have the ability
to send over tracking information and a pickup interaction data event. So inside of a product page. Right here we have the Add to Cart button. So how would we set up if we wanted to send
over this data custom event data into Google into Facebook? Let’s go over to Google Tag Manager. And first all we would need to set up a trigger. How would we do this in our trigger section,
we can define certain rules when should our facebook pixel fire and here’s where we’re
going to build a new click trigger for our Add to Cart button. Once we do that, we can go to the section
here where we can see the different events where we can fire our tag. And there’s one tag one ability here. This is the all elements trigger. Now they’re different other events interactions
that you can pick up. We have multiple tutorials on this channel
on how to use them. And we’ll just go with the Add to Cart button. And we’ll go with all clicks for now. Save this, refresh our preview and debug mode. refresh our page. And what would this do and this set up that
I’ve done right now it will deploy a generic click trigger. Now just generic click trigger will just fire
on any button click. So if we have reloaded this, you will see
every time I click on the page no matter where it generates a new event down here which is the
GTM click event. Now we need to filter down and only fire our
tag on the Add to Cart button. So I’m going to click on the Add to Cart button
with the Command key press so it opens up a new tab and my old tab doesn’t close and we can see here that our 10th Click was
an Add To Cart click and if you go over to variables we have unfortunately done one mistake. I need to activate all my click variable so
you need to only do this one time here on the built-in variables in the variable menu
you can go down and see here you have click variables available and you need to activate
and first I should have done this before. Okay we refresh a preview and debug mode,
we refresh our page and in I’m going to click the Add to Cart
button again and our fifth click here was our Add to Cart
button click. Now what we can do is look at our variables
and see how they got filled. We see here that our button was filled with target URL and the
classes here is single Add to Cart button and this is something we can use because if
I click somewhere else. So let’s say I’m going to click on this button
here sign up I can see how it actually differs from our
fifth click right so I can see okay this was the click classes ninja forms and our fifth
click has single Add to Cart button. This is unique to the button that we have
just clicked and therefore I want to only fire my tag on this button click so this is
how you to configure it and we need to go back to our trigger settings here and go into our Add To Cart click. And again look into our trigger and then choose
some clicks here and under some clicks will choose the click classes that we want to filter
down on and it should contain. And let’s go back here let’s copy this see
if this works. Single Add to Cart button so should contain the click classes single Add
to Cart button. Only then I want to fire my tag. Let’s save this. Now that we have this prepared we will go
and build a new Facebook Pixel or Facebook track call for our Add to Cart button. Go to tag configurations and the custom HTML
tag. Now what do we enter here? In Facebook and our Facebook settings here
on the set up we actually get predefined codes manual install the code again. Here is our base tracking with our Facebook
Pixel with our track call for pageview. But if you’re going to go the next step here
to continue we actually have event track calls that we
can use. And they are difference that is predefined
purchase, generate lead, and so on. And there’s also one that is Add to Cart button. So here we can choose the Add to Cart button
and get track call right down here. So let’s copy this and put this into our track
call up here. So now we have our Facebook track call. Now since the library has loaded before, we
don’t need to have that whole string of code. It doesn’t hurt you if you have it. But it will potentially load multiple times
which could slow down your page. So we have our track call now in here. And we want to fire this on our trigger that
we have defined our click Add to cart that should do it. We don’t have to mess with the tag fire priority
because it will either be before or after the page view. And since this is an event, so it’s an interaction
on the click, the site needs to be loaded anyways before this actually can happen. So you don’t have to touch this one just saved
this all. Now we can try this all out. Refresh our page. Let’s refresh this page of all these tabs. And if I click on the Add to Cart button with
the Command key press, I should see that now our Add to Cart button
click has fired on our GTM event click here. And the data was sent over inside of our Facebook
Pixel helper. We should also see that our Add to Cart button
was clicked right here. So the information was sent over to Google
to Google Tag Manager. And then forwarded onto Google to Facebook
Analytics or Facebook Ads. And that should then again, either you will see it down here. This should also be visible at some point or inside of your Facebook analytics. So here is our analytics event debugging. Let’s refresh this. Again, there was another page view but also
an Add to cart click that we just triggered. Now, what can you do with this information? You could build a custom audience of everybody
who has clicked on your Add to Cart button. Again, something that is purposely sent over
so you can target much narrower than just everybody who visited your page. So I hope this makes sense. And again, if you want to deploy this to all
your users, you need to go through the exercise of submitting this as a version and then it
will be published. Okay, last but not least. What about custom data information? And so you want to not only sent over information
about the user who has clicked something or tracking event and page view or track call
but additional information so information that Facebook needs to display things like
the purchase amount, that’s where you can actually extend and use variables with your
Facebook Pixel. A good example of this is the purchase tracking. So let’s go through the exercise of setting a purchase tracking here. Inside our shop, I’m now gonna just go through
a through a checkout and actually convert on
my little demo store here and place the order and I need to put any email address, okay, and we get to the order received page. Now on this order receipts page, we could
already track this with the Facebook based tracking, right? We just need to know what’s in the URL. And then we could set up inside of Facebook
analytics or instead of our Facebook Pixel custom conversions, we could say, Okay, if
this isn’t a URL, every time somebody comes to such a URL, then fire my conversion. But then you only know how often somebody
converted. You couldn’t say, How much did they actually
buy or what did they buy. And this is where we can pick up certain information
from the order received page, like, for example, the order number, the order total cash on
delivery, and so on. But we need to have that data available in
Google Tag Manager first. How can we get that data? There’s a video we did on custom conversions
and how to get the conversion value from a conversion. And I’m going to link that up down below as
well. There are different workarounds, the safest
option. And the option that I always recommend is
to set up a custom data layer that is a little bit of code that you need to give over to
your developer and tell him please install this in order for me to be able to pick that
up with the help of Google Tag Manager. Now I have a plugin installed here that actually
gives me that data. So I have a plugin on this woo commerce store
that pushes the data layer information into or the information into the data layer. So we have it available. And if you want to download the plugin, it’s
the Google Tag Manager of a WordPress plugin by Thomas Geiger and it’s in the WordPress
plugin plugin repository. So here you can look into the data layer inside
of your preview and debug mode. And you can see what data is actually available. And we have for example the revenue that we
want to get out of the data layer we just need to build a data layer variable in order
to do this. And to pull the information we go over to
Google Tag Manager and go into variables and build a custom data layer variable. So down here we use the user-defined variables
and I’m going to call this dlv revenue revenue and I’m going to pull this out with
a data layer variable okay. Now I need to put in the name I need to get
to this value and way to do this because this is nested in objects we need to go to eCommerce
purchase action field and then revenue so we need to install input this with a .notation
eCommerce. What was it? eCommerce.purchase.actionfield.revenue All right, so we have that now available in
a variable. Now variables are basically like placeholder
so they pull the right information out so we can use that later on our tags. So how do we do this? Let’s go over to Facebook first of all, and
look up how what information we would need. We will manually install the code again, we
will go to continue to go to the next section here. And this time, we want to track purchases. Now we want to send over event parameters
to Facebook. And we want to send over the conversion value. So this is where would send over our value
like $11. So we get a code down here. Once we can also put in USD, you could put in content ID content type,
I will leave this empty. So this won’t be in here. And we can now copy this code. This is just an example code here. And we can build our tag around this. So again, we’ll go to our tag go with new, this will be a Facebook tag for our purchase. And I’m going to go with the custom HTML. And this will, I’m just going to paste this
in here. Unless you can see this will always send over
a track call of purchase with the value of 11 which obviously needs to change every time
somebody goes to the thank you page. And this is where the data comes in. And needs to be dynamic in order for the value
to be picked up correctly. So we can enter here variable that we have
just created with these two curly brackets we’ll open up this menu. And we can search we can search here for our dlv revenue. And this will then be automatically implemented,
it’s like a placeholder for this tracking code. Now we just need to have the right trigger. And obviously, we want to trigger this once
the value is in the data layer actually available. So I’m gonna go back to our checkout page
and look when is this data available. And we have these different events here. So we can find this on page view or on the
click event. It’s actually available already here. And the first event which is GTM for WP. This is a custom event sent over by the plugin and this is what I’m going to use for our
to set up our trigger. Now we have also the event here in the variable
GTM for WP order completed, etc. So going to go to the triggers and build a
custom event trigger and just enter this right here. We can leave everything untouched because
this will only be deployed once the data is actually available once somebody has bought
something new. So this is a custom trigger for the for WP order
completed. Let’s save this. And this will now be our trigger that we will
use in our tag. Let’s save this as well. And refresh our preview and debug mode. Refresh our page. And the cool thing that a plugin actually
does, it doesn’t deploy this code again once we reload the page. So it will only be deployed once, which will
obviously take care of all the nasty duplication. So we have to go through an actual new checkout. Okay, I’m gonna put some stuff in the cart and simply check out and place my order and we get to the checkout page the
confirmation page and hopefully if we have done everything correctly,
our purchase pixel fired and we should have in our Facebook Pixel helper purchase information
there was an error detected event code but it’s not activated for this event. So no information was sent to Facebook and
there we get to a problem because our Facebook base pixel actually needs to fire before our
Facebook event code fires so we have here are GTM for WP. But only on this page our Facebook base pixel
fires and our Facebook Pixel purchase fires beforehand. So in this, since I would recommend to actually, use the what could you do, you could do it, later
on, you could do it before, you could use tag sequencing. There are different methods of doing this,
I would, for simplicity sake, just use our initiation code here again, and use that again
for our Facebook purchase pixel. So in this case, I would actually put this
on top again, we need to get rid of certain data. We don’t need to track page view here because
this will be fired later as well. And so it will initiate with the Facebook
purchase call that we gone through. So let’s try this out. Okay, I didn’t plan on doing this actually. But yeah, that’s this is how I would set this
up if your base pixel hasn’t fired beforehand. I’m going to go through another conversion
here. Here we go. We want to ship to the same address. And hopefully, now we’ll be able to see our Facebook Pixel purchase code firing correctly. Yes, we have our purchase firing and the amount
that we have just bought has been transferred as a custom parameter to the Facebook Pixel. Now how can this be useful on Facebook itself? Well, once you have the amount in there, you
will be actually able to customize or optimize your campaigns based on the stuff that a user
has bought because maybe an ad or a certain audience yields less results in terms of revenue
then your users who have been in or have more results or have more revenue
in that sense so you can optimize based on that you can do an ROI analysis in Facebook
as well. You will see that data later in your ads account
once you once you start running actual ads. Okay, this is it with the installation of the purchase
tracking pixel and the custom pixel. Now again, if you want to deploy this to all
your users we edit the Facebook purchase and to capture again you
need to actually published this as a version to all
your users so it’s gonna go live on your website. All right, so there you have it. This is how you can install the Facebook tracking
pixel with the help of Google Tag Manager. There is a bit more to it when you want to
do more sophisticated tracking like sending over product data so you can do product retargeting. You can also let Facebook have more than enough.

65 thoughts on “🔴 Facebook Pixel Tracking with Google Tag Manager (2018)

  1. Great Video Julian!
    Question – if you send an event (without the base code) and there are 3 base codes (different accounts) installed. on the page. will this event get sent to all 3 accounts?

  2. Thanks for this Julian, learned a lot today.

    1. Just wondering if you can run through a video of the setup for DuracellTomi's Google Tag Manager plugin you're using, since it has it's own settings and asking to place these codes on the site again, where as I have already set them up according to your guidelines.

    2. For me I didn't have to put the base pixel again for the purchase. For reason the data comes up on FB.

    Thank you!

  3. ✋ Hi there, I have done and met all the requirements to build a "product catalog" based on the "Facebook pixel" but it doesn't work.

    -I have the pixel connected to the catalog
    -The pixel is well implemented in source code (verified)
    -The pixel is receiving events (viewcontent, addtocart, purchases, etc.)
    -The OpenGraph metadata are available when the ViewContent event is sent (verified).
    -The OpenGraph metadata is well formed (verified).
    Even more, I can verify all of these things with the Facebook Pixel Helper (image attached), and all it's right implemented. But when I try to choose the pixel as a "Product Data Source" the pixel is disabled…😡 (so I cannot connect the pixel with my catalog)

    I posted question in stackoverflow (with screenshots): and facebook dev group, but nobody seems to help me.

    Could you try to get the pixel as a product catalog data source and maybe comment here or even post a video? many Thanks

  4. Great tutorial 😃! BTW: you can create more than 1 FB Pixel, in order to do that you need to create a Facebook Business Account first, after that you're able to create a maximum of 10 pixels per business account. This could be useful for consultancy purposes.

  5. I wanted to thank-you because you helped me resolve a nasty bug in my sequence of tags to be fired, thanks to this video. Thanks a lot.

  6. Hey Julien,
    Thanks so much for your help ! You made my last days way cooler that it was supposed to be 🙂
    I still got a problem. When i open a new tab, it does not count as a clic and i can't see what you see on your screen (class id etc…) do you know how I could solve that ?

  7. Thanks Julian, it was an awesome video and you saved me alot of trouble!!! You just earned yourself a subscriber! Have you done a video on adding google ads conversion tracking tag to GTM?

  8. thank you so much julian, you are a life saver! the way, I have seen this and i don't know whether it's relevent to me or not(i have an ecommerce website)
    window.google_tag_manager[{{Container ID}}].onHtmlSuccess({{HTML ID}});

  9. Hi Julian, you mentioned that purchases must be updated dynamically with some kind of a data layer, can you provide more info on this? I need to setup purchases but I do not have access to the additional codes you spoke about. Thx Vol

  10. Hello,

    Thanks for your tips, very useful. You could talk about Tracking custom events which allow to push creative events ( and also Custom properties which are like Custom Dimension (hit scope) and are no limited to 20. They are all functional to create custom audience.

  11. Hej Juliann!
    I have installed the Facebook Pixel in the exact way you did, but when I click to see on the Facebook Pixel Helper if the Pixel is working, it seems to be a problem. It will say that it found one pixel on the website, but then the Pageview are yellow and has an error. It says this "We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click.". I'm so tired of this, I really tried everything. I been reading, looking at youtube videos, but nothing works. Do you know what may be the problem? I would really appreciate help. I'm so desperate to make it work.

    Best Regards,

  12. This is great thanks Julian. Clear instructions and you're very easy to follow. How do you set up Initiate Check Out?

  13. In last month or so, our Purchase and InitiateCheckout event stopped working. Since then, we can't find a solution for it. Pixel is integrated within GTM and in GTM preview and debug, a pixel is always firing but in the pixel helper, it's always a yellow triangle.

    This is the error we get every time:
    "We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click."

    Does anyone have a solution to the problem?

  14. Hi and thank you for this video, i have a question, is it possible to install with tag manager the event button click?

  15. hey @Julian. How would you recommend FB pixel with shopify? native or GTM? I have GA native and GTM in the script-hack you showed in another video. Thanks 🙂

  16. Hi Julian
    Great Video again!

    About the issue you run into at the end: couldn't you just set tag prio for purchase to 50 (or just lower than 100) so it will fire after library?

  17. Hi Julian,
    thank you for your tutorial. I followed every step but I encountered two problems:
    1) Facebook counts every conversion even those I did on my own. There is a chrome plugin to block Google Analytics from taking your actions into account but can I also block Facebook statistics from my own activities based on IP or browser I am working with?
    2) Facebook counts as converstaion every conversion, even those that have been done via Google Ads or Google Organic. Is there a way that Facebook showed me only conversion made by people who bought something from me after interaction with Facebook Ads?

  18. Hey Julian,

    Is it ok to paste the Pixel base code again, but this time with the purchase code? Isn't there a problem there?

  19. Is my fb pixel code correctly, I have this code:

    <!– Facebook Pixel Code –>


    if ('') == -1) {






    fbq('init', '1596176767064509'); // Insert your pixel ID here.

    fbq('track', 'PageView');


    window.google_tag_manager[{{Container ID}}].onHtmlSuccess({{HTML ID}});


    <!– DO NOT MODIFY –>

    <!– End Facebook Pixel Code –>

    I've setup this a long time ago, I don't know why I have this part:
    window.google_tag_manager[{{Container ID}}].onHtmlSuccess({{HTML ID}});

  20. Hi. Can you make a video like this for shopify?

    I wanted to install FB pixel through GTM but having hard time with the variables and triggers for each FB standard event.

  21. It's common in Woocommerce that you have an add to cart button in the category view and one another on the product page. Depending on the theme you use, these two may not share the same CSS Class. So basically I need to do 2 different triggers? One for product page and on for category view. Am I right?

  22. I just released an updated video (March 2019) explaining how to instal these codes into shopify and more. Check it out.

  23. Man, really cool stuff!
    I wanted to understand, however, how would you have set up a purchase tracking, if your using a funnel that sells a low ticket offer then redirects for an upsell for another product?

  24. How can I fire a FB "LEAD" pixel just before I redirect to an affiliate link RIGHT AFTER someone clicks the optin button? Im having an issue firing the pixel because I can't get the offer owner to place my pixel on their page. Or on the purchase page. Im trying to avoid using a third party tracker because FB doesnt like it and it can result in an account ban. So I need to figure out how to register the LEAD in FB before I send the person to the offer. So then I can optimize my campaign for the "Leads" conversions. I tried to fire the pixel on click but there isnt enough time for it to fire the pixel just before the redirect. Thanks!

  25. if you use the Facebook for woocommerce plugin do you have to create the separate triggers on tag manager or will it automatically be added?

  26. Julian, what about adbolck it's block the facebook pixel…. will it delete it with the no script also ?

  27. Thanks Julian, just a question. I have WP Rocket installed and it has the google analytics and facebook pixel add on feature which host the script on my own server. If I activate the add on has it an effect on GTM? I mean does it host the GTM facebook and Google analytics script on my own server? Since I use only this two scripts what would be your choice?

  28. Are you sure only one pixel is allowed? I seem to see information on the internet that contradicts that statement

  29. I am a little confused. I did all the steps but it looks like pixel helper is showing that there is still no pixel in the website. Why is this happening?

  30. Do we have to start with fresh pixel when we open our store to public. Because we are firing the pixel many times for testing purposes. What do you say about it. And thank you for this tutorial

  31. Good stuff!
    Question, if it is a best practice to cut the code up into two separate tags, one for the library loading and one for tracking page views. And the idea is to only load the library once instead of each time the tag fires, why fire the library tag on all pages? What's the added value of having two tags then?

  32. Awesome tutorial! Wished, I had found your channel sooner! This is my first time with GTM and FB Pixel. I am using Elementor Page Builder where in my Homepage, I have Featured Products which has an Add to Cart button. Further, on my Shop page, it is also designed using Elementor, where I have the Add to Cart button. I noticed when I clicked it from Shop or Homepage, the Click Classes is 'button product_type_simple add_to_cart_button ajax_add_to_cart. When I tried including this Click Classes in the trigger –> Fire this trigger when an Event occurs and all of these conditions are true (the Add to Cart pixel doesn't fire, presumably because it must satisfy ALL of the conditions)?

    So, if I have a store that is designed like above – do I NOT need to fire those Add to Cart clicked on my Shop and Homepage? Wouldn't we not be capturing those Add to Cart clicks on the Home and Shop sections? Should I record those or no need ?

    Thank you. @MeasureSchool Julian or someone please help

  33. Quick thought, have you considered embedding all this code into an app or tag so you can gain money from your knowledge?

  34. Hi! I watched your video to implement facebook pixel in google tag manager. I followed every step but somehow the tags are fired but the facebook pixel helper doesnt confirm that it works succesfully. 2 pixels (add to cart button) and the Base pageview does not show. Can you maybe help me out or let me know what I m doing wrong? website is

  35. Man I absolutely love learning from you! Your smile is so contagious and your relaxed way of sharing information is absolutely perfect <3

  36. When I check my pixel status under Events Manager (like at 15:29 ) instead of getting a thumbs up or a summary I get a blank screen with a spinning ball (it's thinking) – Has been like this for an hour and I have tried 5 times now and each time it just gets stuck. Is it something I have done wrong or is my timing bad and FB just happens to be having a brain fart?

Leave a Reply

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