Managing the Goal Tracking Script

Retrieving your script

After creating your goal, you now have the possibility to retrieve the script which will be inserted in your web pages.

To do so, go to the 'Active' tab.

images/download/thumbnails/615292722/image2019-4-26_10-1-36.png

Select your goal in the list of existing goals. The line will turn green. Next, click on the 'View script' button.

images/download/attachments/615292722/image2019-4-26_10-4-10.png

You will be able to copy the script in order to insert it on the web pages that you want to track.

Script for website visit goals

The script generated for website visit goals is the same for every goal of this type in your licence. It does not require additional parameters, as the targeted URLs are defined directly during the creation of the goal in ACTITO.

This means that you will only need to insert this script the first time that you follow a page. You will subsequently be able to add new goals to pages already containing the script, without the need of any additional configuration.

Example of website visit goal script
<script type="text/javascript">
var _actGoal = {'settings':{'value':'/g/encrypted/goal/txSgBAH7u5l5vCnRgwHyzeA4IrLMXFzo', 'type' : 'WEBSITE_VISIT','goalUrl':'https://development.actito.be/actg'}};
(function() {
var _head = document.head || document.getElementsByTagName("head")[0];
var sp = document.createElement('script'); sp.type = 'text/javascript'; sp.async = true; sp.defer = true;
sp.src = ('https:' == document.location.protocol ? 'https://development-cdn.actito.be' : 'http://development-cdn.actito.be') + '/legacy/actito-goal/goal.js';
_head.appendChild(sp);
})();
</script>

Tip

As the script for all website visit goals in unique for your licence, you may want to insert this script in all the pages of your website beforehand, except on the order confirmation page. In this way, you will only need to create a new goal in ACTITO and to define the URL addresses that you want to track, without any extra handling.

Script for transaction goals

The base of the script for transaction goals is the same for every goal of this type in your licence. Besides, this script is fairly similar to the one used for website visit goals, except that transaction goals scripts contain additional parameters. These parameters are used to retrieve additional information in relation to the transaction made.

  • goalId: The ID of the goal, which is pre-filled in the script. The value of this field must absolutely not be modified, otherwise the link with the goal would be lost.

On the other hand, the following parameters must be customized:

  • amountCent: The transaction amount, in cents. In the ACTITO interface, this amount will be converted into €.

  • source: The source of the transaction. When the goal is activated by clicking on a link in an e-mail, the source will take the value submitted by this e-mail. In such a case, we advise you to leave this field empty. Indeed, if you provide a variable in the 'source' parameter, the information linking the transaction to the e-mail campaign will be lost.

  • comment: A comment associated with the transaction. You can choose what you want this field to display.

  • businessId: The key ID of the transaction.

It is necessary to fill in the 'value' field associated to each of these parameters. This is the definition of the value taken by each given parameter. Following each of these parameters, the script contains a 'value' field that must be filled in. A value based on the expected data must be defined. These values must be dynamically parameterized by one of your own developer so that they match the data related to the transaction. This is necessary for the script to be functional. If these values are not dynamically completed, the script will not run.

How to parameter these variables depend on your integration tool. Below is an example of a script with variables defined by the most frequently used tool, namely Google Tag Manager, where variables are provided between double curly brackets. You can however use an alternative such as Tealium, Tag Commander, Omniture,...

Example of transaction goal set up with Google Tag Manager
<script type="text/javascript">
var _actGoal = {'settings':{'value':'/g/encrypted/goal/txSgBAH7u5l5vCnRwHyzdEW3ZdkRwXT', 'type' : 'TRANSACTION','goalUrl':'https://www.actito.be/actg','additionalParameters' : [
{'name' : 'goalId', 'value' : '13'},
{'name' : 'businessId', 'value' : '{{dnr}}'},
{'name' : 'amountCent', 'value' : String({{totalPrice}}*100)},
{'name' : 'source', 'value' : ''},
{'name' : 'comment', 'value' : '{{origin}}-{{destination}}'}
]
}};
(function() {
var _head = document.head || document.getElementsByTagName("head")[0];
var sp = document.createElement('script'); sp.type = 'text/javascript'; sp.async = true; sp.defer = true;
sp.src = ('https:' == document.location.protocol ? 'https://cdn.actito.be' : 'http://cdn.actito.be') + '/actito-goal/goal.js';
_head.appendChild(sp);
})();
</script>