ALT Tags, xAPI, and LRS';s...
October 31, 2016 12:00 AM
Hey People!
Ok, so in Lectora, I can pull the alt tag of an item (after publishing) into a Lectora variable named “myAltTag” by using the following javascript code:
VarmyAltTag.set(%HTMLNAME%.altName);
I know it works, because I can then create a text field and set it to change its contents to the contents of the variable named “myAltTag” and the full alt tag will get displayed. I’m attempting now, to get that alt tag to be sent to our xAPI LRS by modifying this original javascript:
LectoraXAPIStmt("Btn001", "Name that we want saved"); to this: LectoraXAPIStmt("%HTMLNAME.altName%");
This “sort of” works in that our LRS will report the following interaction:
button3434.altName
It’s not pulling in the alt text for the image, it’s pulling in the HTML name that Lectora generates for each item. But I feel like I'm getting closer. I’ve tried a variety of variations on that coding like,
LectoraXAPIStmt("%VarmyAltTag%");
LectoraXAPIStmt("VarmyAltTag ");
LectoraXAPIStmt("%VAR(myAltTag)%");
… and others, but can’t seem to get that ALT to pull in.
Do y'all have any ideas or suggestions?
Thanks,
Joe
Discussion (2)
Thanks! That did it. You 'da man!
Happy Halloween!
Hi Joe,
A way to do it should be to set the variable in the way I've described in that other topic. Mind the action must be attached to the button. Then use the variable myAltTag for all other puposes. I'm not familiar with xAPI but it should work with
LectoraXAPIStmt(VarmyAltTag.getValue());
to use the variable value in the command.
If you're using Lectoras "xAPI Statement" action, you can select the variable in the "Object" field from the dropdown or enter VAR(myAltTag)
Tim
Discussions have been disabled for this post