Copied to clipboard

Flag this post as spam?

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


  • Naveed Ali 161 posts 426 karma points
    May 31, 2016 @ 14:26
    Naveed Ali
    0

    API Call

    Hi,

    I am trying to capture a media ID, once a member clicks on a PDF download link, and store this information in a database.

    Is this at all possible??

    using Umbraco 7.2

    My approach was to have a jquery or something onclick function on my view which triggers a API method which stores the media ID??

    Is this a correct approach or is there a better way to this

    I cannot find any sort of information on someone doing this before so any help is appreciated

    Thanks

    Nav

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 31, 2016 @ 20:03
    Jan Skovgaard
    0

    Hi Naveed

    I think I would use the same approach as you describe above. On the link for the PDF I would probably add a data-mediaid attribute, which can be used to hold the reference for the media id and then hook into the link when it's clicked to for instance make an ajax call to a service, which can accept the id and store it in a database.

    Are you going to save the information in a custom database table or what is the intention? Or could it be good enough for you to use Google analytics for capturing this? What is your scenario for needing to store this information? :)

    /Jan

  • Naveed Ali 161 posts 426 karma points
    Jun 01, 2016 @ 07:44
    Naveed Ali
    0

    Hi Jan,

    I would be using a custom database table.

    Sorry do you know how I would add a data-media id attribute?

    Fairly new to umbraco so still finding my way

    Thanks

    Nav

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 01, 2016 @ 14:22
    Jan Skovgaard
    0

    Hi Naveed

    No need to be sorry - We've all been there and I could just have explained what I meant in more detail :)

    I'm actually "just" thinking of a standard data-* attribute in HTML where you can store the media id on your download link like

    <a href="linktomedia" data-media="7829">Download my PDF</a>
    

    Then you can capture the click event and update the database using an ajax call for instance - Does that make sense? :) This is just meant as a rough sketch to give you some inspiration about how you can approach it.

    Cheers, Jan

Please Sign in or register to post replies

Write your reply to:

Draft