One of the most important metrics for the publications database I'm working on will be file downloads, looked at in various combinations with things like publication type, date published, etc. With the system I'm migrating from, I parse the server logs with a python script, and then reconstructing information about publication type, etc. is time consuming or impossible. Google analytics doesn't work because a lot of the file downloads come from direct requests to the file, not via the page itself.

My hope is that with drupal's private file system, the system should know about and be able to send to google analytics (or some other counter failing that), information about all file downloads in that private file system. Ideally it would carry with it information on the node that the file is attached to, making it much easier to look at, for example, the number of journal article downloads for material published in FY2015.

I'm fairly new to drupal, and honestly I'm so tied up with other parts of the build that I haven't been able to do much to dig into this yet, beyond searching here and on google a number of times. My searches so far have been fruitless, so I'm trying to find out whether I need to try to make sure enough detail is implicit in the file system to allow me to parse the log files better.

Can anyone help me figure out how counting file download statistics can be accomplished without relying on server logs? I'm happy to explore modules, my initial thought was that the google analytics module might take care of that on its own, but I realized it still relies on someone clicking a link.

I should mention that I am using the media and file_entity module.

  • Question's title and body doesn't quite match. Title is primarily opinion based (each have his own definition of "good"), and in body you didn't say what have you tried so far and what's your exact problem.
    – Mołot
    Feb 4, 2016 at 0:18
  • Thanks Molot, will revise, I was trying to keep the question brief
    – UltraBob
    Feb 4, 2016 at 0:19
  • Brief is good, but consistent and complete is way better. You wouldn't want people to give you answers you've already tried and found not suited for your situation. Waste of time for you and for them.
    – Mołot
    Feb 4, 2016 at 0:20
  • @Mołot I've edited it.
    – UltraBob
    Feb 4, 2016 at 0:31

1 Answer 1


Give these modules a try

Download Count

The download_count module tracks downloads of private files attached to nodes via the core upload or contributed filefield modules for d6 and private core file fields for d7.

File download count

An API for tracking file downloads. Recommended use is by using file_entity's file/[file:fid]/download callback page. Basically the difference between this and other file download tracking modules is this module does not intend to track every single time the file is viewed. It only wants to track when a file is actually triggered for download. It is up to the site to implement links to the file download URL.

AJAX Download Counter

This module uses AJAX to count file downloads. It's optimized for medium to large sites (such as my own site, OpenGameArt.org) where the total number of file downloads might be in the hundreds of thousands or even millions. Using this module has some advantages and some limitations versus other methods of counting downloads:

  • Thanks @nosssweat, without documentation for that module it is a little hard to tell, so I'll try and install it and have a look. From first glance, it seems not to have the content type the file is associated with and the blocks it created seemed to be a little sparse. It could be the starting point for a more in depth custom module too though I guess. I'll certainly have a look. Thanks!
    – UltraBob
    Feb 4, 2016 at 2:09
  • @UltraBob, ugh... can't believe there is zero documentation for Download Count, not even a readme.txt. I found 2 other modules, updated my answer.
    – No Sssweat
    Feb 4, 2016 at 2:33
  • just checked and the other 2 modules don't have documentation either, well hopefully they are easy to figure out.
    – No Sssweat
    Feb 4, 2016 at 2:38
  • 1
    I did get out of the File download count that it is using the file_download() callback. If none of these work, it may be that I need to look at that callback as a starting point for developing my first contrib module.
    – UltraBob
    Feb 4, 2016 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.