If used in UI of an application,
this will create new input
s available in the server.
Set dependencies = FALSE
in track_usage()
server-side to load dependencies only once.
Usage
use_tracking(
what = c("session", "input", "output", "error"),
exclude_input_regex = NULL,
exclude_input_id = NULL,
on_unload = FALSE,
app_name = NULL
)
Arguments
- what
Elements to record between
"session"
,"input"
,"output"
and"error"
.- exclude_input_regex
Regular expression to exclude inputs from tracking.
- exclude_input_id
Vector of
inputId
to exclude from tracking.- on_unload
Logical, save log when user close the browser window or tab, if
TRUE
it prevent to createshinylogs
input during normal use of the application, there will be created only on close, downside is that a popup will appear asking to close the page.- app_name
Name of the app as a character string. If
NULL
,basename(getwd())
(name of the folder where application is located) is used.
Note
The following input
s will be accessible in the server (according to what is used in record
argument):
.shinylogs_lastInput : last
input
used by the user.shinylogs_input : all
input
s send from the browser to the server.shinylogs_error : all errors generated by
output
s elements.shinylogs_output : all
output
s generated from the server.shinylogs_browserData : information about the browser where application is displayed.
Examples
if (interactive()) {
library(shiny)
library(shinylogs)
ui <- fluidPage(
# Load tracking dependencies
use_tracking(),
splitLayout(
cellArgs = list(style = "height: 250px"),
radioButtons("radio", "Radio:", names(iris)),
checkboxGroupInput("checkbox", "Checkbox:", names(iris)),
selectInput("select", "Select:", names(iris))
),
tags$p("Last input used, the 'name' slot correspond to inputId:"),
verbatimTextOutput("last")
)
server <- function(input, output, session) {
output$last <- renderPrint({
input$.shinylogs_lastInput
})
}
shinyApp(ui, server)
}