directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny" <elecha...@gmail.com>
Subject Re: Adding some google analytics to our downloads
Date Wed, 12 Sep 2007 16:08:26 GMT
This is perfect !

let's see what will be the stats starting from today :)

On 9/12/07, Pierre-Arnaud Marcelot <pa@marcelot.net> wrote:
> Hey Guys,
>
> I've prepared a new download page that can be tracked by Google Analytics.
>
> I've re-used the cgi script of the Apache Download Mirrors, the one that is
> used at the moment to download releases.
> But I have used our website template...
> So now, we can track our visitors when they download something and the page
> they get when trying to download something looks exactly the same as our
> website.
>
> It's as easy to use as is the current download system.
> Before, to link a download, you would use this url:
> http://www.apache.org/dyn/closer.cgi/directory/studio/stable/1.0.0/Apache_Directory_Studio_1.0.0_MacOSX.dmg
> Now, you could use this one:
> http://directory.apache.org/studio/download/download.cgi/directory/studio/stable/1.0.0/Apache_Directory_Studio_1.0.0_MacOSX.dmg
>
> (To view the last url properly, you may need to use the proxy
> 140.211.11.10:80, as the page may not be rsynced yet on the website
> mirrors).
>
> WDYT ?
>
> P-A
>
>
>
> On 9/11/07, Emmanuel Lecharny <elecharny@gmail.com> wrote:
> > Thanks Stefano !
> >
> > We will try to add those scripts to our confluenc WIKI.
> >
> > On 9/11/07, Stefano Bagnara <apache@bago.org> wrote:
> > > Emmanuel Lecharny ha scritto:
> > > > Hi,
> > > >
> > > > we can't currently use GA to count the number of server downloads,
> > > > because the link is on a dynamic server (a mirror).
> > > >
> > > > We should create a page where we redirect to these dynamic pages, so
> > > > that we can have a GA count.
> > > >
> > > > Who want to do that ?
> > > >
> > > > Thanks !
> > >
> > >
> > > In Apache JAMES I added a javascript tracking to the download links.
> > > As we generate the pages using maven I added it to our skin.
> > >
> > > Here is the javascript that automatically track every link to gz, bz2,
> > > zip, jar, asc, sar files. Please note that the trackDownloads methods
> > > include the JAMES specific way to find the common part of the path in
> > > mirror strings so that they are rewritten to
> /downloads/relativefilepaths.
> > >
> > > ---------------------
> > > <script type="text/javascript">
> > > if (document.getElementsByTagName) {
> > >   var hrefs = document.getElementsByTagName('a');
> > >   var extensions =
> ["gz","bz2","zip","jar","asc","sar"];
> > >   for (var l = 0; l < hrefs.length; l++) {
> > >     // 0+ is a workaround for download.cgi script by ASF that
> > >     // is not happy with simple words in square brackets
> > >     if (hrefs[0+l] != "") {
> > >       var path = hrefs[0+l].pathname;
> > >       var external = hrefs[0+l].hostname != location.host;
> > >       if (external) {
> > >         var splitted = path.split('.');
> > >         var ext = splitted[0+splitted.length-1];
> > >         for (var e = 0; e < extensions.length; e++) {
> > >           if (extensions[0+e] == ext) {
> > >
> startListening(hrefs[0+l],"click",trackDownloads);
> > >           }
> > >         }
> > >       }
> > >     }
> > >   }
> > > }
> > >
> > > function startListening (obj,evnt,func) {
> > >   if (obj.addEventListener) {
> > >     obj.addEventListener(evnt,func,false);
> > >   } else if ( obj.attachEvent) {
> > >     obj.attachEvent("on" + evnt,func);
> > >   }
> > > }
> > >
> > > function trackDownloads (evnt) {
> > >   var lnk;
> > >   if (evnt.srcElement) {
> > >     var elmnt = evnt.srcElement;
> > >     while (elmnt.tagName != "A") {
> > >       var newelmnt = elmnt.parentNode;
> > >       elmnt = newelmnt;
> > >     }
> > >     lnk = elmnt.hostname + "/" + elmnt.pathname + elmnt.search;
> > >   } else {
> > >     lnk = this.hostname + this.pathname + this.search;
> > >   }
> > >
> > >   var pos = lnk.indexOf("/james/");
> > >   if (pos != -1) {
> > >     lnk = lnk.substr (pos+7);
> > >   }
> > >   lnk = "/downloads/"+lnk;
> > >
> > >   if (typeof(urchinTracker) == "function") {
> > >     urchinTracker(lnk);
> > >   }
> > > }
> > > </script>
> > > ------------------------------------
> > >
> > > Hope this helps,
> > > Stefano
> > >
> > >
> >
> >
> > --
> > Regards,
> > Cordialement,
> > Emmanuel L├ęcharny
> > www.iktek.com
> >
>
>


-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com

Mime
View raw message