Learner Events and xAPI - serlo/documentation GitHub Wiki
To connect the editor to your LRS you need to provide a custom handleLearnerEvent
function.
Since there are many different standards and implementations we decided to allow integrations to provide their own handler.
We provide an xAPI example below.
The handleLearnersEvent
function will be called when a learner is interacting with the editor with the following data:
export interface LearnerEventData {
verb: 'opened' | 'attempted' | 'interacted' | 'answered'
contentType: // plugins that currently send learner events
| 'input-exercise'
| 'sc-exercise'
| 'mc-exercise'
| 'blanks-exercise'
| 'h5p-exercise'
| 'spoiler'
| 'solution'
correct?: boolean
value?: object | string | number
pluginId?: string // editor id of the plugin that triggered the event
}
Additionally this data is also dispatched as a custom event that you can listen to if that is more convenient:
document.addEventListener(editorLearnerEventName, handleExerciseEvents)
As of now handleLearnersEvent
supports a basic set of interactions that might be enough for many use cases.
If you have specific requirements please get in contact or open a PR.
Here you can find a simple example of how to use this system with xAPI:
handleLearnerEvent for xAPI with watershed LRS
It creates valid xAPI statements from the editors events and sends them to a demo LRS (watershed) via the @xapi/xapi
library.
The learner interactions can then be viewed and evaluated.