The need for tracking direct downloads has arisen for many of us in these short lives of us as web analytics freaks. The forum has many a thread talking about that need, including this thread: 301 Moved Permanently
This thread (that you are currently reading) purports to satisfy the said need.
What is a direct download?
What we call here a direct download is a link that does not appear in a web page as a hyperlink. Put differently, the link below is a direct download IF it appears in an e-mail message (for instance) or if it’s entered by a user in their browser’s URL field or downloaded via a utility (such as wget) or somehow used outside a Web browser.
It is NOT a direct download if it’s part of a normal construct embedded in a web page and accessed using a Web browser.
Down to business
A script for track direct downloads is available in the Download section further down this forum post. It’s based on code from
[li]PHP Download Script with Resume option - Media Division
[/li][li]Tracking API - Analytics Platform - Matomo
[li] the MIME type for PDFs,
[/li][li] Piwik-specific code
[/li][li] several features that we needed
For instructions, read the two sections Installation and Usage on the website.
Click the Support button on the download page specified below. Note that the issue tracker will require you to create a [free] account before you can post a ticket. To create an account, use the Registration link on the right hand side of the header.
A visit tracked with this script won’t be factored in by Piwik when computing a “returning visitor” status. This probably has to do with the fact that the Piwik.js script isn’t running client-side. Hence, the server doesn’t receive some information (e.g. the screen resolution) that is normally provided by the Piwik client script (and that, I suspect, is taken into account in computing the visitor ID). Therefore, the visitor IDs won’t match although it’s actually the same human visitor. It may even be the same browser, OS, IP, etc.
The script can be downloaded using the URL below. An account on the website is not needed. Put differently, just open the page and click Download.
How do we thank you?
We’ve got social networks accounts so follow us! Fear no flooding: the information we’ll post there is mainly update news.
Last edited: 2015-05-11. Rewrote this OP to reflect the current status of this piece of software, specifically to integrate links to a dedicated web page which allows users of the script to get free support.