wfu-dmds / teaching-r-study

3 stars 2 forks source link

Concept proof: capture learnr user_id manually #1

Closed jdtrat closed 3 years ago

jdtrat commented 4 years ago

Searching through the learnr code identifiers.R and events.R, they initialize the user_id using Sys.info()["user"]. Adding the chunk works on my local machine. I am not 100% sure if/when the user_id variable gets changed, so this should be tested more explicitly. However, I think that it only gets changed if a custom identifier is defined (see here). The code would also have to be updated for persistent storage with Dropbox, which I would love to learn how to do.

LucyMcGowan commented 4 years ago

:scream: this is fabulous, thank you! I'll test it out a bit on my end to see if it works consistently

LucyMcGowan commented 3 years ago

Ok, two steps forward one step back! I have figured out how to get shiny into these learnr docs (maybe you already knew how to do this! https://community.rstudio.com/t/incorporating-shiny-with-learnr-modules/79827/4) BUT now I've realized that the user_id is informative locally, but not on my shiny server (where it is always shiny 😭 ) - working on another system for logging, but go ahead and proceed with creating the demographic questions using shiny inputs.

jdtrat commented 3 years ago

Very nice! I used this resource for creating the PR and I believe it's the same site that cpsievert suggested. The main way to track client data I believe is with session$clientData. Here's an article describing that, though I don't know if it contains the information you would need. Here's another alternative I found.