Forum Discussion
DanThornton
3 months agoCommunity Member
Rise Course xAPI File Structure Change??
I'm creating courses in Rise 360 and publishing in xAPI (TinCan). The published xAPI file structure from 3 days ago is completely different to the file structure when republishing the same course tod...
DanThornton
3 months agoCommunity Member
I've raised a Support Ticket for this with Articulate. Don't know how to escalate further it or speak to an actual human.
Our LMS (and SCORM Cloud) is no longer able to track "Progress" of these xAPI files. And they're breaking completely on our Translator Tool.
kennethcrainer
3 months agoCommunity Member
I was able to find a work around yesterday evening. It's only a temporary band aid. I hope Articulate sees this and will be more mindful when launching completely altered publishing structures without giving their paying customers advanced notice. Anyways, I put the following directly before my xAPI javascript statements (noting I use the Mighty Power-up to inject javascript into the course prior to publishing). Hope this helps.
/* =========================================
MISSING SETUP SCRIPT (Add this BEFORE your logic)
========================================= */
(function () {
// 1. Create the Namespace
window.ScormXApi = {};
// 2. Helper to get URL Params (Rise passes actor info in URL for xAPI)
function getUrlParam(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
// 3. Configure the Actor (User)
// In an xAPI launch, the actor is usually passed in the URL.
// If not, we try to grab it from the global SCORM Driver variables if available.
var actorJson = getUrlParam('actor');
if (actorJson) {
window.ScormXApi.actor = JSON.parse(actorJson);
} else {
// Fallback: If no actor is found, create a generic one (or handle error)
console.warn("xAPI Actor not found in URL. Using Guest.");
window.ScormXApi.actor = {
"mbox": "mailto:guest@example.com",
"name": "Guest User"
};
}
// 4. Configure the Activity ID
// Usually passed as 'activity_id' or we use the current URL
window.ScormXApi.activity = {
id: getUrlParam('activity_id') || window.location.href.split('?')[0]
};
// 5. Define the sendStatement function
// We use the ADL wrapper which Rise normally loads, or a direct XHR fetch if needed.
// NOTE: This assumes Rise has loaded the XAPIWrapper or TinCanJS.
// If Rise uses strictly scormdriver.js, we have to leverage that.
window.ScormXApi.sendStatement = function (stmt, callback) {
// Try to find the Rise/LMS standard wrapper
var lms_api = window.parent ? window.parent : window;
// METHOD 1: TinCanJS (Common in Rise)
if (typeof lms_api.TinCan !== "undefined") {
// We need the instantiated tincan object, not just the library.
// This is tricky without the original setup.
// Often stored as window.tincan
if (lms_api.tincan) {
lms_api.tincan.sendStatement(stmt, callback);
return;
}
}
// METHOD 2: Direct Post (Fallback if we have endpoint/auth from URL)
var endpoint = getUrlParam('endpoint');
var auth = getUrlParam('auth');
if (endpoint && auth) {
var xhr = new XMLHttpRequest();
xhr.open("POST", endpoint + "statements", true);
xhr.setRequestHeader("Authorization", auth);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-Experience-API-Version", "1.0.0");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
callback({ err: xhr.status !== 200, xhr: xhr });
}
};
xhr.send(JSON.stringify(stmt));
} else {
console.error("Could not find xAPI Connection (TinCan or Endpoint URL)");
}
};
console.log("ScormXApi Bridge Initialized", window.ScormXApi);
})();
Related Content
- 1 year ago
- 8 months ago