Forum Discussion
JimDeRosa
4 years agoCommunity Member
New xAPI features question
Using the new features, is it possible to specify the actor for a custom xAPI statement? The goal being recording activities in an LRS when no LMS is present. For example, launching HTML5 course fro...
BastiaanTimmer
3 years agoPartner
Hi Jim,
I'm using the following Javascript code to provide an actor on launching a xAPI project/course:
function getActor() {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const name = urlParams.get('name')
const email = urlParams.get('email')
return {
"mbox" : "mailto:" + email,
"objectType" : "Agent",
"name" : name
};
}
This Javascript code will get the name and the email from the URL. So if your start file is story.html, you can provide the parameters below for running the course for a specific actor:
name=John Doe
email=johndoe@example.com
The link will be:
story.html?name=John Doe&email=johndoe@example.com
Maybe you could use another storyline project for capturing the name and email and building up the launch URL.
Best regards,
Bastiaan