I have a Magento 1.7 site (soon to be upgraded to 1.9 if that makes any difference) that has two separate domains for the unsecure and secure parts of the site.

In addition to this, there is a 3rd party payment gateway (redirect page). I am using Google AdWords.

The flow is:

  1. Visitor clicks on Adwords Ad
  2. Directed to page on unsecured site (www.example.com)
  3. Shops and puts products into cart
  4. Checks out (as guest/logs in), sent to secure area (shop.secureexample.com) to enter address, etc
  5. Directed to 3rd party payment gateway page (www.3ppayexample.com), enters card details
  6. Directed back to success/failure page on secured site (shop.secureexample.com)

The problem I have is tracking the visitor from first click on an Adword to the success page.

Because there are effectively 3 domains involved here, there is no end to end tracking, which means I cant measure conversions and other metrics.. All I see is referrals from shop.secureexample.com that result in sales.

Unfortunately I cant use the same domain on both secure and unsecure areas of the site (out of my hands), so that isn't an option.

Can you suggest a way to accomplish this?


It's possible but you'll need to do some tweaking to a block class. Either rewrite Mage_GoogleAnalytics_Block_Ga from your own module or copy to local. If you're using a custom Google Analytics module find the file that generates the JavaScript for Analytics.

Now find the ga('create' [...] part in the code and change it to

ga('create', '{$this->jsQuoteEscape($accountId)}', 'auto', {'allowLinker': true});

Next we'll add the domains that should be linked, these can come right after above line.

ga('require', 'linker');
ga('linker:autoLink', ['www.example.com','shop.secureexample.com'] );

And that should be it. Some more info on cross-domain tracking can be found here: https://support.google.com/analytics/answer/1034342?hl=en

Not the answer you're looking for? Browse other questions tagged or ask your own question.