]> git.donarmstrong.com Git - lilypond.git/commitdiff
issue 4813: replace urchin.js with analytics.js and fix redundant hostnames
authorFederico Bruni <fede@inventati.org>
Fri, 25 Mar 2016 13:54:20 +0000 (14:54 +0100)
committerFederico Bruni <fede@inventati.org>
Thu, 7 Apr 2016 09:03:00 +0000 (11:03 +0200)
This patch aims at fixing two warnings reported by Google Analytics:

1. analytics.js is the new javascript library which replaces urchin.js
2. the website should be available at one hostname only and we chose
   lilypond.org over www.lilypond.org

Documentation/web/server/lilypond.org.htaccess
scripts/build/website_post.py

index c6da26a1bb1ac2d54cd91f32baacc1a6459e1927..29d90284118dd52942e03bcb5d46b69c0ee219b9 100644 (file)
 
 RewriteEngine On
 
+# Permanent redirect from www.lilypond.org to lilypond.org
+RewriteCond "%{HTTP_HOST}" "^www\.(.+)$" [NC]
+RewriteRule "^/?(.*)$"     "http://%1/$1" [R=301,L,NE]
+
 # Deny following of symlinks by robots.
 # HTTrack is a known offender.
 # better yet, to redirect this to page that tells adminstrator
index a6fafdc01251bb38559f84d2dc3c337855881029..9fba75445fd86e0e219fc52a2ba60764972cf495 100644 (file)
@@ -198,12 +198,15 @@ for file in html_files:
         ### add google tracker header
         if (line.find("</head>") >= 0):
             outfile.write("""<!-- Google tracking !-->
-<script src="http://www.google-analytics.com/urchin.js"
-type="text/javascript">
-</script>
-<script type="text/javascript">
-_uacct = "UA-68969-1";
-urchinTracker();
+<script>
+  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+  ga('create', 'UA-68969-1', 'auto');
+  ga('send', 'pageview');
+
 </script>
 """);
         #### add google tracker goals