Tracking the quiz result using a javascript trigger
May 18, 2020
Hi
I am a newbie to javascript. After reviewing several discussion posts and tried several options, I would appreciate your support with the correct javascript that allows me to track the quiz result in the LMS. For this situation, the score does not influence the pass or fail. The course completion is based on a completion trigger.
The last code I used without success was:
var lmsAPI = parent;
var player = GetPlayer();
var Results.ScorePercent = player.GetVar("LMS");
lmsAPI.SetScore(Results.ScorePercent, 100, 0);
What am I doing wrong? Thank you in advance for your support.
6 Replies
Now I have created a user variable that reads the Results.ScorePercent but it still doesn't work.
I really need support!
Hi Maria,
Hopefully a community member with Javascript expertise can chime in with their tips, but can you shed a little more detail into why you're tracking using a completion trigger and not quiz result?
One item to keep in mind is setting an LMS reporting status to Passed/Incomplete or Passed/Failed, as that will most likely record success and completion. You can read more about that here:
Looking forward to hearing back!
Do you have a variable called LMS that you are setting the results value to in Storyline? That is what the javascript is asking for. You cannot get a results value using javascript you must first set another variable (in this case LMS) to the value of the results percent and call that in your code.
Hi Ren,
Thank you for your reply. I have a completion trigger in the last slide since the course is a branching-scenario with 3 options.
I just would like to track also the quiz result although it should not be considered to completion status.
Do you think it's possible?
Hi Phil
Thank you for your reply. It was the insight I was needing to come up with the solution.
I was not able to make my previous javascript work even with the new variable. So after further digging, I was able to track the results using the following javascript:
var player = GetPlayer();
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);
lmsAPI.SetScore(player.GetVar("lmsScore"), 100, 0);
Have a joyful day! Thank you!
Hi Maria -
I posted a somewhat related thread yesterday https://community.articulate.com/discussions/articulate-storyline/showing-test-out-score-in-lms-not-final-score and I am wondering if what you are doing might help me with my problem? You call yourself a newbie to javascript but you clearly know more than me!
Thanks.
This discussion is closed. You can start a new discussion or contact Articulate Support.