I have a Google Analytics Module installed in a Drupal site. This tracks any traffic source that is organic (coming in from google search). However we are using a third-party e-commerce platform for processing booking information. This tracks the transactions but doesn't track the traffic source - if the original site has organic or paid traffic source, the third party site just thinks that the traffic is a referral from the original site.
Here's the GA code in the original site - callawaygardens.com
var _gaq = _gaq || [];_
gaq.push(["_setAccount", "UA-1162555-1"]);_
gaq.push(["_setDomainName", "none"]);
_gaq.push(["_setAllowLinker", true]);
_gaq.push(['_setDomainName', 'callawaygardens.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(["_trackPageview"]);
(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
Here's the code in the third party booking site: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1162555-1']); _gaq.push(['_setDomainName', '.synxis.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview', 'Confirmation']); _gaq.push(['_addTrans', '18174SB007366', // order ID - required 'Callaway Gardens Resort', // affiliation or store name '119.00', // total - required '15.47', // tax '', // shipping 'New York', // city 'NY', // state or province 'US' // country ]);
// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
_gaq.push(['_addItem',
'18174SB007366', // order ID - required
'IMND - BA12', // SKU/code - required
'Mountain Creek Inn Double ', // product name
'Best Available Rate', // category or variation
'119.00', // unit price - required
'1' // quantity - required
]);
_gaq.push(['_trackTrans']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();