Integration of the Tagging Script

Integration of the Tagging Script

The following example shows the integration of the tagging script into a website:

Therefore, the script can be integrated synchronously or asynchronously.

  • In case of the synchronous integration the script should be placed in the body part see in Integration with JavaScript (synchronous)
  • In case of the asynchronous integration the script must be placed as described in Integration with JavaScript (asynchronous)
  • In case of the synchronous integration the request is sent directly when the page is loading.
    The disadvantage of the synchronous version is that the page load may be delayed up slightly.
  • In the case of the asynchronous integration the request is sent after the page is loaded.
    The disadvantage of the asynchronous version in case of larger websites may be that the user already navigates to the next page
    before loading the complete page, so the request cannot be sent.

 

Integration with JavaScript (synchronous)

<html>
<head>
</head>
<body>
<script src="spring.js">
</script>
<script language="Javascript">
            var sp_e0 = {
             "s":"testsite",
             "cp":"Path/to/your/page", //Please go to Chapter ContentPath(cp)
             "url": document.location.href
            };
            spring.c(sp_e0);

</script>
</body>
</html> 

 

Example for shortened Form

<script src="spring.js"></script>
<script>
spring.c( { s: "testsite", cp: "Path/to/your/page", url: document.location.href} );
</script>

 

Integration with JavaScript (asynchronous)

In the asynchronous version the variable “springq” must be defined

<html>
<head>
<script type="text/javascript">
    var springq =

     springq || [];
      springq.push({
            "s":"testsite", 
            "cp":"Path/to/your/page", //Please go to Chapter ContentPath(cp)
            "url": document.location.href
      });

 </script>
 </head>
<body>
<script type="text/javascript">

// some other script

</script>

<!-- some stuff goes here -->
 

<!-- end of page -->

<script type="text/javascript">  (function() {
    var scr = document.createElement('script');  
    scr.type = 'text/javascript'; scr.async = true;
    scr.src = 'spring.js';
    var s = document.getElementsByTagName('script')[0];  
    s.parentNode.insertBefore(scr, s);
    })();

</script>
</body>
</html>

 

Integration by using multiple Pagetags (synchronous)

 

<html>
<head>
</head>
<body>
      <script src="spring.js">
      </script>

      <script language="Javascript">
            var sp_s = {
              "s":"testsite",
              "r": document.referrer
            };
            var sp_e0 = [];

            sp_e0.push({
              "cp":"path/to/page/one", //Please go to Chapter ContentPath(cp)
              "url": document.location.href
            });
            sp_e0.push({
              "cp":"path/to/page/two", //Please go to Chapter ContentPath(cp)
              "url": document.location.href
            });
            // ...
            spring.c(sp_s,sp_e0);
      </script>
</body>
</html> 

When using multiple „cp“-attributes, a call to spring.c requires two arguments: the first containing information about the sitename and the document referrer for page-tracking purposes, the second an array with the „cp“-elements.

 

Integration by using multiple Pagetags (asynchronous)

 

<html>
<head>
<script type="text/javascript">
 
    var spring_asy = [];
    var sp_e0 = [];
    var springq = springq || [];
    var sp_s = {
              "s":"testsite",
              "r":document.referrer
            };
    sp_e0.push({
              "cp":"path/to/page/one", //Please go to Chapter ContentPath(cp)
              "url": document.location.href
            });
    sp_e0.push({
              "cp":"path/to/page/two", //Please go to Chapter ContentPath(cp)
              "url": document.location.href
            });
    spring_asy.push(sp_s);
    spring_asy.push(sp_e0);
    springq.push(spring_asy);
     
 </script>
</head>
<body>

 
<script type="text/javascript">
 
// some other script
 
</script>
 
<!-- some stuff goes here -->
  
 
<!-- end of page -->
 
<script type="text/javascript">  (function() {
    var scr = document.createElement('script'); 
    scr.type = 'text/javascript'; scr.async = true;
    scr.src = 'spring.js';
    var s = document.getElementsByTagName('script')[0]; 
    s.parentNode.insertBefore(scr, s);
    })();
 
</script>
</body>
</html>

 

Integration without JavaScript (noscript)

If you are using the „noscript“ variant, the variable „js“ must be added to the URL. The variable „js“ expects an URL-encoded JSON-object. Further information on JSON can be found here: http://json.org

The generation of the REQUEST is facilitated by a tool provided by spring under the following URL:

A specific URL will be delivered for each implementation

Example:

<noscript>
<img src="REQUEST"> # REQUEST can be defined via the above tool
</noscript>

Integration without JavaScript (noscript) for SSL-Measurement

The tag needs to be changed only in the noscript part. The request must be transformed into the following https-call.

<noscript>
<img src="https://ssl-sitename.[counting domain]/j0=,,,;+,,cp=test;;;;" alt="">
</noscript>


So in the noscript part of the tag the counting domain for those SSL clients contains always the following prefix: ssl-

Troubleshooting with jQuery

If problems with the jQuery-Library occur, please follow the information given below:

  • spring.c per default modifies the DOM to transport the call to the server
  • jQuery listens on these modifications and re-executes the contained scripts
  • which then modifies the DOM

To switch off DOM modifications, use a call like

spring.c({r:document.referrer},{
         "s": "testsite",
        "cp": "Path/to/your/page", //Please go to Chapter ContentPath(cp)
        "url": document.location.href
}, 2);

the "2" given as the third parameter to the call selects an Image.src-based transport