This article will explain the Tracking and Analytics capability of LeadsHook.

We recommend and encourage the use of 3rd party tracking. Most users use Google Analytics. However we have users who use other tracking apps and software as well such as hotjar, mouseflow,, AutoPilotHQ and many others.

As long as your tracking solution can track JS events you’ll be able to use it. If you’re unsure then please contact us with a link to the app.


Most Tracking and CRM apps provide a tracking code (e.g. Facebook pixel or Google Analytics)


In our training we refer to these as the BASE pixel or tracking code. These tracking codes will FIRE on every page and LeadsHook node, e.g. Facebook Pixel or Google Analytics


On each node, you can track multiple behaviours like a button clicked or form field filled or even speed at which a website visitor scrolls on a page. This is done using snippets of javascript events such as Facebook standard events.

These standard events NEED the base pixel to be loaded BEFOREHAND before these events will work. The events require the base pixel to work.

Our preferred and recommended way of tracking is via Google Tag Manager and Google Analytics.

Why Google Tag Manager?

It’s just makes it easy to manage all of your scripts and tags from one place. LeadsHook has a one-step integration to GTM. Then all of your GTM containers are available to be ‘applied’ to any decision tree you want.

Further there are some extra benefits to using Google Tag Manager which is explained in this video:

Go to this article to learn how to integrate Google Tag Manager with LeadsHook.

Why Google Analytics?

  • Google has spent billions building a FREE analytics and tracking platform. It has all of the advanced features required to slice and dice the data.
  • Google Analytics also has the capability for viewing the data. Our preferred approach is using EVENTS FLOW. See below.
  • Google Analytics integrates with other Google products such as Google Ads and Google Optimize. It for this capability to push ‘goals’ and conversions into Google Ads is why we recommend users use Google Analytics.

Click: How to Directly Integrate Google Analytics

How to Trace and Audit Your Impressions & Leads

If you want to audit and trace your impressions and leads then please be sure to checkout the following system fields…

impression_id: Every time a Decision Tree is shown

lead_id: Every unique visitor

lead_token: Unique token generated for each lead

Click: How to Add 3rd Party Tracking and Analytics Scripts, Pixels and Events

Please see the above article to learn how to fire node level events for granular tracking & audience building. Please go to Node-Level Tracking.

How to Fire Google Analytcs Events

Add this script to node level.

ga('send', {
  hitType: 'event',
  eventCategory: 'DT:QualDT',
  eventAction: 'Qn:Telling a story about open-mindedness is a powerful strategy to get people to accept new ideas.',
  eventLabel: 'Ans:{ga_1}'

Notice:  {ga_1} is a custom field. Save your answers into a custom field and add that custom field to the event.

How to Track FaceBook Events

Similar to Google Events tracking as shown above, you can also pass Javascript Events to Facebook.

Facebook as 2 options…

Standard Events: For almost users, standard events are sufficient.

2. Custom Events

For custom events…



LeadsHook has the following ‘secret’ custom fields so you don’t have to enter values manually each node.

LeadsHook will automatically replace the values of the CURRENT node into theses fields. And repeat on every node where these custom fields are used.

Warning! The values of these fields CHANGE as per the node so they should only be used for events such as when used in tracking scripts.

Current Decision Tree Title: {_c_dt}:
Current Node Title: {_c_node}
Question: {_c_question}
Answer: {_c_answer}

Google Analytics Example:


‘straight quotes’
‘curly quotes’

curly quotes will give an error
ga('send', {
  hitType: 'event',
  eventCategory: '{_c_dt}',
  eventAction: '{_c_question}',
  eventLabel: '{_c_answer}'

Facebook Standard Event

fbq('track', 'ViewContent', {
  content_name: '{_c_dt}',
  content_category: '{_c_node}',
  content_ids: ['{_c_question}'],
  content_type: '{_c_answer}'

You can also use the lead event when you’re captured a LEAD.

fbq('track', 'Lead', {
  content_name: '{_c_dt}',
  content_category: '{_c_node}',
  value: 0.50,
  currency: 'USD'

Please SEE below for details on how to push custom fields INTO JS events.

How to Troubleshoot Your Events – making sure events are firing.



Here’s the technical docs on events (not required but adding it for completeness):


  1. Pingback: How to Ensure Your Facebook Pixel Has Been Correctly Setup | LeadsHook Knowledge Base

  2. Pingback: How to Create Custom Conversions inside FaceBook Using Standard Events or Custom Events) After Firing JS Events from LeadsHook | LeadsHook Knowledge Base

  3. Dan Wood

    If I’ve gone through the GTM integration with Leadshook, do I still need to add the base pixels for GA and FB to my decision trees?

  4. Dan Wood

    I copied the Google Analytics Example above into my node’s script and noticed that the variables did not light up in red in the script editor. Testing on the front end proved that the script isn’t running.
    I’ve discovered that the code example above uses a different single quotation character which does not work in the node script editor. The Facebook sample code does work.
    The correct character is ‘
    The one that doesn’t work is ‘

    A small but crucial detail!

    1. chouaibi

      Thank you Dan for the comment. We picked up the error as soon as the tracking code was used, and we updated the code in this article.
      Worth mentioning also that some tools will change the quotes to curly automatically, Slack for example change the quotes from straight to curly when you type or even when you paste code with straight quotes. Few other rich text editor have this same behavior, in some editor this configurable. So please be careful when using these tools.

  5. Pingback: How to View Decision Tree Data Inside Facebook Analytics | LeadsHook Knowledge Base

  6. Pingback: How to Create a Custom Audience inside FaceBook Using Standard Events After Firing JS Events from LeadsHook | LeadsHook Knowledge Base

Leave a Reply

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