Analytics
4.7K members online now
4.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Code implementation with third party reservation system

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi  Would appreciate any advice please on implementing analytics.  Added the below tracking code to the web site which was provided by the reservation booking button provider.  Visitors and pages are being tracked but only around 10% of revenue is actually being recorded in ecommerce and the product category is only showing 'room' rather than the room type or description. (i've removed the cid property name just for this post from the snippet below).  

 

</script>
<?php wp_head(); ?>
<script src="/js/respond.js">
</script>
<script src="/js/html5shiv.js"></script>
<!-- Universal Analytics Google -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

var tbb_ga = 'UA-2585112-1';
var tbb_cid = 'hotel';
var tbb_domain = 'app.thebookingbutton.com';

ga('create', tbb_ga, {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [tbb_domain]);
ga('send', 'pageview');

ga(function(tracker) {
window.linker = window.linker || new window.gaplugins.Linker(tracker);
if(document.referrer.indexOf(document.domain)!=7) {
var e = document.createElement('iframe');
e.src=window.linker.decorate('//'+tbb_domain+'/'+tbb_cid+'/ga_proxy');
e.setAttribute('style', 'display:none');
var b = document.getElementsByTagName('body')[0];
b.appendChild(e);
}
});

// Automatically apply TBB prefix to thebookingbutton links
$(document).ready(function(){
$('a[href*="'+tbb_domain+'"]').each(function(){
this.href = this.href.replace(new RegExp(tbb_domain+'/properties', 'i'), tbb_domain+'/'+tbb_cid+'/properties');
});
});
</script>
<!-- End Universal Analytics -->