Tracking Code
The Woopra JavaScript is fully asynchronous, meaning it does not wait for a response from the server before allowing the page to continue loading in a visitor’s Web browser, hence it will not slow down your website loading time.
In order to activate tracking by Woopra’s servers you must insert a JavaScript snippet into the HTML code on each page you wish tracked. Tracking occurs when a visitor’s Web browser executes the Woopra JavaScript and pings the Woopra servers. Custom visitor data, or custom events, can be added to Woopra and the reference below will demonstrate how this is done.
As a result, asynchronous JavaScript code can be inserted at any location of the document rather than always needing to be inserted in the page footer. This increases the chances that a page view is going to be tracked before the visitor leaves the page.
The basic JavaScript snipped to insert into a page for tracking purposes is as follows:
<script type="text/javascript">
function woopraReady(tracker){
tracker.setDomain('yourdomain.com');
tracker.setIdleTimeout(300000);
tracker.track();
return false; // when we return false, the Woopra script will not call the track() function again.
}
(function(){
var wsc=document.createElement('script');
wsc.type='text/javascript';
wsc.src=document.location.protocol+'//static.woopra.com/js/woopra.js';
wsc.async=true;
var ssc = document.getElementsByTagName('script')[0];
ssc.parentNode.insertBefore(wsc, ssc);
})();
</script>