+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Simplest way to count a PDF hits/downloads?

Simplest way to count a PDF hits/downloads?

8 posts, 0 answered
  1. Tom
    Tom avatar
    24 posts
    Registered:
    10 May 2013
    29 Oct 2015
    Link to this post

    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!

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    04 Nov 2015
    Link to this post
    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
     
  3. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    05 Nov 2015
    Link to this post
    If you aren't comfortable with server side you could use google analytics to trigger an event when the users clicks the download button. 
  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    05 Nov 2015
    Link to this post
    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
     
  5. Tom
    Tom avatar
    24 posts
    Registered:
    10 May 2013
    05 Nov 2015 in reply to Jonathan
    Link to this post
    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
  6. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    06 Nov 2015
    Link to this post
    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
     
  7. Tom
    Tom avatar
    24 posts
    Registered:
    10 May 2013
    06 Nov 2015 in reply to Nikola Zagorchev
    Link to this post

    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

  8. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    12 Nov 2015
    Link to this post
    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
     
8 posts, 0 answered