Piwik should automatically track clicks on Download files (with a known extension, eg. jpg, png, exe, zip, etc.) and clicks on Outlinks (links to other websites) using Javascript click handlers. There are a few reasons why this could fail:

  • Conflicting Javascript code
    In some rare cases, Download and Outlink tracking doesn’t work in Piwik is because your page is using another Javascript script or library which sets click handlers as well. If a third-party click handler returns a value, it is causing the browser to cancel other registered click handlers. Instead they should return false. Most scripts and libraries are doing it correctly, but you might have to manually edit your Javascript code to return false in onclick events.
  • Piwik doesn’t respond fast enough and user is redirected to the click target
    Piwik click handler works by adding a small delay during which the request is sent to the Piwik server. If somehow the request doesn’t reach the server within this delay, the request will be not be tracked and the user will be redirected to the clicked download file or to the external website. You can increase this delay, from the default of 500ms (0.5 second), by adding the following in the Javascript code, after the piwik.getTracker(..) line:

    _paq.push([‘setLinkTrackingTimer’, 750]); // increase to 750 milliseconds

  • You’re using Safari, Chrome, or some other WebKit-based browser.
    There is a known WebKit bug (feature?) that interrupts the tracking request. One workaround is to add the target=”_blank” attribute to anchor elements.

Any questions?

Many answers and more information about Piwik You can find here:

We are social

Follow us: