在 golem 包下使用 Google Analytics 来打造闪亮的应用程序

问题描述 投票:0回答:1

我想使用谷歌分析来跟踪我的 R Shiny 应用程序。我关注了这篇文章https://shiny.rstudio.com/articles/google-analytics.html。我知道我应该用 ui.R 创建一个 html。对于 golem 包,将 html 文件放入我的包的 R 文件夹中是否正确?谢谢

嘿嘿

shiny analytics golem
1个回答
0
投票

我刚刚在我的傀儡上设置了 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"
    )
  )
}
© www.soinside.com 2019 - 2024. All rights reserved.