recommended approach for logging events to custom platform

hello! I am interested in logging events (as many as possible) produced in H5P content to a custom platform. for generic content I usually do this by adding our vanilla-javascript logger library to a modified ("instrumented") version of the content. I had followed similar approaches for Versal, Adobe Captivate and Learnosity content. 

For H5P, by reading the docs I feel that there are many different ways to accomplish this, and wonder what is the right approach:

1. opening exported H5P content and add my logger library right there.

2. create a version of my custom logger library as H5P library.. then add manually to each H5P exported content.

3. create a plugin (backend + frontend) for each target LMS, that injects my custom logger library at a global LMS scope and use the H5P event dispatcher mechanism to intercept all events produced by any H5P content, similar to the existing plugins for xAPI.. 

I appreciate any feedback on this topic,

 

thomasmars's picture

I would say the best approach is to intercept the xAPI events, as described here: https://h5p.org/documentation/x-api with a separate plugin like your 3. alternative. xAPI events are the only external events that are sent from H5Ps.