First of all, I'm guessing that this is something I'm doing wrong as opposed to there being a problem with the code. See below for the steps I've taken to investigate the problem - I'm now stuck and don't know where to go next. If anyone could point me in the right direction as to how to continue investigating this problem, then I'd be very grateful.
I've been trying to track external link clicks as events but am not having any luck. The /admin/settings/googleanalytics screen is configured thus:
- Google analytics account number is correct (normal page hits are being tracked, no problem)
- Users cannot control whether they are tracked or not
- All roles selected for tracking (this is not my normal configuration, but I thought it would aid debugging to check all these)
- Add to every page except the listed pages. (admin, admin/*, user/*/*, node/add*, node/*/*)
- No segmentation information selected
- All "Link tracking settings" checkboxes checked
- Latest (ga.js) tracking code
- I have tried selecting both "header" and "footer" in the Javascript code select list
My knowledge of JQuery is non-existant (I'm currently trying to learn) but need to get the event tracking switched on sooner rather than later. When I refresh the page and set a breakpoint in the javascript using Venkman, I see that Drupal.gaTrackerAttach = function(context) { is entered and context = context || document; is reached. After that, no breakpoints I set within $('a', context).click( function() { are reached.
By the looks of the code, the a tags in the page are altered dynamically. I have tried looking at the HTTP headers using HttpFox but can't see any HTTP requests that look like they are tracking the outgoing link that I am clicking.
Thanks in advance for your help,
Steve
Comments
Comment #1
hass commentedVery good analysis and details... :-)
Do you have jquery_update installed? See #356766: Faulty Drupal.gaTrackerAttach init prevents click tracking (with jquery_update only). Please also provide a link to your site...
Comment #2
stevenghines commentedThank you!! Thank you!! Thank you!!! I think it's working.
I made the change to the selector code in the googleanalytics.js file as suggested in the bug you referred to in your answer, and I'm now getting a call made to the google servers as soon as I click! My website is http://www.mumsrock.com, and example of an external link can be seen on http://www.mumsrock.com/forums/anything-goes/cool-stuff-from-the-web
Thanks again for the help - I'll keep the change in my google analytics module code for now and watch out for any module updates that might address this problem.
Comment #3
hass commentedGood, I mark this a duplicate for now... maybe you can subscribe to the #356766: Faulty Drupal.gaTrackerAttach init prevents click tracking (with jquery_update only) thread :-)
Comment #4
jumpfightgo@groups.drupal.org commentedI'm having this problem with 6.x-2 as well.
Outgoing, downloads, and mailto links all are being captured by analytics as visitors but the page views are not being captured at all.
As I'm using 6.9 I'm not sure how the Selector $('a', context) applies...
Comment #5
hass commentedSetting back. Do not hijack cases, please. Open a new one and EXPLAIN all details and provide the live URLs. Outgoing, downloads, and mailto links are events. One click, one count up.