Yuma 4×4

Media and Communications

Facebook Pixel Custom Event Tracking with GTM | Part 2

Facebook Pixel Custom Event Tracking with GTM | Part 2


– In this video, I’m going to show you how you can track custom
events with the help of Google Tag Manager and forward them on to your Facebook Pixel. All and more, coming up right after this. (dance music) Hey there, welcome back to another video of measureschool.com, teaching
you the data driven way of digital marketing. My name is Julian and in our last lesson, we have set up our
Facebook base tracking code with the Pageview tracking
code and now we are ready to actually send in more
sophisticated information such as interactions that our users take on our website into Facebook. Now Google Tag Manager is
the perfect tool to do this because we can listen to
certain interactions on our page and then forward them on to
our Facebook Pixel for example, or other tools like Google
Analytics and so on. But since we are here on
our Facebook Tracking Pixel video series, we want to dive
in on how to send in events with the help of Google Tag Manager. So let’s get started. – [Julian Voiceover] Welcome
back to our Demoshop. Now in this video we’re
going to deploy some events to Facebook with the help
of Google Tag Manager. Now in the last video, we
had already set up our tags, our base pixel code, and our Pageview tag. This is what we need in order
to deploy custom events. What our custom events
were when we go over to our Facebook Pixel, go
back to the set up steps. Here we went to Manual Installation and if you click on Continue, you actually go to the
event tracking of Facebook. Now events are interactions such as Add to Cart or Purchase buttons. So certain interactions that
you want to send explicitly to Facebook and they have
certain events predefined. So for example, View Content,
the Search, Initiate Checkout, Add to Cart, or the Purchase. So you can use one of
these predefined events and see them in the interface later. You could also use a custom
event so if that doesn’t fit to your case that you want to track, you could customize it
even further which you can learn about more in the Help
section of Facebook here. Now in our case, we just want to go with the standard event here,
let’s go with the Add to Cart because that’s something that we can track on our Demoshop right here. And then you can send in any
kind of other event parameter such as the conversion value. In our case, that could be the
price here or the currency. I won’t do this for now because
it complicates our tag setup but if you want to get
that data into Facebook, you can certainly do that. So let’s copy this code here. And just go over to Tags. This will be our Facebook
Event Tag, Add to Cart buttons. You’ll choose our custom
H.T.M.L. Tag again and implement our code. So this will track and Add to Cart, click. As a trigger, we need to define
the right Add to Cart click. Now, this usually takes longer to do because we need to do some testing here. If you want to find out more,
how to track button clicks, we go through an example in our video on button click tracking which
I’m also going to link up in the description below. For now, I’m just gonna go
quickly through the steps here. I’m gonna track the link clicks. Go with Some Clicks and in our case, we don’t have our variables defined yet, which is unfortunate. Let me just click this. All link clicks, exit
here, save this for now. Go to Variables and activate my variables that I need for these link trigger. And go back to my pixel code. This is the Facebook base pixel code. Here’s our Add to Cart. And go back into the Trigger. Now I’m gonna use Some Clicks
because I don’t want to deploy this on every
click that is on the page, but only on the click
where they Click Text. Contains, in our case,
that would be Add to Cart. Now again, if you want
to recreate this trigger, you might as well go through the tutorial on button click checking which explains it in much more detail than I have just done. Let’s exist out of this and go into our Preview in Demo mode. And if you reload our page
here, you get our Demo console and if I click on this Add to Cart button, I’m gonna do this with
our Command key press because it will open it up in a new tab and then our page doesn’t reload. You will be able to see
what is happening inside of Google Tag Manager and we see our Facebook Event Tag fired. And here we have our
fifth click that was our Facebook Event Tag Add to Cart. We’d also be able to see that in our Facebook Pixel Helper that this fired. Here’s our Add to Cart
that we fired into Facebook and this should also then show
up in our Facebook analytics. So let’s go back into
our Facebook analytics on the event debugging. We should here see an Add
to Cart that was added to our event debugging list so this data was also received by Facebook. Now you might have seen
in my little test here in the Facebook Pixel Helper,
Subscribe button clicked. Which is not quite accurate. We didn’t send this in explicitly. This is something that
Facebook’s Pixel automatically picks up from the interactions. But if you want to have more control over your event tracking, you can
send in events explicitly just like we did right here. Now as I mentioned, there
are many other events that you could send into Facebook. Just a few here. Or any kind of custom events. Google Tag Manager gives
you actually the ability to build custom triggers
for your interactions that happen on your page. Such as link clicks, scrolling,
form submit, YouTube views, and if an element is inside the view port. So you have a lot of
flexibility of tracking the interactions of your
user and sending that onto Facebook for custom
audiences or conversion tracking. We have a ton more videos on
this channel on how to build these custom Triggers so I
won’t go into detail right now, but I’d encourage you to
check out our playlist on event tracking with Google Tag Manager. For this Add to Cart click,
our tracking works fine. So we can go ahead and submit a version. So our container will actually
be published to all our users and goes live onto our website. So now it’ll be available to all our users and our users will be
tracked on our website. In our next video, we’re gonna show you how you can accomplish conversion tracking or this purchase tracking with the help of Google Tag Manager to
send data to Facebook. Alright so there you have it. This is how you can send
in information such as interaction tracking, like
button click tracking, or form submit tracking,
or scroll tracking onto your Facebook Pixel. Now it really depends on your website on what you send into Facebook. You certainly don’t need all
the information in there, but it can be really
helpful once you optimize or build a custom audience based on one or the other interaction. Now we are not done here because
we really need to take care of one important interaction that the user can take on the website and
this is conversion tracking. And this is what we’re going to discover in the next video so if you are ready, head over to our next video
and if you haven’t yet, then why not subscribe to our channel because we’ll bring you new videos just like this one every week. Now my name is Julian,
see you in the next one.

36 thoughts on “Facebook Pixel Custom Event Tracking with GTM | Part 2

  1. I'm, not too good since I'm no Marketer. At some point, could you make a video on basic Facebook Analytics? From the videos you put on Youtube, I learn a lot. I beleive I've seen them all, and can't wait for a new one. On Google Drive, which our team uses, I just refer them to your videos to learn. Thanks from all of us. Also, Will this idea work to fill the dataLayer–or part of it–, except a PARM in Ad Action, For FB? (WOO)

    function dataLayer_google_gtm( $order_id ) {

    // Lets grab the order
    $order = wc_get_order( $order_id );

    // Products
    $products = $order->get_items();
    ?>
    <script>
    dataLayer.push({
    'ecommerce': {
    'currencyCode': '<?php echo $order->get_order_currency(); ?>',
    'purchase': {
    'actionField':{
    'id': '<?php echo $order->get_order_number(); ?>',
    'affiliation': 'WooCommerce',
    'revenue': <?php echo number_format($order->get_subtotal(), 2, ".", ""); ?>,
    'tax': <?php echo number_format($order->get_total_tax(), 2, ".", ""); ?>,
    'shipping': <?php echo number_format($order->calculate_shipping(), 2, ".", ""); ?>,
    <?php if($order->get_used_coupons()): ?>
    'coupon': '<?php echo implode("-", $order->get_used_coupons()); ?>'
    <?php endif; ?>
    },
    'products': [
    <?php
    foreach($order->get_items() as $key => $item):
    $product = $order->get_product_from_item( $item );
    $variant_name = ($item['variation_id']) ? wc_get_product($item['variation_id']) : '';
    ?>
    {
    'name': '<?php echo $item['name']; ?>',
    'id': '<?php echo $item['product_id']; ?>',
    'price': '<?php echo number_format($order->get_line_subtotal($item), 2, ".", ""); ?>',
    'brand': 'Busters Vision Non-Profit',
    'category': '<?php echo strip_tags($product->get_categories(', ', '', '')); ?>',
    'variant': '<?php echo ($variant_name) ? implode("-", $variant_name->get_variation_attributes()) : ''; ?>',
    'quantity': <?php echo $item['qty']; ?>
    },
    <?php endforeach; ?>
    ]
    }
    }
    });
    </script>

    <?php
    }
    add_action( 'woocommerce_order_status_completed', 'dataLayer_google_gtm', 4 );

  2. Hi Julian, thank you for your videos. You didn't mention the tag sequence part here, that the FB event tag have to be triggered after the standard FB pixel. Is this tag sequence thing is important or not really ?

  3. Hi, where and how can I fix parameters of Value and currency for purchase conversion set up. Do you explain it in any video?

  4. I have a pdf form that gets downloaded on my website and want to track that action. How do I make a FB tracking conversion tag for this? I tired using the "click link" tag and added the file name as the trigger which is in this hyperlink on my website but cannot tell if it works or loads when a person clicks on this hyperlink that opens the pdf in a new window. The tag manager preview window doesn't work on the new window with the pdf in it that opens to tell me if the tag fired.

  5. Hi Julian, great advice. We've set up a tag using the lead code in GTM to track button clicks, we've checked with the Facebook pixel helper and it's firing, however we're having issues with where to view this information on Facebook. It's not coming up in our events (under page views etc).
    Just wondering if we've missed a step here as it doesn't appear to be sending any information back to Facebook?
    Would appreciate any light you can shed on this!
    Thanks!

  6. I think the link at the last bit of the video is not correct. That should be something about conversions. Anyway great work Congrats!

  7. events didnt fire up. The pixel is not paired with any product catalog. i dont know how to do this. do you have tutorial for this ? thanks

  8. Hello!
    Thank you for the helpful video.

    I have a question though…

    If I have multiple facebook pixels implemented, but i need to track conversions only for one of them. Does it mean that I need to add fbq('init', 00000000000000); together with fbq('track', 'Page View' or 'AddToCart'); or any other step to make sure, that it tracks conversions only for pixel i need?

  9. Thanks boss, great video, love the info and help. Through your tutorial here, and with the foundation I built in your Part 1 video, I setup a 'Generate Lead' event in GTM, with the scheduling page of an optin form (that shows after a user submits, their name, email and phone number on the previous page) as the trigger. Is this how you would track user optins with GTM to send that data to FB?

  10. Man, this is the best content about Google Tag manager on the internet. Thank you for your time and efford. Updated version was really needed 🙂

  11. For some reason, when I click on the "Set up" button, nothing happens.. I can't get to the menu to select the tracking events..
    Do you know why ?

  12. Wish I knew all that you already know 😉 Seems so simple when you do it. I always try, then give up and hire a developer 😀 Thanks for the Great video though, keep up the good work!!

  13. Hi Julian. Thanks for great video. I have done all steps but sill Leads are not populated in facebook custum events. Even I do not see this event in event debugging tab. Same trigger is used for GA event and it fires at it should be – for now. Some advice? Thanks.

  14. Hi julian, just trying your tutorial to install facebook event into my website but something not perfectly works. I added an initiate checkout event whenever my visitor fill the form. It works well and pixel helper can read that, but not for the tags. Only pageview fired at that page not the initiate checkout. Can you help me for the problem? Thank you so much

  15. Need help!
    I have successfully set up the pixel. But it records conversions regardless of whether someone clicked the ad or not! It appears to be linked to the ad but even when I do a test application it regards this as a successful conversion. Please help!

  16. Dear, I got now confused with your part 1 with part 2 video. What is the difference between base code(part2) and Facebook Pixel code(part1)???

    Please reply

  17. Please make a video related to view content pixel setup to pick dynamic values from website.

  18. Hi Julian – thanks for the video! For this one, if the FB Standard event is "viewContent" and also being fired on pageview how do you sequence HTML Tags to control the firing order? Or would I just make the viewContent Tag fire on DomReady vs PageView? Thanks!

  19. Trying to track (custom) button clicks that are not 'add to cart' in Facebook events using GTM. Can't seem to find how to do it – can anyone help / advise on the structure please?

Leave comment

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