6175c83c03b0d6b249b4eef4ed71ecc723f3f54c
max
  Thu Aug 5 08:54:44 2021 -0700
make button click tracking fall back to the id or other button
attributes if name is not set, refs #21916

diff --git src/hg/js/utils.js src/hg/js/utils.js
index c29a20f..aed7558 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -2,30 +2,35 @@
 
 // "use strict";
 
 // Don't complain about line break before '||' etc:
 /* jshint -W014 */
 
 var debug = false;
 
 
 // Google Analytics helper functions to send events, see src/hg/lib/googleAnalytics.c
 
 function gaOnButtonClick(ev) {
 /* user clicked a button: send event to GA, then execute the old handler */
     var button = ev.currentTarget;
     var buttonName = button.name;
+    if (buttonName==="")
+        buttonName = button.id;
+    if (buttonName==="")
+        buttonName = button.value;
+
     ga('send', 'event', 'buttonClick', buttonName);
     if (button.oldOnClick) // most buttons did not have an onclick function at all (the default click is a listener)
         button.oldOnClick(ev);
 }
 
 function gaTrackButtons() {
   /* replace the click handler on all buttons with one the sends a GA event first, then handles the click */
   if (!window.ga || ga.loaded) // When using an Adblocker, the ga object does not exist
       return;
   var buttons = document.querySelectorAll('input[type=submit],input[type=button]');
   for (var i = 0; i < buttons.length; i++) {
        var b = buttons[i];
        b.oldOnClick = b.onclick;
        b.onclick = gaOnButtonClick; // addEventHandler would not work here, the default click stops propagation.
   }