From 49fd6cb456a8346bcd32bcd14cb2f34d966b80b0 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Tue, 16 Aug 2011 23:19:35 +0000 Subject: [PATCH] Check that the hosting domain is actually a FreeBSD.org domain, so we don't accidentally obtain data from mirrors. Submitted by: eadler (via email) --- en/layout/js/google.js | 46 +++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/en/layout/js/google.js b/en/layout/js/google.js index 7670472160..0a0263c78b 100644 --- a/en/layout/js/google.js +++ b/en/layout/js/google.js @@ -1,22 +1,30 @@ -/* $FreeBSD$ */ +/* $FreeBSD: www/en/layout/js/google.js,v 1.1 2011/08/15 00:30:17 gjb Exp $ */ -var _gaq = _gaq || []; -_gaq.push(['_setAccount', 'UA-22767463-1']); -_gaq.push(['_trackPageview']); -_gaq.push(['_setCustomVar', - 5, // use the last index in case we just don't care ;-) - 'Real Operating System', - navigator.platform, - 1 // Lets track this by 'visitor' (per cookie). If we need more - // fine grained data we could always change it later - ]); +h=document.location.host; +/* + * Check that the hosting domain is actually a FreeBSD.org domain, so + * we don't accidentally obtain data from mirrors. + */ +if (h == "www.freebsd.org" || h == "freebsd.org" || h == "wiki.freebsd.org") { + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-22767463-1']); + _gaq.push(['_trackPageview']); + _gaq.push(['_setCustomVar', + 5, // use the last index in case we just don't care ;-) + 'Real Operating System', + navigator.platform, + 1 // Lets track this by 'visitor' (per cookie). If we need more + // fine grained data we could always change it later + ]); -(function() { - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = 'https://ssl.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(ga, s); -})(); + (function() { + var ga = document.createElement('script'); + ga.type = 'text/javascript'; + ga.async = true; + ga.src = 'https://ssl.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(ga, s); + })(); + +}