5e705ca6bff354acfa0252b9f3d2accd831e21e8 galt Thu Apr 25 15:38:34 2019 -0700 adding googleAnalytics calls to CIRM diff --git src/hg/cirm/gateway/js/cirmStuff.js src/hg/cirm/gateway/js/cirmStuff.js index 1673e98..713dc58 100644 --- src/hg/cirm/gateway/js/cirmStuff.js +++ src/hg/cirm/gateway/js/cirmStuff.js @@ -87,15 +87,31 @@ loginRequest.open("GET", url, true); loginRequest.send(); } else { $("a.login").hide(); } }); // Screw with banner and search box (secure vs not) $(document).ready(function() { if (cirmSiteFunctions.isSecureSite()) { $(".cirm-banner").hide(); $(".securesite-banner").show(); $("#siteSearchBox").hide(); } }); + +// Call googleAnalytics +$(document).ready(function() { + var analyticsKey = "UA-135185279-1"; + if (cirmSiteFunctions.isSecureSite()) { + analyticsKey = "UA-135185279-2"; + } + // should keep in sync with kent/src/hg/lib/googleAnalytics.c + (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', analyticsKey, 'auto'); + ga('require', 'displayfeatures'); + ga('send', 'pageview'); +});