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;
case "interactive_video_exited":
console.log("User left the designer or player", 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
firstNamestringViewer's first name
lastNamestringViewer's last name
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".

interactive_video_exited​

Sent when the user leaves the interactive video designer or player through one of its exit buttons. Sent on every exit click.

FieldTypeDescription
interactiveVideoIdnumberID of the interactive video
titlestringTitle of the interactive video
userIdnumber | nullUser's WeVideo user ID
appstring"designer" or "player"
locationstringWhich exit the user took (see below)
attemptIdnumber | nullPlayer only: ID of the viewing attempt; null in the designer
locationAppExit
save_and_exitdesignerThe Save and exit button
finish_and_exitplayerThe Finish and exit button
sidebar_backbothThe back arrow in the side menu
error_dialogplayerThe exit button shown when the video fails to load

Without contained embed mode (below), the designer or player navigates as usual right after sending this event.

Contained embed mode​

If you sign users in through the login token flow and show the designer or player in an iframe on your site, you can keep the user inside the designer and player and handle exits yourself. Pass embedMode in the properties of the login token request:

POST /api/5/login-token/{userId}
{
"launchPath": "/interactive/player_v2?type=share&bulb_id=123",
"properties": { "embedMode": "contained" }
}

When the page is in an iframe and embedMode is contained:

  • Exits send interactive_video_exited and stay on the current page instead of navigating. Your page is expected to close the iframe.
  • Links and buttons that lead to other WeVideo pages, such as the dashboard, are hidden.

The setting lasts for the session started by the login token. Opened outside an iframe, the designer and player behave as usual.

Playlist events​

When a WeVideo playlist is embedded on your site in an iframe, the playlist posts these events to the embedding page, in the same format as the interactive video events. The interactive videos inside the playlist post their own interactive_video_* events to the playlist, not to your page, so listen for the playlist events instead.

playlist_completed​

Sent when the viewer completes the last remaining item in the playlist. Sent at most once per playlist attempt, and not sent when the viewer reopens a playlist they have already completed.

FieldTypeDescription
playlistIdnumberID of the playlist
titlestringTitle of the playlist
userIdnumberViewer's WeVideo user ID
firstNamestringViewer's first name
lastNamestringViewer's last name
attemptIdnumber | nullID of the playlist attempt
assignmentIdnumber | nullAssignment ID, when viewed as part of an assignment

playlist_exited​

Sent when the viewer clicks Save & Exit, after their progress has been saved. Sent every time, so clicking it again sends it again.

FieldTypeDescription
playlistIdnumberID of the playlist
titlestringTitle of the playlist
userIdnumberViewer's WeVideo user ID
attemptIdnumber | nullID of the playlist attempt