- Print
Tracking video progress
- Print
This page guides how to receive video progress-related events using the messageCallback
's and EVENT_LOG
.
Video player starts with
ON_PLAYER_STARTED
.Viewing seconds can be tracked through
EVENT_LOG
, of which property name isplayer_active_seconds
.
ON_PLAYER_STARTED
var messageCallback = {
ON_PLAYER_STARTED: (payload)=> {
//immediately fired once user getting into the player
console.log('ON_PLAYER_STARTED',payload)
},
EVENT_LOG: (payload) => {
// console.log("event log fired", payload.name);
// console.log("payload", payload);
switch (payload.name) {
case "player_on_foreground":
//player came to foreground and active
console.log("player_on_foreground",payload);
break;
case "player_on_background":
//player went to background
console.log("player_on_background",payload);
break;
case "player_active_seconds":
//this event fired every payload.parameter.interval milliseconds. typically per 3seconds.
//you can track video progress by either activatedDuration or videoCurrentTime upon your needs
console.log("player_active_seconds",payload);
break;
}
},
}
ON_PLAYER_STARTED payload
Property name | Type | Description |
---|---|---|
ak | string | Accesskey |
ck | string | campaignKey |
isPreview | boolean | Indicates whether it’s preview or not |
EVENT_LOG payload
Property name | Type | Description |
---|---|---|
name | string | Name of event |
feature | "click" | "action" | “show” | Type of event |
parameter | JSON | Reference object of the event |
campaignKey | string | Unique Key of campaign |
Video progress-related events
Refer to the Full list of event (Tracking User Behavior) as well.
Event name | Feature | Parameter | Description |
---|---|---|---|
player_on_foreground | show | { "activatedAt": Number, "activatedDuration": Number, "mode": String, "videoCurrentTime": Number } | The player is shown on foreground:
|
player_on_background | show | { "activatedAt": Number, "activatedDuration": Number, "mode": String, "videoCurrentTime": Number } | The player went background:
|
player_active_seconds | show | { "activatedAt": Number, "activatedDuration": Number, "interval": Number, "mode": String, "videoCurrentTime": Number } | The heartbeat when the player is active:
|