Forum Discussion
Can I use a Rise Javascript block to send a custom bookmark location to the LMS?
Hi there, you will need to avoid the cmi.location field as this is used by Rise to store the users current location in the project. If you change it to store your value, it will result in a 404 error when they next attempt to launch the content from the LMS.
What you can do is use something called cmi.interactions if your LMS supports them (most do). I've put together some JavaScript that you can insert as a code block where you want to write the chosen path to the LMS.
I'm using a multiple choice interaction type.
The two variables, DESCRIPTION and PATH, at the top should be edited by you to 1) provide a description of the data you are storing and 2) a value for the description. In the example I provide, the description provides context of the stored value, in this case the students chosen path. You DESCRIPTION should be the same value across all paths, then just update the PATH variable.
<script>
/* EDIT START */
var DESCRIPTION = "Are you a remote or office based worker?";
var PATH = "Remote worker"
/* EDIT END */
/* DO NOT EDIT BELOW THIS LINE */
var scope = parent.parent.parent;
var start = Date.now();
var latency = Date.now() - start;
var id = DESCRIPTION.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_|_$/g, "") + "_" + Math.random().toString(36).slice(2, 10);
PATH = scope.CreateResponseIdentifier(PATH.substring(0, 1), PATH);
scope.RecordMultipleChoiceInteraction(id, PATH, "NEUTRAL", PATH, DESCRIPTION, 10, latency, DESCRIPTION);
</script>
As your code block doesn't contain anything, set the padding to zero.