How to keep download statistics?


Anyone has a solution for keeping download statistics (start datetime, end datetime, etc.)?

More or less I already have something for storing statistics, the problems start when you start using download manager as it starts messing everything up. So if anyone has a solution for that, I’ll be grateful.


I also have a similar problem. If anybody could give any idea, it would be very great.

The solution is to let the download link redirect through an action to the real download so that you can increase the counter and let the user download it how he/she wants.

public function actionDownload($file_id) … etc

I’m already using an action for download, and it works if you’re using a native browser download, however download managers make a bunch of call to the action and this corrupts the statistics. I was able to slash it from 4 or more db rows to 2, however this is still not acceptable. But I have a few more ideas so hopefully I will be able to slash it to 1 unique db row.

Sourceforge does not have this problem because their file link redirects to a download action.

Most other download sites does this trick.

You could also pop up a window with the link so that people can use their mass downloaders if they want.

You count in the action, and then open the window with the link.

Maybe you could create a download token which is valid for an amount of time. That would probably prevent multiple hits.

I took a different approach and solved more or less solved this issue. My problem was that I was trying to save statistics right away (saving all info, and then download finished updating finished_on). I’m moved saving after full file was completed and that more or less fixed the problem. There might be a few seconds off for time interval then using download managers, but it’s still better than a bunch of corrupted records.