Simplest way to count a PDF hits/downloads? - General Discussions - General Discussions - Progress Community
 General Discussions

Simplest way to count a PDF hits/downloads?

  • Simplest way to count a PDF hits/downloads?
  • I have a PDF on my site and simply want to know how many people have opened (downloaded) it.

     I have it in a documents library, and the page uses the Download List widget to display it on the page.   Thanks!

  • Hello Tom,

    You can use the IMediaContentDownloadedEvent:
    http://docs.sitefinity.com/for-developers-libraries-events#imediacontentdownloadedevent

    You can use the ViewsCount property to keep the values.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • If you aren't comfortable with server side you could use google analytics to trigger an event when the users clicks the download button. 
  • Hello all,

    You can also use a custom field to save the views count, as well. Another option is using analytics as Jonathan suggested. You can also vote for this feature request:
    http://feedback.telerik.com/Project/153/Feedback/Details/99964-views-count-is-not-increasing-with-viewing-the-content-item-on-the-public-site

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Thank you.    I am definitely on the content side and don't know much about the server side.    I know how to tag a link via Google analytics (see below) , but in the Sitefinity download widget where my documents are, there is no html that I can change.  In other words,  I don't know where I would place my code.

    ... onClick="_gaq.push(['_trackPageview'   ...  etc
  • I am using the Download List Widget.

    Widget is "List of Documents for Direct Download"         I don't know about jQuery, but if it's possible and with some guidance,  I can try.    Then I would just include some javascript code in the existing template I'm using??   thank you

  • Hello Tom,

    Which exact widget and widget template you are using? Is it possible to set the click using jQuery on document ready? You can include the javascript in the template.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Hi Tom,

    You can edit the "List of documents for direct download" template and set the following javascript at the bottom:
    <script>
      (function($)
      $(document).ready(function()
        $('.sfdownloadFile').on('click','a', function()
          alert('clicked')
        )
      );
      )(jQuery);
    </script>

    Include jQuery if not included on the page:
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
       
     <sf:ResourceLinks ID="ResourceLinks" runat="server">
         <sf:ResourceFile JavaScriptLibrary="JQuery"></sf:ResourceFile>
     </sf:ResourceLinks>


    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items