Operating principle

 

Set

After initialising the Tracker, tagging is done via the “setter” tag (tag.<functionality>.set()) described in the different pages of this documentation.

Example for page tagging

var tag = new ATInternet.Tracker.Tag();
tag.page.set({
    name:'pageName'
});

Once the desired tagging has been achieved, the sending of information is done via the dispatch() method.

tag.dispatch();

This example, when taken with the preceding example, will send a “pageName” page hit.

 

Dispatch

This method is designed to be used during loading of the page or measured element. This method triggers the sending of tags accumulated via “setter”, and also optimises the number of hits to send based on the number of “setter” detected.

Exemple

var tag = new ATInternet.Tracker.Tag();

tag.<functionality1>.set(...);
tag.<functionality2>.add(...);
tag.<functionality3>.set(...);

tag.dispatch();

In the case of measuring an element triggering a redirection, we strongly advise you to use tagging via the send() method, following the recommendations found in the tagging guides for the feature you wish to measure.

 

Dispatch redirect

This method is the same as the dispatch() method, but adds automatic redirect management.

It takes an object as a parameter whose properties are as follows:

PropertyDescription
elemTagged DOM element
event(optional) JavaScript event (prevent event propagation)
callback(optional) Function to execute

It is strongly advised to limit this type of tagging to cases where there are no other alternatives, as this type of tagging will systematically slow down the redirect in question (based on the Automatic click management timeout configuration).
If measurement involves a single functionality, please verify that this functionality possesses a send() method and follow the corresponding tagging documentation. This option is preferable, as this method is not solely based on the automatic click management timeout, but rather on the download of the measurement pixel, which will, in the majority of cases, take much less time than the configured timeout duration (500ms by default).

Example using the clicked element

<a href="http://www.site.com" onclick="return customFunction(this);">Link</a>
<script type="text/javascript">
window.tag = new ATInternet.Tracker.Tag();
function callback() {console.log('executed');}
function customFunction(clickedElement){
	tag.<functionality1>.set(...);
	tag.<functionality2>.add(...);
	tag.<functionality3>.set(...);
	
	return tag.dispatchRedirect({
		elem : clickedElement,
		callback: callback
	});
}
</script>

Example using manually provided redirect data

<a href="javascript:void(0);" onclick="return customFunction();">Link</a>
<script type="text/javascript">
window.tag = new ATInternet.Tracker.Tag();

function customFunction(){
	tag.<functionality1>.set(...);
	tag.<functionality2>.add(...);
	tag.<functionality3>.set(...);
	
	return tag.dispatchRedirect({
		elem : {
			href : 'http://www.site.com', 
			target : '_self'
		}
	});
}
</script>

Example on a form

<form action="http://www.site.com" type="GET" onsubmit="return customFunction(this);">
...
</form>
<script type="text/javascript">
window.tag = new ATInternet.Tracker.Tag();

function customFunction(clickedForm){
	tag.<functionality1>.set(...);
	tag.<functionality2>.add(...);
	tag.<functionality3>.set(...);
	
	return tag.dispatchRedirect({
		elem : clickedForm
	});
}
</script>

Example using JQuery

<a href="http://www.site.com" id="link">Link</a>
<script type="text/javascript">
window.tag = new ATInternet.Tracker.Tag();

$("#link").on( "click", function(event) {
	
	tag.<functionality1>.set(...);
	tag.<functionality2>.add(...);
	tag.<functionality3>.set(...);
	
	tag.dispatchRedirect({
		elem: this,
		event: event
	});
  
});
</script>
 

Send

It is possible to send hits in a sporadic and direct manner via the method tag.<functionality>.send(). This method is useful, notably when sending hits on specific actions or events (ex: click on a link).

var tag = new ATInternet.Tracker.Tag();
tag.page.send({name:'pageName'});
Last update: 30/01/2018