R package to track shiny applications with shinymetrics.
Installation
You can install the development version of shinymetrics from GitHub with:
# install.packages("remotes")
remotes::install_github("devOpifex/shinymetrics")
How it works
Place your token for your registered application in your .Renviron
(or elsewhere as environment variable) as SHINYMETRICS_TOKEN
.
- Create a tracker with the
Shinymetrics
class - Include the tracker in the UI
- (Optional but recommended) include the server-side function
shinymetrics_server()
for useful information
library(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)