Hi,
Here is a crude way in which you could track sessions
library(shiny)
ui <- fluidPage(
tableOutput("myOutput")
)
#Track sessions outside the server function so the variable is permanent
#Alternative is to write to database or file
users = reactiveValues(
logTable = data.frame(
id = character(),
login = character(),
logout = character()
)
)
server <- function(input, output, session) {
#Register session start. Isolate needed for reactive environment
isolate({
users$logTable = rbind(
users$logTable,
list(id = session$token,
login = as.character(Sys.time()),
logout = NA)
)
})
#Register session end
session$onSessionEnded(function(){
isolate({
users$logTable[users$logTable$id == session$token,
"logout"] = as.character(Sys.time())
})
})
#Display info
output$myOutput = renderTable({
users$logTable
})
}
shinyApp(ui, server)

Every time a users logs in or out, the table will be updated. Note that refreshing the page ends the session, so this simple code cannot see if a user refreshes or if the same user visits multiple times. This purely is counting sessions. The number of active sessions is the number of NA in the logout column of the table.
For a more permanent tracking you should replace the users variable with a function that writes the data to a file or database.
Hope this helps,
PJ