ga: convert to "tag manager"

There have been two generations of GA since we first implemented GA on
the website. The newest version allows us to get deeper insights while
collecting less personal data. This version is also faster and loads
async which should help load the &os; website on slower networks.

As a reminder: to opt out do ANY of the following:
- block google.com via an adblocker
- set (abuse) the "do not track" header

In addition we've selected to disable many features in the console that
would result in collecting more data.

With Hat:	webstats@
This commit is contained in:
Eitan Adler 2018-06-08 05:42:14 +00:00
parent e97014062f
commit f0679e836b
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=51804
5 changed files with 25 additions and 66 deletions

View file

@ -1,12 +0,0 @@
# $FreeBSD$
.if exists(../Makefile.conf)
.include "../Makefile.conf"
.endif
.if exists(../Makefile.inc)
.include "../Makefile.inc"
.endif
DATA= google.js
.include "${DOC_PREFIX}/share/mk/web.site.mk"

View file

@ -1,52 +0,0 @@
/* $FreeBSD$ */
/*
* 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 = true;
var allow_track = true;
var h = document.location.hostname;
/*
* 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|google\.com)$/i;
if (typeof navigator.doNotTrack !== "undefined" && (navigator.doNotTrack == "yes" || navigator.doNotTrack == "1")) {
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']);
_gaq.push(['_setAllowHash', false]);
_gaq.push (['_gat._anonymizeIp']);
/*
* 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']);
( 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);
})();
}