【发布时间】:2022-12-03 16:59:17
【问题描述】:
我正在尝试使用 Matomo 跟踪 R-Shiny 应用程序的选项卡查看。选项卡是使用 tabPanel() 创建的。我还没有找到可行的解决方案。到目前为止,我已经尝试了here和here提到的解决方案。
我试图将其插入服务器:
server <- function(input, output, session) {
...
observe({
if(input$>tabsetPanelid< == ">tabPanelid<") {
HTML("<script>
_paq.push(['trackPageView']);
_paq.push(['setDocumentTitle', '>test<']);
</script>")
}
})
...
}
我试着在用户界面中插入这个:
ui <- fluidPage(
...
tags$script(
HTML(
"$(document).on('click', '>tabPanelid<', function(e) {
ga('send', 'event', 'TabsetPanel', 'Tab Viewed', $(this).attr('data-value'));
});"
)
),
...
)
【问题讨论】:
标签: google-analytics shinydashboard shinyjs matomo event-tracking