d8bf76ed7e182223d91aa19c9655438974b9c8c0
max
  Wed Oct 14 09:22:15 2020 -0700
adding outbound link tracking to hgGene, refs #21916

diff --git src/hg/lib/googleAnalytics.c src/hg/lib/googleAnalytics.c
index 3ef2a5d..f0de9b7 100644
--- src/hg/lib/googleAnalytics.c
+++ src/hg/lib/googleAnalytics.c
@@ -31,31 +31,31 @@
 "  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"
 "  ga('create', '%s', 'auto');\n"
 "  ga('require', 'displayfeatures');\n"
 "  ga('set', 'transport', 'beacon');\n"
 "  ga('send', 'pageview');\n"
 "\n"
 , analyticsKey);
 
 // to reduce the risk of breaking existing click handlers, only track links on hgc and hgTracks pages
 char* scriptName = getenv("SCRIPT_NAME");
 if (!scriptName)
     return;
 
 char* cgiName = basename(scriptName);
-if (sameWord(cgiName, "hgc") || sameWord(cgiName, "hgTracks"))
+if (sameWord(cgiName, "hgc") || sameWord(cgiName, "hgTracks") || sameWord(cgiName, "hgGene"))
 {
     // see https://support.google.com/analytics/answer/1136920?hl=en
     jsInlineF(
     "  function onExtAnchorClick(ev) {\n"
     "  /* user clicked an anchor: if external link, send event to Google analytics and navigate to the link */\n"
     "      var url = ev.currentTarget.href;\n"
     "      var hostname = null;\n"
     "      if (typeof URL===undefined) {\n"
     "          hostname = url.split('//')[1].split('/')[0];\n" // for MSIE
     "      } else {\n"
     "          var urlObj = new URL(url);\n"
     "          hostname = urlObj.hostname;\n"
     "          if (hostname.indexOf('.ncbi.')!==-1)\n" // for NCBI, we keep the first part of the pathname
     "              hostname = hostname+'/'+urlObj.pathname.split('/')[1];\n"
     "      }\n"