Video Tracking
When a video loads in a view, call trackVideo to send Chartbeat the video information (see definitions below):
CBTracker.shared().trackVideo(
"/video/123", // viewId
"My Video", // title
"https://...jpg", // thumbnail (may be null)
0L, // engagedTime (seconds)
300_000L, // duration (milliseconds)
"s2", // playState — see below
0L, // contentTime (seconds)
0L // playerTime (milliseconds)
);Call updateVideoPlayState every few seconds while a video is playing to send the current video state.
CBTracker.shared().updateVideoPlayState(
"s2", // playState — see below
300_000L, // duration (milliseconds)
0L, // engagedTime (seconds)
0L, // contentTime (seconds)
0L // playerTime (milliseconds)
);viewId
A string unique identifier for this video, starting with a slash ('/'), similar to a relative path on a website (p)
title
A string title for the content of the video (i)
engagedTime
The amount of video played, including ads, in seconds (E)
duration
The length of the video in milliseconds (_vd)
playState
The play state: "s1" = unplayed, "s2" = played, "s3" = paused/stopped, "s4" = finished (_vs)
contentTime
The amount of content played, excluding ads, in seconds (_vce)
playerTime
The time reported on the video player, in milliseconds (_vpt)
Play states
Value
Meaning
s1
Unplayed
s2
Played
s3
Paused / stopped
s4
Finished
Last updated
Was this helpful?