Posted by zuuperman on November 9, 2012 at 12:22pm
2 followers
Jump to:
| Project: | Google Analytics |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
When i enable the download tracking, the downloads are not logged to analytics.
After some debugging i discovered that the click event ($(document.body).click(function(event) {) is not called, when clicking on a link.
Tested this in firefox.
Comments
#1
You may have disabled download tracking. Otherwise we need an example site with latest version installed where you think it's not working.
#2
#3
#4
Download tracking is enabled.
If i changed code to:
$('a').click(function(event) {
// Catch the closest surrounding link of a clicked element.
//$(event.target).closest("a,area").each(function() {
Then everything is working.
This means the listener on links is working, but a listener on document.body is not working (if a link was clicked).
#5
The code worked for past 2 or more years.
#6
This issue is reproducible under Firefox, Chrome works. I can confirm that the tracking pixel is not send to Google in Firebug. The reason seems not the JavaScript itself. With an console.log() I see that all code runs correctly. Only the
_trackEventis not executed or at least it has not enough time to load before an PDF is opened in the same window.Looks like a duplicate of #1580144: Links not tracked in some browsers as jquery click event exits before tracking code finishes.
#7
Tested Firefox with TXT and PDF (both are not tracked). Tested with MSI download (works). It looks like, if the browser is able to open the download itself internally - tracking fails. If a download/save dialog appears - tracking works.
Your change to A element is invalid and will cause slow unbinding issues, see #336924: Massive page rendering slowdown with many links. Additional it also does not help anything here.
#8
Chrome seems to have the same issues.
#9
#1580144: Links not tracked in some browsers as jquery click event exits before tracking code finishes