Below is a breakdown of what needs to be on your pages for Clickstream tracking to work. Please note that all of these are examples using hard-coded values. In reality, you will want to replace the hard-coded values with variables and add any additional code as needed for any specific functions that you may want or need.
Checking your Clickstream code
Every web page that you want to be tracked with Clickstream will need this code to be present. For best results, insert this JavaScript just before the </body> tag on all web pages that need to be tracked:
<script>
(function(d,s,i){
function init() {
if(!i) {
i = true;
DlvTracking.init({
listName: 'delivra-listname',
autoTrackPageview: true,
/* optional init properties */
});
}
}
var f=d.getElementsByTagName(s)[0],j=d.createElement(s);
j.async=true;
j.src='https://integration.delivra.com/tracking/cs/v3/dltr.js';
j.onload=init;
f.parentNode.insertBefore(j,f);
})(document,'script');
</script>
Purchase tracking
If you want to track purchases with Clickstream, you will need to add this code to the above script on your Checkout pages. Please keep in mind that the ENTIRE script above needs to be on the purchase page, not just the purchase code below:
/* be sure replace hard-coded numbers with variables specific to your system */
DlvTracking.track('purchase', {
orderId: '1234567890',
totalItemQuantity: 3,
totalRevenue: 39.99
});
Below is an example of how the code should look on any checkout web pages (purchase code is in bold below):
<script>
(function(d,s,i){
function init() {
if(!i) {
i = true;
DlvTracking.init({
listName: 'delivra-listname',
autoTrackPageview: true,
/* optional init properties */
});
/* be sure replace hard-coded numbers with variables specific to your system */
DlvTracking.track('purchase', {
orderId: '1234567890',
totalItemQuantity: 3,
totalRevenue: 39.99
});
}
}
var f=d.getElementsByTagName(s)[0],j=d.createElement(s);
j.async=true;
j.src='https://integration.delivra.com/tracking/cs/v3/dltr.js';
j.onload=init;
f.parentNode.insertBefore(j,f);
})(document,'script');
</script>
Notes
- If using tags, the system defaults to reading tags out of the meta keywords header. To manually track a page view you will need to override the default tracking.
- If you need help please contact support@delivra.com.
Comments
0 comments
Article is closed for comments.