Closed (fixed)
Project:
Google Analytics
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2009 at 01:05 UTC
Updated:
6 Jul 2010 at 13:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
hass commentedSee http://drupal.org/node/342663#comment-1139795 for a workaround.
Comment #2
toodlepip commentedThanks for the reply. The events graph is showing up in the GA account, it's the actual stats. GA is showing 0 events. I have the GA drupal module installed on two different Drupal sites (http://www.chinwag.com and http://www.toodlepip.co.uk) but neither are registering any events. Could it be a Jquery clash?
Thanks for your help, much appreciated.
Comment #3
toodlepip commentedComment #4
hass commentedMake sure you have downloads, email and/or outgoing links tracking enabled. Aside it may take some time after the first event is recorded and until it's shown in the reports... I cannot say how long this might take... try to wait up to 2 weeks.
Comment #5
hass commentedHm... checked your http://www.toodlepip.co.uk site and code is correct... all should work, but I also don't see the Event is firing the tracking out to google if a external link is clicked... I have not tested this with jquery_update... but I'm not aware about jquery functions that have changed. Are you able to test with standard jquery? Could you try to add some console.log() lines to the googleanalytics.js and debug if it jumps in the correct if statement?
Comment #6
hass commentedComment #7
toodlepip commentedHiya hass,
Thanks for the feedback. I've tried adding a few console.log() lines to debug the googleanalytics.js file. It looks like the jquery function to bind the clicks isn't working properly with the new version of jquery. Changing:
$('a', context).click( function() {
to
$('a').click( function() {
seems to do the trick. My Javascript skills aren't so hot, so not sure whether the context field is actually used. Could you advise? I'll try running without the version of the click() function above for a day or so and see if the clicks are tracked properly.
Thanks for your help, any feedback on the above would be ace, thanks.
Comment #8
hass commentedOk, this is good and helpful information.
I need to investigate why this break things, but you can keep it as is now as an interims solution until we found the source of this issue and a fix. No functional problem at all - the context is not really used yet.
Comment #9
hass commentedComment #10
hass commentedI'm moving this to jquery_update for now. Maybe someone from there can help us quickly or at least give a hint what could be broken and how to fix if not a bug in jquery_update.
Comment #11
hass commentedComment #12
hass commentedMarked #368351: Can't get "Track outgoing links" functionality to work as a duplicate.
Comment #13
hass commentedComment #14
hanoiiI just got to this issue after experiencing this behavior. One strange thing is that I have several drupal sites, all with jquery_update and the latest jquery and all of them are working except one, this one.
Now I am not sure the bug goes through jquery_update, can you explain me what context is and how that should be used?
What I can tell is that in the site not working the line:
context = context || document;
Is returning context and then it's not working. If I make that to be just
context = document;
It starts working, which is the same as doing
$('a').click( function() {
as explained in #7,
but if context is not used, and it's making problems, isn't it better to remove it from the google analytics code?
a.=
Comment #15
hanoiiI have just checked the sites that are working and they have an older version of the GA code without the context whatsoever, just as #7. What is this? and is it correctly used?
Comment #16
hass commentedD6 have added
context = context || document;in drupal.js.I've backported this logic to D5 to make the code easier to maintain. See #330616: Allow re-binding click events with AHAH/AJAX why context have been added. I wonder why it is not working on one of your sites, but the others... very strange...
Comment #17
hass commentedCould one of you with the jquery_update installed give this code change together with
$('a', context).click( function() {a try?[googleanalytics.js]
Comment #18
ianchan commentedsubscribe
Comment #19
hass commentedAbove code in #17 has a bug. Please give this new code a try. I think it should work now.
[googleanalytics.js]
Comment #20
hass commentedI tested the changes above on my live site with original jquery and jquery_update and clicks on outgoing links are working for me. I've committed the code to CVS, but I would be happy to get some feedback from you guys if it would also work for you before rolling a new release.
It's very simple to test if you create links with target _blank as it would help you to see that the executed GA request is shown in Firebug pane on the page where you clicked the link. Otherwise you need Firebug history add-on or Fiddler to see the request.
Comment #21
hass commentedComment #23
aiphesi open an issue : http://drupal.org/node/846344 for the 6.x version
Comment #24
aiphes