title: Shiny tabPanel and Google Analytics
body: <p>I've read myself through the great tutorial <a href="http://shiny.rstudio.com/articles/google-analytics.html" rel="noreferrer">here</a>. However, my knowledge of jQuery equals to zero. I use several tabPanels in my ShinyApp to display my data. The tutorial explains how to track link-clicking events (which works fine, I included a .js as explained in the tutorial). Is there a way to track if users click on a specific tabPanel (for example <code>Panel1</code> and <code>Panel2</code>)? I've tried to do the same with a link referring to external sources, but that does not work.</p>
  
  <pre><code>tabsetPanel(
  tabPanel("Panel1", showOutput("PlotPanel1", 'dimple')),
  tabPanel("Panel2", showOutput("PlotPanel2", 'dimple')))
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I guess I have to include some code in my analytics.js file. Therefore I tried several things, but frankly without knowledge of jQuery, this is just wrong. Can anyone help here?</p>
  
  <pre><code>$( ".selector" ).tabs({
    on('option', 'click', function(l) {
    ga('send', 'event', 'tabPanel', 'tabPanel', $(l.currentTarget).val());
    }
  });
  </code></pre>
  
  <p>Thanks.</p>