Mostly minor tweaks to google.js:

o Add security/svnweb to regex
o Reorder regex alphabetically
o Add 'freebsd.org' domain name to the GA array
o Add one-line sample code if we ever need/want to track non-FreeBSD.org
  sites
o Add 'page load time' to the GA array
o While here, add more useful comments to the 'custom var' array

Submitted by:		eadler (mostly, original version)
This commit is contained in:
Glen Barber 2011-08-20 23:47:06 +00:00
parent 9c1e2ed82d
commit 9c24e1fdb8
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=37583

View file

@ -1,21 +1,46 @@
/* $FreeBSD: www/en/layout/js/google.js,v 1.5 2011/08/17 13:58:23 gjb Exp $ */
/* $FreeBSD: www/en/layout/js/google.js,v 1.6 2011/08/17 21:40:30 gjb Exp $ */
var h=document.location.host;
/*
* Check that the hosting domain is actually a FreeBSD.org domain, so
* we don't accidentally obtain data from mirrors.
*/
var fbsdregex=/(docs|www|wiki)\.freebsd\.org/i;
var fbsdregex=/(docs|security|svnweb|wiki|www)\.freebsd\.org/i;
if (fbsdregex.test(h)) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22767463-1']);
_gaq.push(['_setDomainName', 'freebsd.org']);
_gaq.push(['_setAllowHash', false]);
/*
* If we ever want to track sites other than FreeBSD.org,
* uncomment the next line.
*/
//_gaq.push(['_setAllowLinker', true]);
// This is what we track
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
_gaq.push(['_setCustomVar',
5, // use the last index in case we just don't care ;-)
/*
* This is the last available 'slot', and can be adjusted
* if needed; 1 through 5 are available, so we can add more
* custom variables if needed.
*/
5,
/*
* This is the custom name to what this custom variable
* will be reported as.
*/
'Real Operating System',
/*
* Try to track what operating systems are used to visit
* the site.
*/
navigator.platform,
1 // Lets track this by 'visitor' (per cookie). If we need more
// fine grained data we could always change it later
/*
* Tracking is done per cookie to try to identify unique
* visitors.
*/
1
]);
(function() {