Difficulty with lmsapi commands in Storyline

I'm trying to improve functionality between by lms (LearnDash), LRS (GrassBlade) & Storyline. I use Storyline V1 & xAPI 0.9.

The recommended code below does not work:
var lmsAPI = parent
var rawName = lmsAPI.GetStudentName();
var nameArray = rawName.split(",")
var niceName = nameArray[1] +" "+nameArray[0];
var p = GetPlayer();
p.SetVar("username",niceName);

 

Any light that could be shed on why this doesn't work for me would be invaluable.

5 Replies
Alex Lapthorne

I've tried pulling the url using the following javascript:

var newURL = window.location.pathname;

var pathArray = newURL.split( '"' );
var fullName = pathArray[7];

var nameArray = fullName.split('%20')

var firstName = nameArray[0]
var lastName = nameArray[1]

var outputName = firstName + ' ' + lastName

var player = GetPlayer()
player.SetVar('outputName', outputName)

 

I've extracted the name from the url, but once I add everything below "var player..." (which writes the JS variable to articulate), then code does not change the articulate variable. Can you provide any advice on this?