【发布时间】:2021-01-15 09:38:53
【问题描述】:
我已经阅读了很棒的教程here。但是,我对 jQuery 的了解为零。我在 ShinyApp 中使用了几个 tabPanel 来显示我的数据。本教程解释了如何跟踪链接点击事件(效果很好,我包含了一个 .js,如教程中所述)。有没有办法跟踪用户是否点击了特定的 tabPanel(例如 Panel1 和 Panel2)?我尝试对引用外部资源的链接做同样的事情,但这不起作用。
tabsetPanel(
tabPanel("Panel1", showOutput("PlotPanel1", 'dimple')),
tabPanel("Panel2", showOutput("PlotPanel2", 'dimple')))
编辑:
我想我必须在我的 analytics.js 文件中包含一些代码。因此我尝试了几件事,但坦率地说,在没有 jQuery 知识的情况下,这是错误的。有人可以帮忙吗?
$( ".selector" ).tabs({
on('option', 'click', function(l) {
ga('send', 'event', 'tabPanel', 'tabPanel', $(l.currentTarget).val());
}
});
谢谢。
【问题讨论】:
标签: javascript jquery r google-analytics shiny