Clicks

 

Foreword

Before beginning implementation of the Clicks plugin, please make sure you have initialised the AT Internet JavaScript tracker and selected the plugin from within the Tag Composer interface.

 

Principle

This plugin’s objective is to enable measurement of clicks on your site.

 

Plugin setup

The Clicks plugin can be set up from within the Tag Composer interface. Two parameters are affected:

  • Automatic click management: When a click triggers navigation or redirection, browsers prohibit the measurement of these links. This management can force the measurement.
  • Automatic click management timeout: Period of time after which the automatic click management will force the navigation, even if measurement was not able to take place (in milliseconds).
 

Tagging

To tag your clicks, the tracker exposes two objects, click and clickListener, based on the type of tag desired.

click exposes two methods:

  • send: regular measurement of a click
  • set: is used with the tracker’s dispatch

Parameters

Property Method Description
elem  send (optional) Tagged DOM element
name  send / set Click label/name
chapter1  send / set First level of chapter
chapter2  send / set Second level of chapter
chapter3  send / set Third level of chapter
level2  send / set Click level 2
type  send / set (mandatory) click type, possible values are: ‘exit’, ‘download’, ‘action’, or ‘navigation’
customObject  send / set Customised parameters (see Custom object)
event  send (optional) JavaScript event (prevent event propagation) – since v5.7.0
callback  send (optional) function to execute – since v5.7.0

clickListener exposes one method:

  • send: regular measurement of a click

Parameters

Property Description
elem Tagged DOM element
name Click label/name
chapter1 First level of chapter
chapter2 Second level of chapter
chapter3 Third level of chapter
level2 Click level 2
type (mandatory) click type, possible values are: ‘exit’, ‘download’, ‘action’, or ‘navigation’
customObject Customised parameters (see Custom object)
callback (optional) function to execute

The parameter type is mandatory to measure a click

If the “name” parameter is not entered or is an empty string, the page URL will be used as the click name in your reports.

If the parameters “chapter1”, “chapter2” or “chapter3” are empty, they will be empty as well in the analysis.

Event parameter is not available for send method exposed by clickListener.

 

Link tagging examples

Standard tagging of a link is done via its HTML code.

Initialising the tracker can be done before or after the HTML code that defines the tagged clickable element.

The parameter “elem:this” as well as the keyword “return” enable automatic click management.

 

Simple example

 

Example with chapters

 

Example with JQuery event

Available since version 5.7.0

 

Example with callback

Available since version 5.7.0

 

 

Tagging in a custom JavaScript method

If you have a method that you don’t wish to touch, you must simply place our tag right after your method:

 

Tagging a form

 

Tagging a link or a form via an event listener

This tag enables you to avoid placing JavaScript code in the HTML code.

However, it is necessary that the clickable element we wish to tag can be referenced, for example, by giving this element an ID via the “id” attribute, and then using the JavaScript method “document.getElementById(<ID>)” to add the tagging property “elem”.

The JavaScript code containing a call to “clickListener.send()” must be placed after the element we wish to tag (so that this element exists with the code is executed).

Example of a link:

Example of a form:

Was this post helpful?
Yes
No
Last update: 10/04/2018