Media Section - Download Portal - Keep track of downloads
Hi all,
I'm trying to build a download portal in umbraco. The setup is that a map in the media section gets shown on the front end where the user can navigate. On click on a file (eg a pdf file) the file should be downloaded. My question is, is there a way , native to umbraco, that i can keep track of how many times this file is downloaded? I was thinking to add a property to the file type that gets updated on every download?
Every train of thinking, any help is greatly appreciated!
Here is how I would tackle this! I would add a row to the images with the total downloads like you suggested. I would then update this by passing the id of the media item to the front end, then on click (of the download), I would run an ajax request pointing to a controller which would add to this item where the id (that was clicked) is equal to the media item.
I have done it both ways, Lewis's and Paul's. I guess it matters what you plan on doing with the count's. If you are going to reuse it somewhere in your application it is easier if you are just using the controller and Ajax request to store it in your database. This way you wouldn't have to go fetch it from Google's API.
would also suggest using the Google Analytics way or track it in your own table.
Wouldn't touch the media table itself and also would use a property on the media type itself. The last one could decrease performance and also blaot your DB.
Media Section - Download Portal - Keep track of downloads
Hi all,
I'm trying to build a download portal in umbraco. The setup is that a map in the media section gets shown on the front end where the user can navigate. On click on a file (eg a pdf file) the file should be downloaded. My question is, is there a way , native to umbraco, that i can keep track of how many times this file is downloaded? I was thinking to add a property to the file type that gets updated on every download?
Every train of thinking, any help is greatly appreciated!
Hi Stefan,
Here is how I would tackle this! I would add a row to the images with the total downloads like you suggested. I would then update this by passing the id of the media item to the front end, then on click (of the download), I would run an ajax request pointing to a controller which would add to this item where the id (that was clicked) is equal to the media item.
Thanks, Lewis
Hi Stefan
You could track this in Google Analytics. You can create an event which fires when anyone clicks the link.
Here's a simple example of when I did it:
http://www.codeshare.co.uk/ga
Cheers
Paul
Hi Stefan,
I have done it both ways, Lewis's and Paul's. I guess it matters what you plan on doing with the count's. If you are going to reuse it somewhere in your application it is easier if you are just using the controller and Ajax request to store it in your database. This way you wouldn't have to go fetch it from Google's API.
Otherwise either way is fine.
Hi Stefan,
would also suggest using the Google Analytics way or track it in your own table. Wouldn't touch the media table itself and also would use a property on the media type itself. The last one could decrease performance and also blaot your DB.
Regards David
thanks for all the help! Both solutions seem very fine, gonna go with Paul to keep it all clean! thx all
is working on a reply...