Storyline custom interaction tracking

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.

 

 

3 Replies
Sourish Bose

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");