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

hass’s picture

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.

hass’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
hass’s picture

Category: support » bug
Status: Closed (cannot reproduce) » Active
nils.destoop’s picture

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).

hass’s picture

The code worked for past 2 or more years.

hass’s picture

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.

hass’s picture

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.

hass’s picture

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.

hass’s picture