Storyline custom interaction tracking
May 01, 2020
Hello!
I have created a Storyline 2 custom interaction with Javascript for tracking in Moodle LMS as a SCORM package. What it does is that if a user clicks on any object in Storyline(here it is a marker), Moodle LMS will track and record the interaction. It will record whether a user has clicked any button or not. In this way we will know how many of them are clicked in the course.
It is working absolutely fine in Storyline 2 as it should.
But the main issue is that the exact same module is not working when published from Storyline 3. It's not recording any interactions in Moodle.
I know that the Javascript has changed in HTML5 output in Storyline 3.
Can anyone provide me with the updated Javascript code for Storyline 3?
Here is the JS code I am using in Storyline 2:
var lmsAPI = parent;
var player=GetPlayer();
var score1=player.GetVar("score1");
var date = new Date();
//this calls the SCORM API to record a custom interaction
//(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, //intWeighting, intLatency, strLearningObjectiveID, dtmTime, //scormInteractionType)
lmsAPI.SCORM_RecordInteraction("marker1","m1" ,true ,"m1clicked" ,"This is Marker 1" ,score1 ,"" ,"Course1" ,date , "choice");
I have also attached the Storyline 2 demo and the published SCORM file.
Thank you.
5 Replies
I have attached a screenshot of the Moodle SCORM interactions report. This is working when published from Storyline 2 as mentioned above.
But when published from Storyline 3, the JS code is not working with the new HTML5 output. There is no interaction data captured in Moodle. It's blank.
I would really appreciate it if anyone could help me with this code.
Found the solution with this code -
var player = GetPlayer();
var score1 = player.GetVar("score1");
var date = new Date();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
//this calls the SCORM API to record a custom interaction
//(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, //intWeighting, intLatency, strLearningObjectiveID, dtmTime, //scormInteractionType)
lmsAPI.SCORM_RecordInteraction("marker1","m1" ,true ,"m1clicked" ,"This is Marker 1" ,score1 ,"" ,"Course1" ,date , "choice");
Has that worked for SCORM2004_RecordInteraction in case of SCORM 2004 publish? The SCORM 1.2 has worked for me perfectly.
I didn't get the value of learner response with this script.
lmsAPI.SCORM_RecordInteraction("marker1","m1" ,true ,"m1clicked" ,"This is Marker 1" ,score1 ,"" ,"Course1" ,date , "choice");