Interface of the Tagging Script
Interface of the Tagging Script
The interface of the tagging script provides a method „commit“ (short: c). With this method a JSON-object can be consigned which then calls the measurement system.
The Method "commit" (short: c)
The method expects one or two parameters. A call to this method directly generates a call to the measurement system.
Example (Page Impressions):
var sp_e0 = { "s":"testsite", "cp":"Path/to/your/page", //Please go to Chapter ContentPath(cp) "url": document.location.href };
These variables are added to the object spring by the following call:
spring.c(sp_e0);
List of Variables
The following list describes all variables understood by the measurement system.
Site (s) [mandatory]
This variable contains the sitename under which your website is known to the system.
You must request your sitename at spring prior to tagging your website. For example the sitename “testsite” may be used which is then internally routed to testsite.[counting domain].
ContentPath (cp) [mandatory]
This is the path to your page (Path/to/your/page), which identifies your content. The value of this variable has to identify a unique site. It should not contain, for example any random values.
var sp_e0 = { "s":"testsite", "cp":"Path/to/your/page", "url": document.location.href };
In general there is no limitation of the charset – conform to the JSON standard http://json.org – , but for having a better interpretation of pagepaths in scores we advice to use the described standards below.
The allowable character set for all values in the tagging is UTF-8. It is however recommended to limit to the following characters:
a-z | A-Z | 0-9 | comma “,” | point “.” | dash “-“ | underscore “_” |
---|
If other characters are used as the above, these characters at the beginning of the measurement chain are replaced by a point. The semicolon ";" stands as the last character in the code and marks the end of the code.
Special chars that should be avoided are:
quotation marks " " | question mark "?" | number sign or hash "#" | back slash "\" |
---|
If a question mark "?" or a hash "#" is used in code, so the code will be covered only until this special character. The special character itself and all subsequent characters are discarded.
If a backslash "\" is used within the code the browser will carry out a different modification depending on the browser in which the tag is called,.
Details, see the chart below:
Code Internet Explorer Firefox
1bltest\test 1bltestest 1bltestest
2bltest\\test 2bltest/test 2bltest.test
3bltest\\\test 3bltest/est 3bltest.est
4bltest\\\\test 4bltest//test 4bltest.test
5bltest\\\\\test 5bltest//est 5bltest.est
The following table shows some examples, how the contentpath can be used to build up an hierarchical structure:
| PATH DEFINITION IN SCORES | ContentPath is CASE SENSITIVE. | | ||||
|
|
|
|
| ContentPath code | ||
| Level1 | Level2 | Level3 | Level4 | "cp":"<contentpath>" | ||
1 | Testsite | Testsite | |||||
2 | Testsite | Media | Testsite/Media | ||||
3 | Testsite | Media | Frontpage | Testsite/Media/Frontpage | |||
4 | Testsite | Media | Internet | Testsite/Media/Internet | |||
5 | Testsite | Media | Internet | Reporting | Testsite/Media/Internet/Reporting | ||
6 | Testsite | Media | Internet | Panelinformation | Testsite/Media/Internet/Panelinformation | ||
7 | Testsite | Media | News | Testsite/Media/News | |||
8 | Testsite | Media | News | Event1 | Testsite/Media/News/Event1 | ||
9 | Testsite | Media | News | Event2 | Testsite/Media/News/Event2 | ||
10 | Testsite | div | Testsite/div | ||||
11 | Testsite | Div | Testsite/Div |
The slash "/" is used as a seperator within the content path
(cp) for creating different hierachy levels
Example:
cp | Hierachy |
---|---|
Testsite | → First Level |
Testsite/Media | → Second Level |
Testsite/Media/News | → Third Level |
URL (url) [optional]
In this variable the URL
of the page can be stored by using document.location.href
.
var sp_e0 = { "s": "testsite", "cp": "Path/to/your/page", //Please go to Chapter ContentPath(cp) "url": document.location.href }; spring.c(sp_e0);
To display the URL information in the scores URL report the "url" variable has to be set in the tagging.