Telemetry reference¶
Telemetry & xAPI (v1)¶
LessonKit emits versioned telemetry events from @lessonkit/react and maps them to xAPI via @lessonkit/xapi.
Event catalog¶
Version:
telemetryCatalogVersion = 1(exported from@lessonkit/core)JSON:
@lessonkit/core/telemetry-catalog.v1.json(must matchbuildTelemetryCatalog()in tests)Types: discriminated
TelemetryEventwith requiredcourseIdon every event
Event |
When |
Key |
|---|---|---|
|
First provider mount per tab session + course |
— |
|
|
— |
|
Lesson becomes active |
|
|
Lesson completed |
|
|
With |
|
|
Quiz choice selected |
|
|
First correct answer (built-in Quiz) or |
|
|
Custom UI / branching via |
|
Session fields on all events: sessionId, optional attemptId, optional user.
xAPI mapping¶
Canonical mapper: telemetryEventToXAPIStatement(event) in @lessonkit/xapi.
Telemetry |
xAPI verb |
Object URN |
|---|---|---|
|
initialized |
|
|
completed |
|
|
initialized |
|
|
completed |
|
|
(none) |
Returns |
|
answered |
|
|
completed |
|
|
experienced |
|
React runtime: after each track(), the provider calls the mapper and xapi.send(statement) when a statement is returned (single path; no duplicate lifecycle helpers).
Custom interactions and blocks¶
For block-level xAPI on interaction events:
Set
blockIdonScenario/Reflection(or passblockIdin interaction payload).Ensure an active
lessonId(normal when insideLesson).Call
track("interaction", { kind: "…", blockId: "my-block", … }).
Without blockId, interaction events are tracked but do not emit xAPI.
Identity¶
All events require courseId. Lesson-scoped events require lessonId. Component ids are trimmed at the React provider boundary (assertValidId) so telemetry payloads and xAPI URNs stay aligned. See Identity reference.
course_started dedupe¶
The runtime uses separate session-storage marks:
Key pattern |
Purpose |
|---|---|
|
xAPI / session bootstrap (may fire before tracking sink is ready) |
|
Tracking sink delivery (retries when sink fails) |
When config.session.sessionId changes, migrateCourseStartedMark moves dedupe state to the new session id so learners do not receive duplicate course_started events after LMS handoff.
Quiz telemetry¶
Built-in Quiz / KnowledgeCheck must be wrapped in <Lesson>. Events without an enclosing lessonId are dropped by tryBuildTelemetryEvent.