7 Replies Latest reply on Apr 10, 2014 4:27 PM by vince.wruck

    Possible to track downloads via the API?

    vince.wruck

      Hey folks - I noticed that the bunchball module has the capability to recognize download events, but Jive SBS apparently has no out-of-the-box facility for tracking download numbers.  I have done a bit of browsing through the API but can't find any reference to download events. Has anyone looked into download tracking, or have any ideas about how to accomplish it?  Much appreciated!

       

      - Vince

        • Re: Possible to track downloads via the API?
          Ryan Rutan

          To clarify, are you referring to document downloads (i.e. binary) solely, or are you considering Attachments as well?

           

          Also, are you asking for a way to track this programmatically (i.e. at the point of click) or are you looking for a way to generate a report after-the-fact? 

           

          Just want to make sure that I understand what you are asking.  (also buying time to confirm that Downloads aren't tracked, as I have a vague memory that they are in some capacity in our Data Export API)   Jive Developer Series - Exploring the Data Export API

          1 person found this helpful
          • Re: Possible to track downloads via the API?
            whoiskevin

            Downloads (attachments) are tracked.  I was just digging into this the other day.   Take a look at the JiveServlet and you'll see that it triggers a download event.  Document attached binaries have a separate event.  This was from Jive 7

            // fire an attach downloaded event

                        Map<String, Object> map = new HashMap<String, Object>();

                        map.put("downloadCompleted", Boolean.TRUE);

                        map.put("remoteAddress", ActionUtils.getRemoteAddress(request));

                        if (!isAnonymousRequest()) {

                            map.put("downloadingUser", getRequestingUser());

                        }

                        JiveApplication.getContext().getEventDispatcher().fire(new AttachmentEvent(

                                AttachmentEvent.Type.DOWNLOADED, attachment.getAttachmentContentResource(), attachment, map));

                    }

             

            The AttachmentManager also has a download count when you retrieve an attachment related to a piece of content.

             

            Unfortunately I'm not sure this is exposed in any of the existing APIs.

            • Re: Possible to track downloads via the API?
              vince.wruck

              I found the answer to my needs via the activity database dump you can get from the Cloud Admin. I had to request it, and then install PostgreSQL, but with some good tips from Jive Support was able to create a query that exposed downloads and included user information. This process is fine for reporting; if you needed activities triggered via downloads I imagine you would still be looking at using the API. Happy to share aspects of the query I wrote, too, but be forewarned I am a novice (my code isn't pretty).

               

              - Vince