What does timestamp tell in shinylogs output

Hi all,

My intention here is to track how users uses my application. So for this, I have built sample application with tracking code incorporated (please refer below). Fortunately, I am able to save log files and fetch those data into R studio.

Right now, I am opening the application, playing around the data and then closing it. Post this I am opening this tracking information in R studio to understand how I have used my application.

But I am facing few problems. I am not sure about few terminologies here in the output like timestamp and all. My questions are below,

  1. Does it give the order of my execution, like at time 't1', I have clicked on input 'I1' to get the output 'O1'. But I do not think so this application is tracking in that way. Could you please make me understand and correct me how to read the logs file.

  2. Can we have a reference/unique id, So that I know for this ID, I have clicked on Input 'I1' to to get the output 'O1' at time 't1'

Below is my ui.R code

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

# Define UI for application that draws a histogram
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", numericInput("T", "No of data sets", value = 1, min = 1, width = 150),
                     # textInput("T", "No of data sets", value = 0,width = 150),
                     fluidRow(tags$div(id = "container")),
                     fluidRow(tags$div(id = "remove")),
                     fluidRow(box(title = "Dataset",uiOutput("filter_70"),width = 5000)))
    ),verbatimTextOutput("last"))
)

Below is my server.R code


library(shiny)
library(shinylogs)
source("ui.R")

# Define server logic required to draw a histogram
shinyServer(function(input, output) {
  
  track_usage(
    storage_mode = store_json(path = tmp)
  )
  
  observe({
    req(input$T)
    removeUI("#fileInputContainer")
    removeUI("#remove1")
    insertUI("#container", "afterBegin", tags$div(id = "fileInputContainer"))
    insertUI("#remove", "afterBegin", tags$div(id = "remove1"))
    for(i in 1:input$T) {
      insertUI("#fileInputContainer", "beforeEnd",
               box(fileInput(paste0("dataFile", i), "Choose the csv file",
                             accept = c("text/csv","text/comma-separated-values,text/plain",".csv")),width = 2,height = 100))
    }
    for(i in 1:input$T) {
      insertUI("#remove1", "beforeEnd",
               box(actionButton("remove","remove",width = 140),width = 2))
    }
  })
  observeEvent(input$remove,{
    removeUI(selector = "#dataFile",immediate = TRUE)
  }) 
  
  output$contents <- renderTable({
    file_to_read <- input$dataFile
    if(is.null(file_to_read))
      return(NULL)
    a <- read.csv(file_to_read$datapath)
    head(a,n=15)
  })
  
  last_selected <- reactiveVal(NA)
  
  observeEvent(input$dataFile, {
    last_selected("csv")
  })
  
  output$filter_70 <- renderUI({
    req(last_selected())
    if (last_selected()=="csv") {
      tableOutput("contents")
    } 
  })
  
  output$last <- renderPrint({
    input$.shinylogs_lastInput
  })
  
})

For clarification read shinylogs' documentation

https://dreamrs.github.io/shinylogs/articles/shinylogs.html

That would be the sessionid but if you want to track distinct users that is only possible if you are using shiny-server pro.

Thanks alot. But 1 question I have. I get below tracking record. may I know what is "drop630495896_state". From the link you shared it states that name is " name : inputId of the input" . But this drop..... is not a input ID at all. Can you help in this

image

... by default all inputs are recorded (even those not define by developper, like with {htmlwidgets} : {DT}, {leaflet}, …)

As the documentation explains, that would be an input not defined by you, but by a package.

Thanks......................

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