EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #00419


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Google analytics


On Wed, 2012-04-18 at 12:04 +0100, John Salter wrote:
> If you download 'googleanalyticsformobile.zip' from
>  http://code.google.com/apis/analytics/docs/mobile/download.html, it
>  includes the perl file that is called as the tracking image (/ga.pl).
> This could be hacked into EPrints - not to produce the image (that
>  would be included in an html page), but from a request for a pdf etc.
>  (although I haven't tried any of it!).

Ah, interesting.

In summary, request:
http://www.google-analytics.com/__utm.gif

With a query containing the requested URI and privacy-busting user ids
(*cough*).

This would be trivial to add to EPrints, see:
http://files.eprints.org/587/

/Tim.

> -----Original Message-----
> From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Tim Brody
> Sent: 18 April 2012 11:38
> To: eprints-tech@ecs.soton.ac.uk
> Subject: [EP-tech] Re: Google analytics
> 
> On Wed, 2012-04-18 at 11:56 +1000, Mark Gregson wrote:
> > We also used JS to assign on click event handlers that call GA but we  
> > also extended it to outbound links, which required some changes to the  
> > markup, both in the summary page citation and possibly somewhere in  
> > core code.
> > 
> > Note that this still doesn't track direct non-HTML downloads, e.g., a  
> > link straight to PDF from another website such as Google, because the  
> > JS is never loaded or executed. This can be solved but we didn't like  
> > the possible solutions very much and didn't implement any of them. I  
> > think the best solution comes from  
> > http://code.google.com/apis/analytics/docs/mobile/overview.html which  
> > could probably be called using EPrints triggers.
> 
> Hmm, that still involves a Google-loaded resource, which you can't embed in a PDF?
> 
> Unless you request the image each time yourself ... but that wouldn't allow you to perform an analysis on where users are coming from?
> 
> /Tim.
> 
> > -----Original Message-----
> > From: eprints-tech-bounces@ecs.soton.ac.uk 
> > [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Denis 
> > Pitzalis - STARC
> > Sent: Wednesday, 18 April 2012 5:16 AM
> > To: eprints-tech@ecs.soton.ac.uk
> > Subject: [EP-tech] Re: Google analytics
> > 
> > Kalimera Georgios,
> > 
> > I had the same problem than you and I solved with this javascript 
> > code, it consist in adding an event to every download:
> > 
> > /* ----------------------------------------
> >    Onclick GAv2 Event Generator v1.0
> >    Denis Pitzalis
> >    DP: edit.  01/09/2011
> >    DP: mod. 05/09/2011
> > 
> >    TODO: track unhandled filetype
> > ------------------------------------------- */
> > (function($) {
> >   var doctypes = ["doc","docx","xls","zip","pdf","xlsx","gz","ps","xls"];
> >   var mmtypes = ["wmv","flv","mp3","mp4"];
> >   var imgtypes = ["tif","png"];
> > 
> >   $(document).ready(function() {
> >     $("a").click(function(event){
> >         if($(this).attr("href").length) {
> >             var source = $(this).attr("href");
> >             var extension = source.substr(source.lastIndexOf('.') + 1);
> >             if ( jQuery.inArray(extension,doctypes) > -1 ){
> >                 _gaq.push(['_trackEvent', 'Documents', extension, source]);
> >             } else if ( jQuery.inArray(extension,mmtypes) > -1 ){
> >                 _gaq.push(['_trackEvent', 'MultiMedia', extension, source]);
> >             } else if ( jQuery.inArray(extension,imgtypes) > -1 ){
> >                 _gaq.push(['_trackEvent', 'Images', extension, source]);
> >             } else if ( source.match(/^mailto\:/i) ) {
> >                 _gaq.push(['_trackEvent', 'Mails', "", source]);
> >             } else {
> >             }
> >         }
> >     });
> > });
> > 
> > })(jQuery)
> > /* END Onclick GAv2 Event Generator */
> > 
> > and it works as expected. If it work fine for you too, please tell me!
> > 
> > Denis
> > 
> > 
> > 
> > 
> > On Mon, Apr 16, 2012 at 8:27 PM, Dimitrakakis Georgios 
> > <giorgis@lib.uoc.gr> wrote:
> > > I have applied GA to the template files and indeed is working as 
> > > expected. But I couldn't find a way to track the PDF downloads with 
> > > that. Have you managed to do it? Can you be more specific?
> > >
> > > Regards,
> > >
> > > G.
> > >
> > >> The GA code can go in the template files:
> > >> <archive_id>/cfg/lang/xx/templates/*.xml.  The default template 
> > >> will  ensure the abstract pages are tracked (unless you force SSL) 
> > >> but I would add it to all templates to assist with tracking usage 
> > >> across secure-non secure parts of the site.  Note that GA won't 
> > >> track PDF downloads unless you do some extra work.
> > >>
> > >> Cheers
> > >> Mark
> > >>
> > >> From: eprints-tech-bounces@ecs.soton.ac.uk
> > >> [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of 
> > >> Gaston.Fournier@etsmtl.ca
> > >> Sent: Friday, 13 April 2012 2:24 AM
> > >> To: eprints-tech@ecs.soton.ac.uk
> > >> Subject: [EP-tech] Google analytics
> > >>
> > >> Allo,
> > >>
> > >> I would like to know where (in wich file or files) I should put the 
> > >> code for google analytics?
> > >>
> > >> I would like to have a count with GA when a citation is display! Is 
> > >> this possible?
> > >>
> > >> Thanks,
> > >>
> > >> Gaston Fournier
> > >> Service de la bibliothèque ÉTS
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > >
> > > ----------------------------------------------------------------
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > > *** Options: 
> > > http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> > > *** Archive: http://www.eprints.org/tech.php/
> > > *** EPrints community wiki: http://wiki.eprints.org/
> > >
> > 
> > 
> > 
> > --
> > ----------------------
> > Denis Pitzalis
> > Information Technology Consultant
> > 
> > UNESCO - http://www.unesco.org
> > Paris, France - Tel: +33145681816
> > 
> > Business Strand Coordinator
> > 3D-COFORM - http://www.3dcoform.eu
> > 
> > VAST 2011 - http://www.vast-conference.eu
> > 
> > *** Options: 
> > http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> > *** Archive: http://www.eprints.org/tech.php/
> > *** EPrints community wiki: http://wiki.eprints.org/
> > 
> > *** Options: 
> > http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> > *** Archive: http://www.eprints.org/tech.php/
> > *** EPrints community wiki: http://wiki.eprints.org/
> 
> 
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/

Attachment: signature.asc
Description: This is a digitally signed message part