0
votes

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);
  })();
1

1 Answers

0
votes

Since you didn't mention them you might have forgotten to use the _link or _linkByPost functions. Merely to allow linking in the GA code is not enough, you have to explicitly send the cookie data to the other domain.

Documentation is here: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._linkByPost

Updated to add:

As for the Drupal module - I haven't used Drupal in quite some time, so I'm not sure. But from looking at the code it looks like the _link method (which works with links to the other domain) is attached automatically while the _linkByPost-Data (which works with forms) is not implemented at all. So if you send your visitor to the other domain via a form this wouldn't work.

Other thoughts: maybe there is a redirect between your site and the other domain ? In this case you'd have to make sure that the redirect does not lose the data that's added via the linker methods.