use_tracking: Insert dependencies to track usage of a Shiny app

Description Usage Arguments Note Examples

View source: R/tracking.R

Description

If used in ui of an application, this will create new inputs available in the server. Set dependencies = FALSE in track_usage server-side to load dependencies only once.

Usage

1
2
3
4
5
use_tracking(
  on_unload = FALSE,
  exclude_input_regex = NULL,
  exclude_input_id = NULL
)

Arguments

on_unload

Logical, save log when user close the browser window or tab, if TRUE it prevent to create shinylogs 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.

exclude_input_regex

Regular expression to exclude inputs from tracking.

exclude_input_id

Vector of inputId to exclude from tracking.

Note

The following inputs will be accessible in the server:

- .shinylogs_lastInput : last input used by the user

- .shinylogs_input : all inputs send from the browser to the server

- .shinylogs_error : all errors generated by outputs elements

- .shinylogs_output : all outputs generated from the server

- .shinylogs_browserData : information about the browser where application is displayed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 (name correspond to inputId:"),
    verbatimTextOutput("last")
  )

  server <- function(input, output, session) {

    output$last <- renderPrint({
      input$.shinylogs_lastInput
    })

  }

  shinyApp(ui, server)

}

karimelghazouly/shinylogs_modified documentation built on Jan. 9, 2021, 12:37 a.m.