1f0d943be0bcfaaeca78424de9482a4d2cbaf6b0
hiram
  Fri Jun 20 08:01:00 2014 -0700
updated to Universal Analytics code refs #13120
diff --git src/hg/lib/googleAnalytics.c src/hg/lib/googleAnalytics.c
index ae7e409..d165398 100644
--- src/hg/lib/googleAnalytics.c
+++ src/hg/lib/googleAnalytics.c
@@ -11,27 +11,29 @@
 /* check for analytics configuration item and output google hooks if OK */
 {
 static boolean done = FALSE;
 
 if (done)
     return;
 
 done = TRUE;	/*	do not repeat this by mistake	*/
 
 char *analyticsKey = cfgOption("analyticsKey");
 
 /*	if config is missing or empty, nothing happens here	*/
 if (isEmpty(analyticsKey))
     return;
 
-
-hPrintf("\n<script type=\"text/javascript\">\n"
-"var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n"
-"document.write(unescape(\"%%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%%3E%%3C/script%%3E\"));\n"
-"</script>\n"
-"<script type=\"text/javascript\">\n"
-"var pageTracker = _gat._getTracker(\"%s\");\n"
-"pageTracker._initData();\n"
-"pageTracker._trackPageview();\n"
-"</script>\n", analyticsKey);
+/* updated to Universal Analytics code 2014-06-19 */
+
+hPrintf("\n<script>\n"
+"  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n"
+"  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n"
+"  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n"
+"  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n"
+"\n"
+"  ga('create', '%s', 'ucsc.edu');\n"
+"  ga('send', 'pageview');\n"
+"\n"
+"</script>", analyticsKey);
 
 }