我想使用谷歌分析来跟踪我的 R Shiny 应用程序。我关注了这篇文章https://shiny.rstudio.com/articles/google-analytics.html。我知道我应该用 ui.R 创建一个 html。对于 golem 包,将 html 文件放入我的包的 R 文件夹中是否正确?谢谢
嘿嘿
我刚刚在我的傀儡上设置了 Google Analytics:
将 google-analytics.html 文件放入 inst/app/www
在
golem_add_external_resources
中使用app_ui.R
,如下(参见注释行):
golem_add_external_resources <- function() {
add_resource_path(
"www",
app_sys("app/www")
)
tags$head(
includeHTML(app_sys("app/www/google_analytics.html")), # ADD THIS LINE HERE IN YOUR APP
favicon(ext = "png"),
bundle_resources(
path = app_sys("app/www"),
app_title = "My title"
)
)
}