ARTICULATE STORYLINE: SENDING LEARNER SCORE TO LMS USING JAVASCRIPT
JavaScript can be of great help to take your eLearning courses developed in Articulate Storyline to the next level, be it Storyline 1, Storyline 2 or Storyline 360. It lets you extend the functionality of the built-in tools in Storyline that come by default. With JavaScript, you not only update the Storyline variables, but it also comes handy while working with the eLearning courses that are going to land up in Learning Management System (LMS).
Including JavaScript in Articulate Storyline gives you control to manipulate and use the information coming from LMS and being sent to LMS. Few popular examples of such scenarios are:
- Getting student’s name from LMS
- Getting student’s status
- Getting and setting Lesson status
- Getting student’s Language preferences
- Sending user score to LMS
Thank you so much. I am using the Canvas LMS and for some reason it is not picking up the score . I set up an assignment and set the points possible to 30, then tried to send a score of 20 out of 30 to the Canvas grade book but it defaults to a 30/30 instead. Do you know the actions on the LMS side to get it to work?
Thanks again for the information!
Bill Creger
Hello Bill,
I’m glad you found my blog helpful.
As you know every LMS is slightly different from the other and each exhibit different behaviors when displaying scores and other details.
For storyline courses, you need to use
lmsAPI.SetScore(player.GetVar(‘Score’),100,80);
function.Where player.GetVar(‘Score’) will fetch the value of Score variable you created in Storyline and send it to the LMS to save it as score secured by the user.
If, you are using Storyline 2 and Update version is lower than 10 you must not use “Exit course” trigger on the Exit button to exit the course, using this button will override your custom score sent using JavaScript with the Storyline’s default score.
I guess this is what’s happening in your case.
Instead use “Jump to URL” trigger on the exit button and provide this url “./lms/goodbye.html” to exit the course.
And be sure to select the Tracking option as “Track using number of slides viewed” in Report and tracking options before you publish for LMS.
Hope this helps you out. Let me know if this works or not.
Cheers!
Please note that this approach won’t work for HTML5 content that is published using Storyline 360.
Instead, see here: https://community.articulate.com/discussions/articulate-storyline/lmsapi-functionality-in-html5-output?page=2#reply-451483
Yes Matthew, You are right. This blog only focuses on storyline 2. Thanks for sharing your observations. This might help future visitors using storyline 3.
I’ve been using this with much success and it makes a big difference to my learning packages, however when I’ve used this on a mobile device (both android and IOS), it doesn’t work. Is there a setting I need to change or an update to the javascript that will allow this to work on mobile devices? I’m publishing as HTML5.
Jane, the code is tested on both android and iOS which works well for us. I believe you are using SL 2.
Hi
I am also trying to push the score results into a SCORM LMS. I have used the code that you have mentioned. I am using Storyline 3 to develop my course.
I am using a custom designed quiz and have used a variable called quiz1percentage. From your discussion it appears that I should use a variable called Score. So I created a variable called Score and set it equal to quiz1percantage.
Then I copied the code and pasted it as suggested in the blog.
However, I am still unable to parse the scores to LMS.
The reporting and tracking are set exactly as you have suggested in the article.
I will appreciate any help and guidance on this.
Hi Sanjay,
New Storyline 3 came with many changes under the hood.
That’s the reason, above code “lmsAPI.SetScore(player.GetVar(‘Score’),100,80);” isn’t working anymore.
In order to make it work with Stoyline 3 all you need to do is, just use the below code instead:
objLMS.SetScore(player.GetVar(‘Score’),100,80);
objLMS.CommitData();
While all the other steps mentioned in the blog remain the same.
Hope this helps you out.
Cheers!
You probably want/need to set completion and success status as well.
lmsAPI.SetCompleted()
and lmsAPI.SetPassed()
or lmsAPI.SetFailed()
Hi
I am also trying to push the score results into a SCORM LMS. Can you Please share the updated code which can be used for Storyline 360.