I have application where I am tracking all the user activity. But one major problem is there. I have a datatable in my application where when the user clicks on specific column (say " Africa"), this activity is not recorded in my log. I strongly believe that, this would be important as it captures indetail about the users.
I managed to get this below reprex
ui.R
if (interactive()) {
tmp <- getwd()
onStop(function(){
browseURL(url = tmp)
})
}
use_tracking()
dashboardPage(
dashboardHeader(title = "Loading data"),
dashboardSidebar(sidebarMenu(
menuItem("Load Data", tabName = "Load_Data", icon = icon("balance-scale")),
menuItem("Analysis", tabName = "Analysis", icon = icon("chart-bar"))
)),
dashboardBody(
tabItems(tabItem(tabName = "Load_Data", selectInput("dataset",
"Select",choices = c("","iris","mtcars"), selected = "iris"),
DT::DTOutput('table1')),
tabItem(tabName = "Analysis",DT::DTOutput('table2'))
),verbatimTextOutput("last"))
)
server.R
library(shiny)
library(shinylogs)
library(DT)
source("ui.R")
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
track_usage(
storage_mode = store_json(path = tmp)
)
datasetInput <- reactive({
switch(input$dataset,
"iris" = iris,
"mtcars" = mtcars)
})
output$table1 <- DT::renderDT({
head(datasetInput(), n = 10)
})
output$table2 <- DT::renderDT({
if(is.null(input$table1_rows_selected)){
} else {
head(datasetInput()[input$table1_rows_selected,], n = 100)
}
})
output$last <- renderPrint({
input$.shinylogs_output
})
})