I maintain the Google Analytics file and must approve changes.

This should have been here since it was committed.

Implement DNT checks

Make enable/disabling the flip of an obvious switch.

Remove pointless custom variable (it doesn't work anyways)

Fix some style errors

Add a file allowing Google to verify that I "control" freebsd.org

Reviewed by:	doceng (gjb)
Approved by:	bcr (mentor)
This commit is contained in:
Eitan Adler 2012-12-05 01:43:27 +00:00
parent fee415d036
commit f5c4c5d41c
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=40269
2 changed files with 21 additions and 28 deletions

View file

@ -1,13 +1,28 @@
/* $FreeBSD$ */
//var h=document.location.host;
var h=null;
/*
* Please do not commit to this file without receiving review from
* webstats@FreeBSD.org.
*/
/* Teach jslint the appropriate style rules. */
/*jslint browser:true*/
var enable_ga = false;
var allow_track = true;
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|security|svnweb|wiki|www)\.freebsd\.org/i;
if (fbsdregex.test(h)) {
var fbsdregex = /(docs|security|svnweb|wiki|www)\.freebsd\.org/i;
if (window.navigator.doNotTrack === "yes") {
allow_track = false;
}
if (enable_ga && allow_track && fbsdregex.test(h)) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22767463-1']);
_gaq.push(['_setDomainName', 'freebsd.org']);
@ -20,31 +35,8 @@ if (fbsdregex.test(h)) {
// This is what we track
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
_gaq.push(['_setCustomVar',
/*
* 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,
/*
* Tracking is done per cookie to try to identify unique
* visitors.
*/
1
]);
(function() {
( function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;

View file

@ -0,0 +1 @@
google-site-verification: google6bb24ed0b804d5e9.html