Adding custom xAPI attributes to statements

Forums: 

Hi:

I've been asked to add / insert custom attributes into any / all H5P interaction statements sent to the LRS.

This is related to WordPress H5P content.

I'm already involved in tehxAPI and cmi5 groups, howevr, feel this is teh best place ot ask H5P specific questions.

What I've been asked to do is add "groups" (meaning organizational groups) into each statement sent to the LRS. I expect the group attribute would be added as contextual information.

Is there a place someone cna point me to get started on this?

Can this even be done?

Best Regards,

thomasmars's picture

Hi,

This is indeed possible, but not a trivial task. I would start by looking at the Wordpress Customization guide we have, which points you to an example mod that allows you to hook into several different parts of the H5P plugin. The most interesting part of this will be h5pmods_alter_scripts, which will allow you to insert your own scripts inside the H5P iFrame. Using this hook you can make your own script that extends or replace an existing script.

For instance if you want to change the context of an xAPI event to always include a "group" property, you could override the H5P.XAPIEvent.prototype.setContext() function with your own function that is a variation of the already existing setContext(), then add this script through the h5pmods_alter_scripts that you've added through your own mod.

Hope this helps you to get started, let us know how your progress is and if you get stuck.
Good luck. Best regards, Thomas.