Please note: This is only applicable for Version 2 decision trees. For Version 1, please refer to this guide: https://www.www.leadshook.com/help/using-leadshook-with-google-tag-manager-google-analytics-4/

In this article, you’ll learn how to set up your tracking in less than 3 minutes!

Google Ads, Google Analytics 4, Facebook, Twitter, TikTok & Microsoft Ads!

You’ll discover how to access your automagically created Google Tag Manager container from your LeadsHook Account. All you need to do is upload and publish.

Please watch the instructional videos below:

5 Easy Steps to Setup Your Tracking Across Multiple Ad Networks

Setting Up GTM Container

How to Setup Direct Link & Custom Domains

How to Setup Embedded Version (Using GA4)

How to Setup Facebook Ads (Embedded Version)

How to Setup Facebook Serverside Deduplication When Using LeadsHook V2

 How to Setup TikTok Tracking (Embedded Version)

How to Setup Microsoft Ads Tracking (Embedded Version)

How to Setup Twitter Ads Tracking (Embedded Version)

How to Use the 1 GTM Container for All Decision Trees on a Single Domain

This scenario appears when you embed your decision trees on multiple landing pages on 1 domain or website.

How to Setup & Use Custom Events

In the video below you’ll learn how to setup and use custom events.

Sidenote: In case you want to give yourself or your team tracking mastery then consider getting this course. You do need working knowledge of Google Tag Manager, data layer variables, and how to setup custom event triggers in GTM:

https://courses.www.leadshook.com/tracking-sos/

For custom events tracking, LeadsHook offers a function…

sendCustomGTMEvent('myCustomEventName', eventData)

myCustomEventName is the name you want to push in the Google Tag Manager data layer. This is customizable so you can use whatever name you want.

In the example below, this custom event name is “benCustomEvent” and it will appear in the data layer with prefix “LH_”

eventData is an object to push data into the data layer.

    // Push a dataLayer event within the iframe
    var eventData = {
      event: 'phoneCallButtonClicked',
      buttonCTA: 'callNowtoClaim1M',
      buttonColor: 'blue',
      // Add any additional data properties as needed
    }

Here’s how the event data appears in the data layer

Here’s a sample script to fire an event with its data…

<script>
    // Define the event data
    var eventData = {
      event: 'phoneCallButtonClicked',
      buttonCTA: 'callNowtoClaim1M',
      buttonColor: 'blue'
      // Add any additional data properties as needed
    };

    // Send the event data
    sendCustomGTMEvent('benCustomEvent', eventData);
    
    // Log a message to the console to indicate the event has been triggered
    console.log('benCustomEvent triggered with eventData:', eventData);
</script>

In the video you’ll see an example where event is fired when a button is clicked. Here’s a sample script for that.

<script>
  // Get the button element with id "phonecall"
  var phonecall = document.getElementById('phonecall');

  // Add a click event listener to the button
  phonecall.addEventListener('click', function() {
    // Your lead generation and online conversion logic here
    // ...

    // Log a message to the console
    console.log('Phone call button clicked. Script fired.');

    // Push a dataLayer event within the iframe
    var eventData = {
      event: 'phoneCallButtonClicked',
      buttonCTA: 'callNowtoClaim1M',
      buttonColor: 'blue',
      // Add any additional data properties as needed
    };

   // Send the event data to the parent page
   sendCustomGTMEvent('benCustomEvent', eventData);
  });
</script>

Please note: You can add your node level custom events into as templates using custom fields so you can use the same code over and over again. This is explained in the video above.

How to Setup Facebook Advanced Matching

Setup of Advanced matching requires an advanced understanding of Google Tag Manager and data layer variables. Unfortunately, these techie skills are real assets when it comes to scaling media buyers.

Consider this course to boost your tracking mojo:

Boost My Tracking Mojo

If you know GTM and how to grab data from the data layer then you’ll be able to implement this quickly.

Please refer to link below to learn more about Facebook’s Advanced Matching:

https://developers.facebook.com/docs/meta-pixel/advanced/advanced-matching/

LeadsHook Data Layer Enhanced

16th Aug 2023 Update: LeadsHook has enhanced data layer information so you can now create data layer variables ONCE and use then in all of your decision tree. Watch video below…

ChatGPT prompt is below the video

How to Grab Google Tag Manager Data Layer Variables Using ChatGPT v4

Please watch the video above for more details…

You are a worldclass google tag manager, frontend JS and web developer and coder. 

You can read data layer variables and its related code and workout accurately data layer variable names. 

When reading the code pay particular care and attention to detail to not miss any variables.  The datalayer variables can have multiple layers and depth.  Important to read the code provided below carefully and thoroughly to avoid mistakes.  Some names can have 5 or even 6 levels of nesting such as:

data1.data2.data3.data4.data5.data6

You'll receive data layer code before extracted from tag assistant preview.  Do not forget to add 'data' which you seem to miss every time in the nesting!

Please read and provide instructions to create GTM data layer variables to grab

1) value and sha256 of variable:first_name
2) value and sha256 of variable:last_name
3) value and sha256 of variable:email

Here's the GTM data layer code.  Please read, analyse and construct the data layer variable names.

How to Leverage Our V2 GTM Container for Other Traffic Networks

In this video below you’ll learn how to add other ad networks like Taboola and Outbrain (or any other ad networks) and have your tracking pixels, scripts and conversions up and running in a few minutes…

Frequently Asked Questions & Common Gotchas!

Testing Your Facebook Tracking Setup

1. Take note when you test in “GTM preview”, the events will actually not be visible under the test queue dashboard in Facebook.

2. You will only need to test the GTM Preview to check if the Tags are really firing based on the nodes where you have set up the events.

3. To fully test , you will need to use your Live Direct link or your Custom domain or Embed setup, and these will appear under the Facebook Test queue and also under the actual live Events in Facebook.