1. Help Desk
  2. Technical Documentation

GTM Container Documentation

Overview of the Funnelytics Event Script and Trigger setup

Funnelytics Event Script

<script>
  
  window.funnelytics.events.trigger('Event Name', {
    key0: ‘value’,
    key1: ‘value’
  })
  
</script>

Event Name: 

Can be any string, does not need to adhere to any strict naming convention. This is the Action Title that will appear in the Funnelytics Canvas

Properties: 

Are organized into key and value pairs.  The key can be any string and does not need to adhere to any strict naming convention. 

However, if you wish to deanonymize users who have completed a form on your site, the key for the user’s name must be “name” and the key for the user’s email must be “email” 


Values can be any string or number value and can be dynamically populated using variables.

Key and value pairs can also be assigned by passing a JavaScript object along with the event, however, Funnelytics will only accept a flat data structure and an object that contains nested values will fail.



Recommended Variables


User-Defined Variables:


Name:
Custom JS - Page Path

Variable Type: Custom JavaScript

function () {

return {{Page Path}}.replace(/\/?(\?|#|$)/, '/$1')

};

This standardizes the page path to ensure that the trailing slash is included in instances where it may not be

 

Name: Custom JS - Click Text

Variable Type: Custom JavaScript

function () {

return {{Click Text}}.replace(/&/g, 'and')

};

Replace the ‘&’ with the word ‘and’. Funnelytics can sometimes have issues resolving instances of the ‘&’ symbol when it appears in a string, as a result, we remove the symbol and replace it with the word to avoid the request being dropped.

 

Name: Custom JS - Click URL

Variable Type: Custom JavaScript

function () {

return {{Click URL}}.split(‘?’)[0]

};

The built-in Click URL offered in GTM will include the query string parameters that may be included in a link. Since Funnelytics will automatically detect any query string parameter, it is unnecessary to collect this information on the link click. So, we split the URL at the question mark and only take the first portion of the string.

 



Recommended Triggers:

Name: Listener - Click - Just Links

Trigger Type: Click - Just Links

Fires On: All Link Clicks

References to this Trigger:

Funnelytics - Link Click

Name: Click - Click To Call

Trigger Type: Click - Just Links

Fires On: Some Link Clicks

Conditions:

Click URL

contains

tel:

References to this Trigger:

Funnelytics - Click To Call

Name: Scroll 15

Trigger Type: Scroll Depth

Vertical Scroll Depth: 

Percentages - 15 percent

Fires On:  All Pages

References to this Trigger:

Funnelytics - Scroll 15


Name: Scroll 25

Trigger Type: Scroll Depth

Vertical Scroll Depth: 

Percentages - 25 percent

Fires On: All Pages

References to this Trigger:

Funnelytics - Scroll 25

Name: Scroll 50

Trigger Type: Scroll Depth

Vertical Scroll Depth: 

Percentages - 50 percent

Fires On: All Pages

References to this Trigger:

Funnelytics - Scroll 50

Name: Scroll 75

Trigger Type: Scroll Depth

Vertical Scroll Depth: 

Percentages - 75 percent

Fires On: All Pages

References to this Trigger:

Funnelytics - Scroll 75

Name: Scroll 90

Trigger Type: Scroll Depth

Vertical Scroll Depth: 

Percentages - 90 percent

Fires On: All Pages

References to this Trigger:

Funnelytics - Scroll 90

Name: Listener - YouTube Video View

Trigger Type: YouTube Video

Capture: 

Start - Complete - Progress

Percentages: 10,25,50,75,90

Advanced: Add JavaScript API support to all YouTube videos

Fires On: All Videos

References to this Trigger:

Funnelytics - YouTube - Play Pause 10, 25, 50, 75, 90, 100%

 



Recommended Tags


Name:
Funnelytics - Link Click

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Link Click', {
  pagePath: {{Custom JS - Page Path}},
    clickText: {{Custom JS - Click Text}},
    clickURL: {{Custom JS - Click URL}}
  })
  
</script>

Trigger: Listener - Click - Just Links


Name:
Funnelytics - Click To Call

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Click To Call', {
    pagePath: {{Custom JS - Page Path}},
    clickText: {{Custom JS - Click Text}},
    clickURL: {{Custom JS - Click URL}}
  })
  
</script>

Trigger: Click - Click To Call


Name:
Funnelytics - Scroll 15

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Scroll', {
    scrollDepth: {{Scroll Depth Threshold}},
  pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Advanced Settings:

Tag firing options: Once per page

Tag Sequencing: Fire a tag before Funnelytics - Scroll 15 fires

Setup Tag: Funnelytics - Base Script

Trigger: Scroll 15

Your tag will also fire right before these tags: Funnelytics - Scroll 25


Name:
Funnelytics - Scroll 25

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Scroll', {
    scrollDepth: {{Scroll Depth Threshold}},
    pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Advanced Settings:

Tag firing options: Once per page

Tag Sequencing: Fire a tag before Funnelytics - Scroll 25 fires

Setup Tag: Funnelytics - Scroll 15

Trigger: Scroll 25

Your tag will also fire right before these tags: Funnelytics - Scroll 50


Name:
Funnelytics - Scroll 50

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Scroll', {
    scrollDepth: {{Scroll Depth Threshold}},
    pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Advanced Settings:

Tag firing options: Once per page

Tag Sequencing: Fire a tag before Funnelytics - Scroll 50 fires

Setup Tag: Funnelytics - Scroll 25

Trigger: Scroll 50

Your tag will also fire right before these tags: Funnelytics - Scroll 75


Name:
Funnelytics - Scroll 75

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Scroll', {
    scrollDepth: {{Scroll Depth Threshold}},
    pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Advanced Settings:

Tag firing options: Once per page

Tag Sequencing: Fire a tag before Funnelytics - Scroll 75 fires

Setup Tag: Funnelytics - Scroll 50

Trigger: Scroll 75

Your tag will also fire right before these tags: Funnelytics - Scroll 90


Name:
Funnelytics - Scroll 90

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Scroll', {
    scrollDepth: {{Scroll Depth Threshold}},
    pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Advanced Settings:

Tag firing options: Once per page

Tag Sequencing: Fire a tag before Funnelytics - Scroll 90 fires

Setup Tag: Funnelytics - Scroll 75

Trigger: Scroll 90


Name:
Event Listener - YouTube Library

Tag Type: Custom HTML

HTML:

<script src="https://www.youtube.com/iframe_api">

Trigger: All Pages


Name:
Funnelytics - YouTube - Play, Pause, 10, 25, 50, 75, 90, 100%

Tag Type: Custom HTML

HTML:

<script>
  
  window.funnelytics.events.trigger('Video View', {
    videoName: {{Video Title}},
    videoAction: {{Video Percent}},
    pagePath: {{Custom JS - Page Path}}
  })
  
</script>

Trigger: Listener - YouTube Video View

 

 

 

Something missing?

if something is missing in the documentation or if you found some part confusing, please reach out to support team, with your suggestions for improvement.

We love hearing from you!