[EP-tech] Re: Google analytics

Tim Brody tdb2 at ecs.soton.ac.uk
Wed Apr 18 11:37:54 BST 2012


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 at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Denis Pitzalis - STARC
> Sent: Wednesday, 18 April 2012 5:16 AM
> To: eprints-tech at 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 at 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 at ecs.soton.ac.uk
> >> [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of
> >> Gaston.Fournier at etsmtl.ca
> >> Sent: Friday, 13 April 2012 2:24 AM
> >> To: eprints-tech at 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/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20120418/fd0fd744/attachment.bin 


More information about the Eprints-tech mailing list