Track specific fields clicked on Datatables

Please correct me if i am wrong.

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.

How are you tracking it? What package are you using? Where is your reproducible example? please be more specific and follow good practices when making your questions.

Hi,

Thanks for letting me know. I managed to get this below reprex. Please guide me

ui.R file

library(shinydashboard)
library(readxl)
library(shiny)
library(shinylogs)
out <- data.frame(baseFns = ls('package:base'))


#Save and naigate log files 

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 file


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
  })
  
})

The concern is what ever values I select in the table1, those values are reflected in table2. But those values are not recorded in the log file . I am not sure why.

HI All - noting that I'm hiding this thread, since it appears youre taking a second stab at it in this thread

We generally try to avoid duplicate posts like this.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.