Integrating google analytics and shiny

@ian already gave a detailed response to this, so I just want to add that it's possible to watch only the "var" by passing only the element id to the function instead of the <select> tag, using:

  $(document).on('change', '#var', function(e) {
    ga('send', 'event', 'widget', 'select data', $(e.currentTarget).val());
  });
1 Like