5

I have multiple media files in my WordPress Media Library. Icons, Images, PDF's and the like. I would like to have a stat counter, that gives me a statistic of the downloads/hits of those files, individually.

I already use WP SlimStat to track page view, and I am quite happy with it. However, I have not found a possibility to track those media files.

How can I do this?

4

You could use Google Analytics for WordPress. Here's an excerpt from their FAQ on how you could set it to track certain file types:

How can I track downloads? Check the box for "Track outbound clicks & downloads", after that, make sure the file types you want to track are listed in the box of extensions to track as downloads. You’ll find this input field under "Advanced".

| improve this answer | |
  • Thanks, this answers the question. To me however, Google Analystcs is not an option, because it requires the adoption of Google's privacy policy. – Marcel Mar 24 '14 at 7:00
3

Using Google Analytics will only collect clicks on your web pages, it will not count hits from external sites, RSS feeds, apps, etc. For this you'll need to utilise your server log files.

AWStats is good for this but it is overkill for a single file - you'd need to log in, set the timeframe to a large span, then browse for your file... it would be much easier if the WP files admin could check the server logs for definitive all-time hits for each file, but I am yet to find a plugin for this.

| improve this answer | |
  • 1
    I actually use AWStats for now to some degree, but I find it clumsy and inflexible. – Marcel Mar 24 '14 at 7:01
0

If you need to track single file, and you have the URL of the file, and you have the access.log file set up right, then you can just use grep Linux command.

grep "/downloads/my-file-name.media" /var/log/access.log

To get the number of requests

grep -c "/downloads/my-file-name.media" /var/log/access.log or

grep "/downloads/my-file-name.media" /var/log/access.log | wc -l

| improve this answer | |
  • I'm not sure this answer will be useful for the original poster or for others coming across this post - the implied premise of the question is being able to track these downloads through the WP interface. Many WP users will have no idea how to run shell commands - or may not even have shell access. – Tim Malone Apr 15 '16 at 10:30
  • 2
    Sure, I provided this just for the record. Some users of this forum may find this OK. BTW, I fully agree with your feedback. – prosti Apr 15 '16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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