Facebook Pixel Custom Event Tracking with GTM | Part 2
Articles Blog

Facebook Pixel Custom Event Tracking with GTM | Part 2


38 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 a Reply

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

Back To Top