The example of integrating google analytics with Shiny here is confusing: https://shiny.rstudio.com/articles/google-analytics.html
The example said to use the following to create an event to record when the user interacted with the selectInput widget:
$(document).on('change', 'select', function(e) {
ga('send', 'event', 'widget', 'select data', $(e.currentTarget).val());
});
But in the Shiny function, that widget is called "var", as follows:
selectInput("var", "Display",
choices = c(
"Percent of time sunny" = "sun_percent",
"Annual hours of sunshine" = "total_hours",
"Annual clear days" = "clear_days"
)
)
So, where did "select data" come from in the jQuery and/or how does the ga function know to watch the "var" widget for change?