Skip to main content

Interactive video events

When a WeVideo interactive video is embedded on your site in an iframe, the player posts events to the embedding page using window.postMessage. You can use these to track viewer engagement — for example sending responses to your analytics or CRM. A typical embed URL would be an anonymous assignment link, for example https://www.wevideo.com/api/5/bulbs/assignment/123/go

Listening for events

Each message is a JSON string with a type and a data object:

window.addEventListener("message", (event) => {
if (event.origin !== "https://www.wevideo.com") return; // ignore other senders

let message;
try {
message = JSON.parse(event.data);
} catch {
return; // not a WeVideo event
}

switch (message.type) {
case "interactive_video_started":
console.log("Viewer started the video", message.data);
break;
case "interactive_video_interaction_completed":
console.log("Viewer answered an interaction", message.data);
break;
case "interactive_video_completed":
console.log("Viewer completed the video", message.data);
break;
}
});

Events

interactive_video_started

Sent once per page load, when playback first starts.

FieldTypeDescription
interactiveVideoIdnumberID of the interactive video
titlestringTitle of the interactive video
userIdnumberViewer's WeVideo user ID
firstNamestringViewer's first name
lastNamestringViewer's last name
attemptIdnumber | nullID of the viewing attempt

interactive_video_interaction_completed

Sent every time the viewer submits a response to an interaction (question, poll, etc.).

FieldTypeDescription
interactiveVideoIdnumberID of the interactive video
userIdnumberViewer's WeVideo user ID
attemptIdnumber | nullID of the viewing attempt
interactionIdnumberID of the interaction that was answered
interactionTypestringInteraction type, e.g. multiple_choice, check_all_apply, free_response, poll_q, short_answer
correctboolean | nullWhether the response was correct; null for ungraded types like polls
response.textstring | nullThe submitted response text, when the interaction has a text response
response.interactionOptionIdsstring[] | nullIDs of the selected answer options, when the interaction has options

interactive_video_completed

Sent when the viewer completes the interactive video. Sent at most once per attempt — a retake (new attempt) can produce another one.

FieldTypeDescription
interactiveVideoIdnumberID of the interactive video
titlestringTitle of the interactive video
userIdnumberViewer's WeVideo user ID
attemptIdnumber | nullID of the viewing attempt
assignmentIdnumber | nullAssignment ID, when viewed as part of an assignment
statusstringAlways "completed"
pointsEarnednumber | nullPoints the viewer earned across graded interactions
pointsAvailablenumber | nullTotal points available in the video

interactive_video_incomplete

Sent when the viewer reaches the end of the video without meeting the completion criteria (for example a required score threshold). Same payload as interactive_video_completed, with status set to "incomplete".