Custom User.js file

Hi, 

One of my colleague having issues with the User.js file, she mentioned that the file supposed to list down all the activities done by the user in the module, for example: what button does the user click to navigate next slide so on and so forth.

Screenshots are provided below for more clarity-   

 Incomplete user.js-

 

Correct one for reference-

 

Please advise.

6 Replies
onEnterFrame (James Kingsley)

When you enter JS in a trigger in SL it publishes it all in the user.js file. All the files in "\html5\data\js" are the content for each slide, the player, etc. 

To list those events she would add a JS trigger to each thing/event she wants to track. If it were me I might handle it like this:

For each event I want to capture create a JS trigger with this line of code:

trackProgress("clicked", "Next Button") or trackProgress("opened", "more resources")

Then after I publish the course open the user.js and a function like this to the bottom:

function trackProgress(action, item){
console.log("Learner "+event+" "+item) //or post to server or whatever...
}

As written that code would just write out to browser's developer console: "Learner clicked Next Button" 

I am not sure what she wants to do with the data? Send it to database somewhere?