View source: R/learnitdown_shiny.R
trackEvents | R Documentation |
These functions provide the required code to be inserted in the server part of a Shiny application to track events (start, stop, inputs, outputs, errors, result or quit), to check the answer when the user clicks on the submit button and to cleanly close the application when the user clicks on the quit button.
trackEvents(
session,
input,
output,
sign_in.fun = NULL,
url = Sys.getenv("MONGO_URL"),
url.server = Sys.getenv("MONGO_URL_SERVER"),
db = Sys.getenv("MONGO_BASE"),
user = Sys.getenv("MONGO_USER"),
password = Sys.getenv("MONGO_PASSWORD"),
version = getOption("learnitdown.shiny.version"),
path = Sys.getenv("LEARNITDOWN_LOCAL_STORAGE", "shiny_logs"),
log.errors = TRUE,
log.outputs = FALSE,
drop.dir = TRUE,
config = NULL,
debug = Sys.getenv("LEARNITDOWN_DEBUG", 0) != 0
)
trackSubmit(
session,
input,
output,
solution = NULL,
max_score = NULL,
comment = "",
message.success = "Correct",
message.error = "Incorrect",
score.txt = "Score",
check.solution = check_shiny_solution
)
trackQuit(session, input, output, delay = 60)
check_shiny_solution(answer, solution)
session |
The current Shiny |
input |
The Shiny |
output |
The Shiny |
sign_in.fun |
The function that can get user info from the
|
url |
The URL to reach the MongoDB database. By default, it is read from
the |
url.server |
The URL to reach the MongoDB database. By default, it is
read from the |
db |
The database to populate in the MongoDB database. By default, it is
read from the |
user |
The user login to the MongoDB database. By default, it is
read from the |
password |
The password to access the MongoDB database. By default, it
is read from the |
version |
The version of the current Shiny application. By default, it
is the |
path |
The path where the temporary |
log.errors |
Do we log error events (yes by default)? |
log.outputs |
Do we log output events (no by default)? |
drop.dir |
Do we erase the directory indicated by |
config |
The result of the call to |
debug |
Do we debug recording of events using extra messages? By
default, it is the value of the environment variable |
solution |
The correct solution as a named list. Names are the
application inputs to check and their values are the correct values. The
current state of these inputs will be compared against the solution, and the
|
max_score |
The highest score value that could be attributed if the
exercise is correctly done. By default, it is |
comment |
A string with a comment to append to the value of the result event. |
message.success |
The message to display is the answer is correct ("Correct" by default). |
message.error |
The message to display if the answer is wrong ("Incorrect" by default). |
score.txt |
The word to use for "score" ("Score" by default). |
check.solution |
The function to use to check if solution provided by
a Shiny application is correct or not. By default, it is
|
delay |
The time to wait before we close the Shiny application in sec
(60 sec by default). If |
answer |
A named list of the answer data to check against solution. This
object is provided by |
The code to be inserted in the server part of the learnitdown Shiny application in order to properly identify the user and record the events.
learnitdownShinyVersion()
, sign_in()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.