Click/download count plugin

I need to count downloads of a file from my site.
My basic approach would be to be create a php redirect page to the file and log the info that is interesting to me into a csv: ip,date,referral,link.
I wrote this out to see what others are thinking of the use of this and maybe we would make a plugin that is more usable and comfortable for all.
I would see this integrable into the markdown syntax of grav, if the plugin is installed, links could be written in a way that makes it logged, for example:
{log.csv}[Any clicks on me will be logged!](https://www.google.com)

If you use Grav media handling for your download. Ie, if the file type is already a valid Grav media type (system/config/media.yaml), or you override this file and add your custom file type by adding your own in user/config/media.yaml. You can simply use this format to add a download:

[Any clicks on my will be logged](thefileinquestion.zip)

Then you can create a plugin that uses the onBeforeDownload event to log whatever information you want to a CSV file in the data folder.

There currently is a good example of this as it’s not been asked for before, but it’s very doable if you have some php skills.

Not sure if this approach would do what I would like it to as my files would be hosted at Amazon so I would only have links for download, not the actual files.

You would need to write a custom plugin where you requested a link via some kind of key or hash through Grav. Then Grav could log the ip and ‘stream/download’ the remote file.

Anytime you link directly to an external file, your browser is actually making that external connection and it will not go through Grav at all, and therefore there would be no opportunity to log information.

Yes key/hash based or when I give this {log.csv}[Any clicks on me will be logged!](https://www.google.com) or similar syntax, grav automatically could create a link to its redirecting logger php with the link as a parameter. I find the later the simpler.