Closed (fixed)
Project:
Google Analytics
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 May 2012 at 13:23 UTC
Updated:
1 Nov 2012 at 22:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
hass commentedComment #2
jeremyo commentedSorry, I'm not sure how closing this helps. It's in Google's own documentation that in order for cross-domain tracking to work you need to return false.
https://developers.google.com/analytics/devguides/collection/gajs/method...
Otherwise _link() or _getLinkerURL() will not override the browser's default behaviour when you click a link, which is to follow that link. To tell if it's working or not, simply turn it on and see whether a link that it should work on has a query-string appended to it, something like:
?__utma=1.887369289.1337963650.1338020967.1338550310.3&__utmb=1.1.10.1338550310&__utmc=1&__utmx=-&__utmz=1.1337963650.1.1.utmcsr=xyz.org|utmccn=(referral)|utmcmd=referral|utmcct=/corporate/privacy-copyright&__utmv=-&__utmk=13927991
If it doesn't, it ain't tracking, and it certainly isn't for me, nor can I see how it possibly could without return false. Adding it fixes it.
Thanks, Jeremy
Comment #3
hass commentedIt's noted in foc that _link delays itself by a fraction of a second. Returning false cause many side effects.
Comment #4
jeremyo commentedHmm, but without it cross-domain tracking doesn't work, which is also pointless.
"Return false;" is only needed within that "if" test, but does it prevent other things that need to be triggered by that click? If so then there is still a bug because it needs to prevent the click from causing the browser to follow the link: it has to override it with the link-tracking URL or it's not working.
Comment #5
jeremyo commentedSorry for reopening this, Hass, but I can't consider it closed. I don't know what you did to try to reproduce the bug but if your own test sites are not set up for cross-domain tracking you can always take a look at mine. If you go to http://www.iwm.org.uk/ and debug the javascript (a little awkward because the JS is aggregated), put a breakpoint at the following line in your code:
Then click the link to "Shop" in the top navigation. You'll see it break on that line but when the link is followed it does not have the query string that is required for cross-domain tracking. If you know of examples where this works I'd be interested to see them. This is fixed by by suggestion, which should have no implications for anything else because it is inside the final "if" statement before a user leaves the website
Comment #6
hass commentedjQuery command for return false is
preventDefault();as I know. http://api.jquery.com/event.preventDefault/Comment #7
hass commentedCould you guys give this patch a try, please?
Comment #8
hass commentedComment #9
hass commentedIt need to be
event.or it has no effect. New patch.Comment #10
hass commentedhttp://drupalcode.org/project/google_analytics.git/commit/9b86c78