Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan Verdonschot Van Elsen 5 posts 95 karma points
    Oct 31, 2017 @ 14:31
    Stefan Verdonschot Van Elsen
    0

    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!

  • Lewis Smith 211 posts 620 karma points c-trib
    Oct 31, 2017 @ 14:39
    Lewis Smith
    1

    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

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Oct 31, 2017 @ 16:56
    Paul Seal
    100

    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

  • Charles R. Matvchuk 18 posts 124 karma points
    Oct 31, 2017 @ 17:08
    Charles R. Matvchuk
    1

    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.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Nov 01, 2017 @ 12:01
    David Brendel
    1

    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

  • Stefan Verdonschot Van Elsen 5 posts 95 karma points
    Nov 06, 2017 @ 09:57
    Stefan Verdonschot Van Elsen
    0

    thanks for all the help! Both solutions seem very fine, gonna go with Paul to keep it all clean! thx all

Please Sign in or register to post replies

Write your reply to:

Draft