0

send student name instead of userId in xapi statements

2285 0 2
Posted   2 years ago

Hi Team,

I want to modify the actor value, instead of student ID, the student name will inserted in the xapi statement.

file location scormcontent/index.html

var userId = ret.GetStudentID;

var actor = xAPIFunctions.getActor(userId);

var tcConfig = {

recordStores: ANALYTICS_RECORD_STORES

};

 

tc = new TinCan(tcConfig);

 

tc.getStatements({

params: function(){

var params = {

agent: new TinCan.Agent(actor), // i want to use the GetStudentName() value here

verb: new TinCan.Verb(

{

id: "http://www.dominknow.com/xapi/verbs/objective_complete"

}

)

};

if(playerBehaviour.objective_adaptation == "same"){

params.activity = ANALYTICS_COURSE_ID;

params.related_activities = true;

}

return params;

}(),

 

Thanks

 

Comments

( 0 )

Answers  ( 2 )

0
avatar helios03   |    
Posted   2 years ago
  ●   Edited   2 years ago

I found a way to include the student name by modifying the player-tincan.js

I added name: dataStorage?dataStorage.objLMS.GetStudentName():e line 334

"."+a),c+="S"));""==c&&(c="T0S");return"P"+c}}}();xAPIFunctions={getActor:function(e,s){playerBehaviour.anonymizeAnalyticsUser||"N/A"==e?(e=Cookies.get("dki_xapiActor"),e||(e="actor_"+Math.random().toString(36).substring(6),Cookies.set("dki_xapiActor",e)),e={objectType:"Agent",account:{homePage:"http://www.dominknow.com",name:e}}):e=DKI.utility.isValidEmail(e)?{objectType:"Agent",mbox:e}:{objectType:"Agent",name:dataStorage?dataStorage.objLMS.GetStudentName():e,account:{homePage:window.location.protocol+"//"+document.domain,name:e}};return e}};

Comments

( 0 )
0
avatar Luke Hickey   |    
Posted   2 years ago

If all you're trying to do is associate the learners name with the course, did you consider using the Send xAPI Statement action to send the learners name when the first page is loaded?

You can use the system variable for learners name in the Send xAPI Statement response field. For example I would use an Attended verb with a Course activity. The fields that support custom veriables are Success (Num), Response (String) and Score (Num). Just right click on the field to see the variables selection menu. Note the variables list only shows variables that match the type of input accepted, Num or String.

Did I understand what you are trying to do correctly?

Also note that if you are storing a persons name (PII) in a 3rd party system, you will have to be mindful of privacy and/or  GDPR related rules around managing the personal information.

Comments

( 9 )
0
2 years ago     helios03     0   |   4  

Hi Luke, thanks for the reply. What i am trying to do is to send the actor name in every statements that are sent into the LRS.

0
2 years ago     helios03     0   |   4  

I see. The name is not allowed to be stored in any LRS?

0
one year ago     ptrader     0   |   1  

Hi Luke - came across this thread because we're also asking some questions about how the dki_xapiAuthor name is generated. We see the actor being autogenerated as pk31en when we expect something else. Is there a way to change it?

0
one year ago     ptrader     0   |   1  

code line we're studying looks like: actor: {objectType: "Agent", account: {name: "actor_pk31en", homePage: "http://www.dominknow.com"}}

0
one year ago     Luke Hickey     279   |   4  

The value returned for the name depends on how the package is loaded by the lrs/lms. If the launching system does not respond to provide the name then we can’t get it. I’ve found some lrs do not store names. I’ve found that lms systems with lrs usually do return name. In cases you don’t get the name, can you prompt the user for it?

0
one year ago     ptrader     0   |   1  

Thanks for the reply Luke. This would be fine IF the package is running from the LMS - but xAPI is supposed to work outside an LMS as well. We can get the user name we want from the network login, but we're trying to figure out how and where to overwrite the dominknow generated version.

0
one year ago     Luke Hickey     279   |   4  

Ahh you’re running it standalone. In that case you can pass the actor in over the URL via query string?

0
one year ago     Luke Hickey     279   |   4  

This might be good info for your use case. https://github.com/adlnet/xapi-launch

0
one year ago     ptrader     0   |   1  

Thanks for the tips, Luke. We'll give that a try!