New!
Discover the latest tools in the Analytics
Suite, thanks to our new online help.
Contents: Hide
There are several methods which can be used to measure clicks. The first one consists of calling a JavaScript function (return xt_click()) at the time of the click. The second one consists of using a redirection URL which allows for a more accurate measurement.
The JavaScript function which is used to measure clicks is contained in the xtcore.js file.
The clicks can be measured independently, in other words without impacting the HREF and TARGET content:
return xt_click(this,'C','Level2_ID','Click_label','Type_of_click')
It is possible to measure clicks and force the destination URL, in other words it is possible to impose a URL that is different from the URL contained in the HREF:
return xt_click(this,'C','Level2_ID','Click_label','Type_of_click','url')
return xt_click(this,'C','Level2_ID','Click_label','Type_of_click','url',1)
As is the case with pages, tree structures for clicks can be defined by using "::" to create chapters, for example "Chapters::Sub-chapters::Sub-sub-chapters::Click_name".
In some cases it may be necessary to measure clicks as page views.
To do so you need to replace the 'C' parameter with 'F'.
return xt_click(this,'F', 'Level 2 ID', 'page name')
You can add additional variables to the page name such as custom variables, site custom variables, order and sales variables by using "&variable".
Measuring navigation consists of measuring the action of clicking on a link which redirects towards another page of the site. This link must be in a page containing a web content tag (xtcore.js file).
For instance, you want to measure the number of clicks on this link:
<a href="http://www.site.com">
You have to call the JavaScript function xt_click() via the "OnClick" action:
<a href="http://www.site.com" onclick="return xt_click(this,'C','level2_number','click_name','N')">
The variables 'C' and 'N' must remain unchanged. These variables are essential because they are used to indicate that a navigation click is being measured.
You must replace 'level2_number' with the number of the level 2 site and 'click_name' with your own navigation names.
Measuring a download consists of measuring the action of clicking on a document download link. This link must be in a page containing a web content tag (xtcore.js file).
For instance you want to measure the number of download clicks on this document:
<a href="http://www.site.com/doc.pdf">
You have to call the JavaScript function xt_click() via the "OnClick" action (which will download your document):
<a href="http://www.site.com/doc.pdf" onclick="return xt_click(this,'C','level2_number','click_name','T')">
The variables 'C' and 'T' must remain unchanged. These variables are essential because they are used to indicate that a download click is being measured.
You must replace 'level2_number' with the number of the level 2 site and 'click_name' with your own document names.
This xtclick() function deactivates the link included in
the href tag and makes the link.
If you already use an onclick function in your links which also deactivate
the URL included in the href tag, you must not use this function. Use
the xt_med() function as follows:
<a href="http://www.site.com" onclick="xt_med('C','level2_number','click_name','N');my_js_function(....)">
The 2 main differences are:
* the absence of "return"
* the absence of "this" as a function
variable
Measuring exits of the site involves measuring the action of clicking on a link which redirects Internet users to other websites. This link must be in a page which contains a web content tag (xtcore.js file).
For instance you want to measure the number of clicks on a link which redirects Internet users to another website:
<a href="http://www.site.com">
First of all you need to call the JavaScript function xt_click() via the "OnClick" action (which will redirect towards the other website):
<a href="http://www.site.com" onclick="return xt_click(this,'C','level2_number','click_name','S')">
The variables 'C' and 'S' must remain unchanged. These variables are essential because they are used to indicate that an exit click is being measured
You must replace 'level2_number' with the number of the level 2 site and 'click_name' with your own exit website names.
Measuring actions on the site involves measuring clicks made on a link. This page must contain a web content tag (xtcore.js file).
For example you want to measure the number of clicks on a link which does not reload the page (AJAX or other):
<a href="http://www.site.com">
You have to call the JavaScript function xt_click() via the "OnClick" action:
<a href="http://www.site.com" onclick="return xt_click(this,'C','level2_number','click_name','A')">
The variables 'C' and 'A' must remain unchanged. These variables are essential because they are used to indicate that an action click is being measured.
You must replace 'level2_number' with the number of the level 2 site and 'click_name' with your own action names.
If you would like to measure a click that has been made on the validation button of a form, you will need to use the xt_form() function which is contained in the 3.4.005 version or later of the xtcore.js file.
By default, this function should be placed directly into the <form> tag, at the level of the "Onsubmit" event.
Our explanations will be illustrated with examples of tagging which have been carried out on navigation clicks (‘N’). Please remember that this specific case is applicable to ALL TYPES OF CLICKS: i.e. navigation, download, exit and action clicks.
Example 1: default use
Let’s take the example of a form for which you would like to measure the number of submit clicks. If the form is in the following format:
<form action="http://www.site.com" >...</form>
Then the JavaScript return xt_form() needs to be called via the "Onsubmit()" event:
<form action="http://www.site.com" onsubmit="return xt_form(this,'C','level2_number','click_name','N',true);">…</form>
'Level2_number' must be replaced with the number of the level 2, and 'click_name' must be replaced with your own navigation labels.
Example 2: the use of an intermediary validation function
If your form is coded as follows:
<form action="http://www.site.com" onsubmit="return valid_form();">
<input type="hidden" value="ok" id="hiddenfield" name="hiddenfield"/>
<input type="submit" value="submit"/>
</form>
<script type="text/javascript">
<!--
function valid_form(){
if(document.getElementById("hiddenfield").value=="ok"){
return true;
}
else{
return false;
}
}
//-->
</script>
The code should be completed as shown below:
<form action="http://www.site.com" onsubmit="return valid_form(this);">
<input type="hidden" value="ok" id="hiddenfield" name="hiddenfield"/>
<input type="submit" value="submit"/>
</form>
<script type="text/javascript">
<!--
function valid_form(obj){
if(document.getElementById("hiddenfield").value=="ok"){
return xt_form(obj,'C','level2_number','click_name','N',true);
}
else{
return xt_form(obj,'C','level2_number','click_name','N',false);
}
}
//-->
</script>
Example 3: direct submission from a JavaScript form
Example A: if you use a JavaScript function to submit your form which is written as follows:
<script type="text/javascript">
<!--
var theForm = document.forms['Form'];
if (!theForm) { theForm = document.Form; }
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//-->
</script>
The code should be completed as shown below:
<script type="text/javascript">
<!--
var theForm = document.forms['Form'];
if (!theForm) { theForm = document.Form; }
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
//theForm.submit(); => the submit function must be deactivated as it is managed by the xt_form() function.
xt_form(theForm,'C','level2_number', 'click_name','N',true);
}
}
//-->
</script>
Example B: JavaScript submission via a <select> tag:
<form action="http://www.site.com" method=post >
<font face="Arial" size="2"><b>Themes :</b></font>
<select name="p2" onchange="form.submit();" style="background-color:#ffffff; color:#000000; font-family:arial; font-weight: bold; font-size: 8pt; border:1">
<option value=0>General
<option value=3>Employment
<option value=4>Economy
<option value=19>Communication
<option value=1>Tourism
<option value=10>Movies
</select>
<input name="valid_theme" type="submit" value=" ok " style="{font-size:9pt;}">
</form>
The code should be completed as shown below:
<form action="http://www.site.com" method=post onsubmit="return xt_form(this,'C','level2_number','click_name','N',true);">
<font face="Arial" size="2"><b>Themes :</b></font>
<select name="p2" onchange="xt_form(form,'C','level2_number','click_name','N',true);" style="background-color:#ffffff; color:#000000; font-family:arial; font-weight: bold; font-size: 8pt; border:1">
<option value=0>General
<option value=3>Employment
<option value=4>Economy
<option value=19>Communication
<option value=1>Tourism
<option value=10>Movies
</select>
<input name="valid_theme" type="submit" value=" ok " style="{font-size:9pt;}">
</form>
The JavasScript onchange submit ="form.submit();" is replaced with a call to our function:
- The key word return is not placed before the xt_form() function because it is not necessary to generate any results.
- The parameter theForm corresponds to your form.
This method involves replacing the destination URL with a special redirection URL that will allow for tracking.
Irrespective of the type of click, you must populate the following variables in the URL:
As is the case with pages, tree structures for clicks can be defined by using "::" to create chapters, for example "Chapters::Sub-chapters::Sub-sub-chapters::Click_name".
In the examples below the parameter 'click' has been written as click=. An alternative spelling, clic=, is also possible.
For example, you would like to measure the number of clicks on this link:
<a href="http://www.site.com">
You need to replace the URL with:
http://logxxxx.xxxx/go.click?xts=...&s2=...&p=...&clic=N&type=click&url=http://www.site.com
The variables 'click=N' and type=click' must remain unchanged. These variables are essential because they are used to indicate that a navigation click is being measured.
You must populate logxxxx, xts=, s2=, p= and url=.
For example, you would like to measure the number of download clicks on this document:
<a href="http://www.site.com/doc.pdf">
You need to replace the URL with:
http://logxxxx.xxxx/go.click?xts=...&s2=...&p=...&clic=T&type=click&url=http://www.site.com/doc.pdf
The variables 'click=T' and 'type=click'' must remain unchanged. These variables are essential because they are used to indicate that a download click is being measured.
You must populate logxxxx, xts=, s2=, p= and url=.
For example you would like to measure the number of clicks on a link which redirects Internet users to another website:
<a href="http://www.site.com">
You need to replace this URL with:
http://logxxxx.xxxx/go.click?xts=...&s2=...&p=...&clic=S&type=click&url=http://www.site.com
The variables 'click=S' and 'type=click' must remain unchanged. These variables are essential because they are used to indicate that an exit click is being measured.
You must populate logxxxx, xts=, s2=, p= and url=.
If we take the URL action:
<a href="http://www.site.com">
You need to replace this URL with:
http://logxxxx.xxxx/go.click?xts=...&s2=...&p=...&clic=A&type=click&url=http://www.site.com
The variables 'click=A' and 'type=click' must remain unchanged. These variables are essential because they are used to indicate that an action click is being measured.
You must populate logxxxx, xts=, s2=, p= and url=.
www.atinternet.com/support
© AT Internet - 2016 - All rights reserved