aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2018-06-20 01:07:56 +0000
committerEitan Adler <eadler@FreeBSD.org>2018-06-20 01:07:56 +0000
commit798defac47b1517f0d3b1118e7ab2c7c2f876b6e (patch)
treed0201626fecaa481886cb0c7106d1a33009b143f
parent3f2fa17b24fd573b1a1905fc2dd780584f203309 (diff)
downloaddoc-798defac47b1517f0d3b1118e7ab2c7c2f876b6e.tar.gz
doc-798defac47b1517f0d3b1118e7ab2c7c2f876b6e.zip
stats: revert r51804
Due to incomplete testing I hadn't noticed that this actually generated "&amp;&amp;" rather than "&&" in the output. Revert for now while I solicit some help getting this done right.
Notes
Notes: svn path=/head/; revision=51888
-rw-r--r--en_US.ISO8859-1/htdocs/layout/Makefile1
-rw-r--r--en_US.ISO8859-1/htdocs/layout/js/Makefile12
-rw-r--r--en_US.ISO8859-1/htdocs/layout/js/google.js52
-rw-r--r--share/xml/header.ent25
-rw-r--r--share/xml/xhtml.xsl1
5 files changed, 66 insertions, 25 deletions
diff --git a/en_US.ISO8859-1/htdocs/layout/Makefile b/en_US.ISO8859-1/htdocs/layout/Makefile
index 642cb64803..e468f29618 100644
--- a/en_US.ISO8859-1/htdocs/layout/Makefile
+++ b/en_US.ISO8859-1/htdocs/layout/Makefile
@@ -9,5 +9,6 @@
SUBDIR= css
SUBDIR+= images
+SUBDIR+= js
.include "${DOC_PREFIX}/share/mk/web.site.mk"
diff --git a/en_US.ISO8859-1/htdocs/layout/js/Makefile b/en_US.ISO8859-1/htdocs/layout/js/Makefile
new file mode 100644
index 0000000000..44396793aa
--- /dev/null
+++ b/en_US.ISO8859-1/htdocs/layout/js/Makefile
@@ -0,0 +1,12 @@
+# $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"
diff --git a/en_US.ISO8859-1/htdocs/layout/js/google.js b/en_US.ISO8859-1/htdocs/layout/js/google.js
new file mode 100644
index 0000000000..d6aac94338
--- /dev/null
+++ b/en_US.ISO8859-1/htdocs/layout/js/google.js
@@ -0,0 +1,52 @@
+/* $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);
+
+ })();
+
+}
+
diff --git a/share/xml/header.ent b/share/xml/header.ent
index f4662c1448..feeaba3150 100644
--- a/share/xml/header.ent
+++ b/share/xml/header.ent
@@ -21,33 +21,10 @@
<!-- Standard headers and footers -->
-<!--
- Owned by webstats@
- Check that the hosting domain is actually a FreeBSD.org domain, so
- we do not accidentally obtain data from mirrors.
- -->
<![%html.header.script.google;[
-<!ENTITY header1.googlejs "
-<script xmlns='http://www.w3.org/1999/xhtml'>
-var allow_track = true; var h = document.location.hostname;
-var fbsdregex = /((docs|security|svnweb|wiki|www)\.freebsd\.org|google\.com)$/i;
-
-if (typeof navigator.doNotTrack !== 'undefined' &amp;&amp; (navigator.doNotTrack == '1')) {
- allow_track = false;
-}
-if (allow_track &amp;&amp; fbsdregex.test(h)) {
-(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
-new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
-j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=
-'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
-})(window,document,'script','dataLayer','GTM-PXRWZVR');}
-</script>">
-<!ENTITY header1.googleiframe '
-<noscript xmlns="http://www.w3.org/1999/xhtml"><iframe xmlns="http://www.w3.org/1999/xhtml" src="https://www.googletagmanager.com/ns.html?id=GTM-PXRWZVR" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
-'>
+<!ENTITY header1.googlejs '<script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript" src="&enbase;/layout/js/google.js"></script>'>
]]>
<!ENTITY header1.googlejs ''>
-<!ENTITY header1.googleiframe ''>
<!ENTITY header2.logo-red.label '<h2 xmlns="http://www.w3.org/1999/xhtml" class="blockhide">Header And Logo</h2>'>
diff --git a/share/xml/xhtml.xsl b/share/xml/xhtml.xsl
index 88bc1196e1..d37badfdb0 100644
--- a/share/xml/xhtml.xsl
+++ b/share/xml/xhtml.xsl
@@ -49,7 +49,6 @@
</head>
<body>
- &header1.googleiframe;
<div id="containerwrap">
<div id="container">
&header2;