Add javascript to the www/ tree for Google Analytics.

This will also be active on the doc/ tree once we're sure there are no
problems.

PR:		159634
Submitted by:	eadler
This commit is contained in:
Glen Barber 2011-08-15 00:30:17 +00:00
parent 5a3e3c0bc1
commit 5224f14211
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=37554
3 changed files with 27 additions and 3 deletions

View file

@ -4,7 +4,7 @@
<!ENTITY title "The FreeBSD Project">
]>
<!-- $FreeBSD$ -->
<!-- $FreeBSD: www/en/index.xsl,v 1.172 2011/06/12 08:45:47 simon Exp $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
@ -44,6 +44,7 @@
<link rel="stylesheet" media="screen" href="&base;/layout/css/fixed.css?20060509" type="text/css" title="Normal Text" />
<link rel="alternate stylesheet" media="screen" href="&base;/layout/css/fixed_large.css" type="text/css" title="Large Text" />
<script type="text/javascript" src="&base;/layout/js/styleswitcher.js"></script>
<script type="text/javascript" src="&base;/layout/js/google.js"></script>
<link rel="alternate" type="application/rss+xml"
title="FreeBSD Project News" href="&base;/news/rss.xml" />
<link rel="alternate" type="application/rss+xml"

View file

@ -1,4 +1,4 @@
# $FreeBSD: www/en/gifs/Makefile,v 1.53 2005/05/08 15:49:57 murray Exp $
# $FreeBSD: www/en/layout/js/Makefile,v 1.1 2005/10/04 05:49:13 murray Exp $
.if exists(../Makefile.conf)
.include "../Makefile.conf"
@ -7,6 +7,7 @@
.include "../Makefile.inc"
.endif
DATA= styleswitcher.js
DATA= google.js \
styleswitcher.js
.include "${WEB_PREFIX}/share/mk/web.site.mk"

22
en/layout/js/google.js Normal file
View file

@ -0,0 +1,22 @@
/* $FreeBSD$ */
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);
})();