Download & Extend

Link clicks (example downloads) not beïng tracked

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

Status:active» postponed (maintainer needs more info)

You may have disabled download tracking. Otherwise we need an example site with latest version installed where you think it's not working.

#2

Category:bug report» support request
Status:postponed (maintainer needs more info)» closed (cannot reproduce)

#3

Category:support request» bug report
Status:closed (cannot reproduce)» active

#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

Title:Link clicks (example downloads) not beïng tracked.» Firefox: Link clicks (example downloads) not beïng tracked

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 _trackEvent is 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.

  • 16.0.2
  • 16.0.1
  • 15.0.1
  • 14.0.1
  • 13.0.1
  • 12.0

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

Title:Firefox: Link clicks (example downloads) not beïng tracked» Link clicks (example downloads) not beïng tracked

Chrome seems to have the same issues.

#9

nobody click here