Analytics
1.6K members online now
1.6K 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

Using 'return false;' preventing linking in Chrome

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have cross domain tracking set up for ecommerce purposes, and for the moment we are stuck using classic Google Analytics until we roll out Universal for all of our properties. So, while I understand switching to Universal will fix this, I have to work with Classic and for the moment, we're dealing with this glitch for Chrome users.

 

Nothing happens when a Chrome user clicks "Buy Now". Removing "return false" fixes the issue but then prevents cross domain tracking. The inclusion of "return false" is required for this analytics installation to track the session from our domain to our third-party shopping cart domain.

 

HTML:

 

 

<a href="https://www.thirdpartywebsite.com/shoppingcart" onclick="_gaq.push(['_link', this.href]); return false;">Buy Now</a>

 

Analytics Snippet:

 

function trackOutboundLink(link, category, action) {
try {
_gaq.push(['_trackEvent', category , action]);
} catch(err){}

setTimeout(function() {
document.location.href = link.href;
}, 100);
}

var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';

_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
_gaq.push(['_setAccount', 'MY_UA_ID_IS_HERE']);
_gaq.push(['_setDomainName', 'none']);
_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);
})
();

Using &#39;return false;&#39; preventing linking in Chrome

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

I have a similar problem. Did you find a solution?

Using &#39;return false;&#39; preventing linking in Chrome

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

No. And no agency we spoke to was able to determine a solution. We ended up having to switch to Universal Analytics.