You can install the development version of shinymetrics from GitHub with:
# install.packages("remotes")
remotes::install_github("devOpifex/shinymetrics")
Place your token for your registered application in your .Renviron
(or elsewhere as environment variable) as SHINYMETRICS_TOKEN
.
Shinymetrics
classshinymetrics_server()
for useful informationlibrary(shiny)
library(shinymetrics)
# initialise the tracker
tracker <- Shinymetrics$new()$track_recommended()
ui <- fluidPage(
tracker$include(), # include in the UI
trackingModalBS3() # consent prompt
)
server <- function(input, output, session) {
shinymetrics_server() # (optional) print information on tracking
}
shinyApp(ui, server)
The package comes with prompts to help developers collect consent from users to enable or disable tracking. These prompts toggle tracking and cookies on and off but DO NOT store consent, if that is required you must implemented it yourself.