Is your LMS dated and only supporting SCORM 1.2 and 2004 and not xAPI?
If you’re reading this, then chances are you already know how little learning data is captured when using SCORM.
So how can capture xAPI data in an LMS that only supports SCORM?
I originally came across an article my Melissa Melloway https://www.linkedin.com/pulse/send-xapi-statements-from-storyline-5-short-videos-milloway-msit/ that led me down the path to implementing this solution.
So, let’s get started!
We’ll create a simple Storyline file that simply navigates from page to page and open a link or two.
And add the following code:[code lang=”js”]xapistatement(verb,shortdesc,longdesc);[/code]
Let’s break down the code that we’re going to be using:
The list that is in the xapi_adl.js and include the following verbs:
When adding the verb in the statement, make sure you wrap it in single quotes.
So, to add the first part:
This is the short description of what the experience is and make sure you wrap it in single quotes. For example, ‘YouTube Video’.
So now we would have:[code lang=”js”]xapistatement(‘viewed’,’xAPI Introduction YouTube Video’,longdesc);[/code]
This will provide more details on experience. If we look a tour example, this may include a URL to the video and a description of what the video is and make sure you wrap it in single quotes. For example, ‘’ExperienceAPI (aka Tin Can API Demystified. https://www.youtube.com/watch?v=y42MSS1DJqc&t=2s’
So, our final code that we’ll add will look like:[code lang=”js”]xapistatement(‘viewed’,’xAPI Introduction YouTube Video’,’Experience API (aka Tin Can API Demystified. https://www.youtube.com/watch?v=y42MSS1DJqc&amp;amp;amp;amp;amp;t=2s’);[/code]
You can add as many of these as you want to either one trigger or multiple triggers. If adding to one trigger, simply add another xapistatement function code after the semicolon.
Something to keep in mind, triggers are fired in a sequential order, so be aware of the order of the triggers. For example, you don’t want to put an exit verb before a complete verb, when the actions are actually the other way around.
We need to add 2 files to the story_content folder. These are the xapi_adl.js and the xapi_scorm.js files (there’s a link at the end to all the files).
In the story_content folder, modify xapi_scorm.js to point to your LRS. You will also need to add the authkey from your LRS. Depending on your LRS, the authkey may be setup as a single string or as a base64(username:password). If you’re going to need this, your authkey may look like: “Basic ” + toBase64(‘username:password’); Check with your LRS as to which one to use.[code lang=”js”]var authkey = ‘From Your LRS’; var lrs = ‘https://link.to.your.lrs.xapi’;[/code]
In the SCORM root folder, modify the following files:
AFTER the lone of code <script src=”lms/API.js”charset=”utf-8″></script> add the following lines in this order:[code lang=”html”]&amp;amp;amp;lt;script src="story_content/xapi_adl.js"&amp;amp;amp;gt;&amp;amp;amp;lt;/script&amp;amp;amp;gt; &amp;amp;amp;lt;script src="story_content/xapi_scorm.js"&amp;amp;amp;gt;&amp;amp;amp;lt;/script&amp;amp;amp;gt; [/code]
Now we need to modify the imsmanifest.xml. This is the file that SCORM uses and sets the the files that will be used as part of the SCORM package. We need to include the 2 files we added to the story_content folder.
Open and locate the line where the code is <file href=”story_content/story.js” />
Directly after this line, insert the following lines of code:[code lang=”html”]&amp;amp;amp;lt;file href="story_content/xapi_adl.js" /&amp;amp;amp;gt; &amp;amp;amp;lt;file href="story_content/xapi_scorm.js" /&amp;amp;amp;gt;[/code]
Save all the files.
Next, we need to zip up the folder where all the SCORM files are. Go to the root folder of the published SCORM files, highlight all the files and right click and compress.
Upload this file to your LMS in the normal manner you would any SCORM package. Run through the SCORM course as a student. If all is correct,your xAPI statements should be being sent to the LRS.
Below are the results as seen in the browser console, LRS and SCORM report.
Some things to note:
In addition, the email address and name in the Actor part of the statement is set to Test User as a back up if the SCORM package can’t pick up the student name.