H5P & xAPI customisation - Capturing xAPI place and device activities


Hi there,

I have a Drupal 9 site which uses the H5P and simple xAPI modules to connect to a Learning Locker instance I have on AWS instance. I am able to capture all the basic information from my test H5P forms such as attempted, completed, intereacted, etc.

I would, however like to extend the functionality to capture the xAPI place and device activities. Would anyone have any pointers, Drupal hooks or suggestions as to how I can capture and pass these?

I know that I will probably need to use the verbs "was at" for the place activity and "used" for the device activity, however I am not sure what the steps are to be able to capture this information.

Please let me know if you have any questions.

Thank you very much for your assistance in this matter.

Content types: 
otacke's picture

Hi Andrew!

You can only capture xAPI statements that a content type or H5P core emits, and none of the existing ones provides you with a location or some "device activity" (not sure what that's supposed to be). If there are other statements that you'd like to capture, then you'll have to customize content types / H5P core accordingly and trigger your own statements. You may want to consult the xAPI specification and https://h5p.org/documentation/api/H5P.XAPIEvent.html for on overview of what H5P offers to support xAPI events. In the end, it's just about building a JSON object according to the xAPI specification and passing that to an event that gets triggered.