This will create an empty txt file which can be used to save user behavior. Then add this code to write user behavior to that file:
observe({
x <- iconv(input$tracking, from = "UTF-8")
i <- as.numeric(regexpr("|", x, fixed = TRUE))
L <- substr(x, 1, (i-1))
V <- substr(x, (i+1), nchar(x))
L <- paste('"', as.character(Sys.time()), " ", L, '": ', sep = "")
if(grepl(",", V)) {
V <- paste('["', gsub(",", '", "', V), '"],', sep = "")
} else {
V <- paste('"', V, '",', sep = "")
}
write(paste(L, V, sep = ""), fileLog, append = TRUE)
})