-
Notifications
You must be signed in to change notification settings - Fork 0
Clicks
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.
This plugin’s objective is to enable measurement of clicks on your site.
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).
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.
By default, if the “name” parameter is not entered (or is an empty string), and if chapter attributes are not entered (or are empty strings), the page URL will be used as the click name in your reports. Keep in mind that if your tag is set to not ignore empty chapter values, the URL will only be used if the “name” parameter is not entered (or is an empty string) and if chapter attributes are totally absent.
“event” parameter is not available for send method exposed by clickListener.
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.
<script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<a href="http://www.site.com" onclick="return tag.click.send({elem:this, name:'clickName', level2:'clickLvl2', type:'navigation'});">Click me</a><script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<a href="http://www.site.com" onclick="return tag.click.send({elem:this, name:'clickName', chapter1:'myChapter1', chapter2:'myChapter2', level2:'clickLvl2', type:'navigation'});">Click me</a>Available since version 5.7.0
<script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<a id="link" href="http://www.site.com">Click me</a>
<script type="text/javascript">
$("#link").on( "click", function(event) {
tag.click.send({
elem: this,
name: 'clickName',
level2: 'clickLvl2',
type: 'navigation',
event: event
});
});
</script>Available since version 5.7.0
<script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<a id="link" href="http://www.site.com">Click me</a>
<script type="text/javascript">
var link = document.getElementById('link');
var callback = function() {console.log('executed');};
ATInternet.Utils.addEvtListener(link, 'click', function (event) {
tag.click.send({
elem: link,
name: 'clickName',
level2: 'clickLvl2',
type: 'action',
callback: callback,
event: event
});
});
</script><script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<script type="text/javascript">
function customFunction(element){
// your code
return tag.click.send({
elem:element, // DOM element given
name:'clickName',
chapter1:'myChapter1',
chapter2:'myChapter2',
chapter3:'myChapter3',
level2:'clickLvl2',
type:'navigation',
customObject:{
param1:'val1',
param2:2
}
});
}
</script>
<a href="http://www.site.com" onclick="return customFunction(this)">Click me</a>If you have a method that you don’t wish to touch, you must simply place our tag right after your method:
<a href="http://www.site.com" onclick="customFunction();return tag.click.send({elem:this,...});">Click me</a><script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
</script>
<form action="..." method="GET" onsubmit="return tag.click.send({elem:this,name:'myFormName',type:'navigation'});">
<input type="submit" value="submit"/>
</a>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()” 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:
<a href="javascript:void(0)" id="mylink">Click me</a>
<script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
var callback = function() {console.log('executed');};
tag.clickListener.send({
elem: document.getElementById("mylink"),
name: 'clickName',
chapter1: 'chap1',
level2: 'clickLvl2',
type: 'action',
callback: callback
});
// this will send a hit when the link is clicked
</script>Example of a form:
<form action="..." method="GET" id="myForm">
<input type="submit" value="submit"/>
</a>
<script type="text/javascript">
var tag = new ATInternet.Tracker.Tag();
tag.clickListener.send({
elem: document.getElementById("myForm"),
name: 'clickName',
chapter1: 'chap1',
level2: 'clickLvl2',
type: 'action'
});
// this will send a hit when the form is submitted
</script>Last update: 01/03/2019
-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android