Hi,

I think the download bitstream is not recorded by google-analytics in 
dspace version 5.5. in GoogleRecorderEventListener.java. We could fix that 
by adding a "User-Agent" to the header.



 private void bitstreamDownload(UsageEvent ue) throws IOException {
        HttpPost httpPost = new HttpPost(GoogleURL);

        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("v", "1"));
        nvps.add(new BasicNameValuePair("tid", analyticsKey));
        nvps.add(new BasicNameValuePair("cid", "999"));
        nvps.add(new BasicNameValuePair("t", "event"));
        nvps.add(new BasicNameValuePair("dp", 
ue.getRequest().getRequestURI()));
        nvps.add(new BasicNameValuePair("ec", "bitstream"));
        nvps.add(new BasicNameValuePair("ea", "download"));
        StringEntity entity = new UrlEncodedFormEntity(nvps);
       * entity.setContentType(new BasicHeader("User-Agent",* "BIBSYS 
Brage"));
        httpPost.setEntity(entity);

        try (CloseableHttpResponse response2 = 
httpclient.execute(httpPost)) {
            // I can't find a list of what are acceptable responses, so I 
log the response but take no action.
            log.debug("Google Analytics response is " + 
response2.getStatusLine());
        }

        log.debug("Posted to Google Analytics - " + 
ue.getRequest().getRequestURI());
    }

Just in case you still have that issue.

best regards
Gregor


Gregor Gabriel

Senior Engineer

Abelsgt. 5, 7491 Trondheim, Norway

www.bibsys.no



Am Donnerstag, 19. November 2015 00:04:18 UTC+1 schrieb Susan Borda:
>
> Great thank you! So maybe I’m not going crazy. I posted this to 
> dspace-tech as well to see if anyone else is getting 0 downloads.
>
> -susan
> — 
> Susan Borda
> Digital Technologies Development Librarian
> Montana State University Library
> 406-994-1873
>
>
>
> From: Andrea Schweer <[email protected] <javascript:>>
> Date: Wednesday, November 18, 2015 at 4:00 PM
> To: Susan Borda <[email protected] <javascript:>>, "
> [email protected] <javascript:>" <[email protected] 
> <javascript:>>
> Subject: Re: [dspace-community] google-stats File Downloads
>
> Hi again,
>
> actually it looks like what you're seeing may be a general problem with 
> google-stats (especially if you can verify that GA has the data, it's just 
> not shown). See this Jira issue: https://jira.duraspace.org/browse/DS-2899
>
> I guess another useful data point would be for someone else who's using 
> google-stats to confirm that they're seeing non-zero numbers for bitstream 
> downloads.
>
> cheers,
> Andrea
>
> On 19/11/15 10:47, Andrea Schweer wrote:
>
> Hi Susan,
>
> the page you link to just describes how to integrate the display of GA 
> stats into DSpace. I believe for you, something is going wrong with the 
> data capture side of things. Your customisation in item-view.xsl should no 
> longer be necessary since the server-side download tracking should now be 
> in place (assuming you've set your GA key correctly in dspace.cfg). The 
> server-side download tracking records the events in the same way as the 
> display expects (at least that's what I believe, I'm not using the 
> google-stats aspect myself). Having the item-view tracking like you 
> explained won't screw things up, it will just double up on some of the 
> figures.
>
> However, since you say your display shows 0 downloads, something must be 
> going wrong with the server-side download tracking. Again this is probably 
> more suitable for dspace-tech, and it's also starting to get beyond what I 
> can help with in the time I have. But if I were you I'd start by checking 
> how the events come through in your GA data, using the GA web interface. I 
> can see this under Behaviour -> Events -> Overview. At the bottom of that 
> page, I can get a list of event categories and of event actions. As 
> explained in my previous e-mail, the google-stats code looks at category = 
> bitstream and action = download. Check whether you have any data for that 
> combination. If you don't then something is going wrong with your data 
> capture. If you do have data for that combination then something is going 
> wrong with displaying the information. If the problem is with capturing the 
> data, try changing your item-view customisation to use category = bitstream 
> and action = download. 
>
> cheers,
> Andrea
>
> On 19/11/15 10:25, Borda, Susan wrote:
>
> Hi-
> We followed these instructions to enable Google Analytics in Dspace:
>
> https://wiki.duraspace.org/display/DSDOC5x/DSpace+Google+Analytics+Statistics
>
> Is there something else we need to do to enable the downloads portion or 
> is our customization in the item-view.xsl screwing things up? 
>
> Thanks,
> s
> — 
> Susan Borda
> Digital Technologies Development Librarian
> Montana State University Library
> 406-994-1873
>
>
>
> From: Andrea Schweer < <javascript:>[email protected] <javascript:>>
> Date: Wednesday, November 18, 2015 at 12:45 PM
> To: Susan Borda < <javascript:>[email protected] <javascript:>>, "
> [email protected] <javascript:>" <[email protected] 
> <javascript:>>
> Subject: Re: [dspace-community] google-stats File Downloads
>
> Hi Susan,
>
> On 18/11/15 09:28, Borda, Susan wrote:
>
> Hi again-
> We were tracking file downloads via Google Analytics starting in 10/2014 
> up until 06/2015, but our “File Downloads” in “google-stats" are showing 0 
> for all months including those when we were tracking. 
>
> http://scholarworks.montana.edu/xmlui/handle/1/2999/google-stats
>
> According to Google Analytics we should have 464 downloads during that 
> time. Should “google-stats” be able to pull that data from Google Analytics 
> just like it does for “Page Views” or is something not enabled correctly 
> with Google stats in our Dspace instance?
>
>
> From your other e-mail, it looks like you're using custom code to track 
> downloads. I'd guess that your custom code sends the download events in a 
> slightly different way from what the google-stats aspect expects. 
>
> This is probably starting to get into dspace-tech territory, but you can 
> see the query that's built for bitstream downloads here: 
> https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/google/GoogleQueryManager.java#L43
> :
> ga:eventCategory==bitstream;ga:eventAction==download;ga:pagePath=~"+ 
> handle + "/"
>
> So it looks like this is looking for events with a category of "bitstream" 
> and action of "download" on the current page. Your custom code from your 
> other e-mail sends
>
> onclick="ga('send', 'event', 'File Downloads', 'Click', 'View/Open');”
>
> I'm guessing "File downlaods" is the category and "Click" the action, so 
> there's a mismatch right there -- Google Analytics doesn't "know" that 
> these are the same thing.
>
> cheers,
> Andrea
>
> -- 
> Dr Andrea Schweer
> IRR Technical Specialist, ITS Information Systems
> The University of Waikato, Hamilton, New Zealand
> +64-7-837 9120
>
>
> -- 
> Dr Andrea Schweer
> IRR Technical Specialist, ITS Information Systems
> The University of Waikato, Hamilton, New Zealand
> +64-7-837 9120
>
>
> -- 
> Dr Andrea Schweer
> IRR Technical Specialist, ITS Information Systems
> The University of Waikato, Hamilton, New Zealand
> +64-7-837 9120
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to