0

I would like to use track my R Shiny app using google analytics. I followed this article https://shiny.rstudio.com/articles/google-analytics.html. i got i should create a html with ui.R. For golem package , is it right to put the html file into the R folder of my package? Thanks

Hees

Hees
  • 111
  • 1
  • 9

1 Answers1

0

I have just set up Google Analytics on my golem by:

  • Putting google-analytics.html file in inst/app/www

  • Using golem_add_external_resources in app_ui.R as follows (see commented line):

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"
    )
  )
}
Dric
  • 87
  • 13