Measurement
Video tracking
An original eight-second clip, plus an optional YouTube embed after consent. Milestones, watch time, and the dataLayer stay on this page.
Understanding the labHow to use it and why you'd want to
Why you'd want to
An eight-second clip emits start, milestone, complete, and engagement through the dataLayer, and resume seconds are kept in localStorage only after Accept. The lab does not call Adobe.
How to use it
- Play the clip. video_start is sent once.
- A milestone fires once. A seek is classified on the page.
- Attention is scored locally.
- A resume second is saved only after Accept.
Simulation. The clip was generated for this lab. Events go to the dataLayer only with measurement consent, and they show in the floating inspector. No new paid service.
HTML5
This clip
- Startup: missing
- In view: missing
- Buffering: no
- Bitrate: missing. This file has one rendition.
- Attention: missing
- Rewatched: none yet
- Skipped: none yet
- Next chapter: missing until a seek
- Cut: missing until playback passes 25% or 50%
No player event yet.
Why am I seeing this? Play, pause, seek, ended, and the 10/25/50/75/90/100 milestones come from the media element. Watch time counts only while it is playing. Timeline position is currentTime. A hidden tab pauses playback. Bitrate is missing because this file exposes one rendition.
YouTube
Optional embed
idle
Why am I seeing this? The IFrame API loads only after this button and only when measurement consent is on. The host is youtube-nocookie.com. The film is Big Buck Bunny by the Blender Foundation, Creative Commons Attribution. Vimeo is not embedded: its player.js events are similar, but the iframe is a third party unless you use a privacy-enhanced embed, and this page does not call Vimeo.
WalkthroughHow we built itShowHide
Example vendor setup is marked below. eVar and event numbers are examples. This lab does not call Adobe.
The video lab watches an eight-second clip, emits start, milestone, complete, and engagement events through the dataLayer, and keeps resume seconds in localStorage after Accept. The lab does not call Adobe.
Send video_start once
The first play calls trackVideoEvent for video_start with the title, the html5 provider, the clip path, the duration, and the current time. It also calls trackLab for lab_interaction with label html5-start.
Emit a milestone once
onTime adds elapsed time only when the delta is between 0 and 1.2 seconds, then freshMilestones emits video_progress for 10, 25, 50, 75, 90, and 100 the first time the percent crosses each mark.
Classify a seek and score attention locally
classifySeek names chapters that were skipped or rewatched. attentionScore multiplies watched seconds over the duration by the visible percent. Those numbers are drawn on the page.
Save a resume second only after Accept
While consent is granted, onTime writes the floored current time to site.video.resume.v1. readResume returns null unless that same consent key is granted. The YouTube embed loads only after Accept.
Queue a lab view as well
useLabView queues lab_interaction with lab_id video-tracking, action view, and label page, once, after Accept. pushEvent returns before any video event when consent is off.
From the code
Percent, the milestone filter, and the seek classifier. Chapters are three fixed slices.
export function playbackPercent(current: number, duration: number) {
if (!Number.isFinite(duration) || duration <= 0 || !Number.isFinite(current)) return null
return Math.min(100, Math.max(0, (current / duration) * 100))
}
export function freshMilestones(seen: readonly number[], percent: number | null) {
if (percent === null) return []
return VIDEO_MILESTONES.filter((mark) => percent >= mark && !seen.includes(mark))
}
export function classifySeek(from: number, to: number) {
const skipped = VIDEO_CHAPTERS.filter((chapter) => from <= chapter.start && to >= chapter.end).map((chapter) => chapter.id)
const rewatched = VIDEO_CHAPTERS.filter((chapter) => to < from && to >= chapter.start && to < chapter.end).map((chapter) => chapter.id)
return { skipped, rewatched }
}The first play queues video_start. The first playing frame queues a startup engagement.
}
function onPlay() {
const video = videoRef.current
if (!video) return
playStarted.current = performance.now()
if (!started.current) {
started.current = true
emit("video_start", base(video))
note("video_start")
trackLab(LAB, "html5-start")
}
}
function onPlaying() {
setBuffering(false)
if (playStarted.current === null || startupMs !== null) return
const ms = Math.round(performance.now() - playStarted.current)Google and Adobe
Google queues video_start after Accept. Adobe is an example of the same fields.
After Accept, the first play queues video_start. Later playback can queue video_progress, video_complete, and video_engagement. Opening the lab also queues lab_interaction with lab_id video-tracking, action view, and label page. trackVideoEvent goes through pushEvent, which does nothing until consent is granted. This is queued only after Accept. This site does not call Adobe.
Simplified shape of the object queued after Accept. Register any new parameter as an event-scoped custom dimension. This site does not call gtag('set').
dataLayer.push({
event: "video_start",
video_title: "Lab clip",
video_provider: "html5",
video_current_time: 0,
})Example implementation. This site does not call Adobe. eVar113, prop113, and event113 are example variable numbers. In Launch, a data element reads the value and a rule sends it when the value changes. In the report suite, enable eVar113 with Most Recent allocation and expire it on the hit. A processing rule is unnecessary if the data element maps straight to that eVar.
Example alloy payload. _example is a placeholder schema, not a real tenant.
alloy("sendEvent", {
xdm: {
eventType: "web.webinteraction.linkClicks",
_example: {
videoTitle: "Lab clip",
},
},
})Example hit. eVar113 is hit-scoped in this example. prop113 dies at the same hit.
s.eVar113 = "Lab clip"
s.prop113 = "Lab clip"
s.events = "event113"
s.linkTrackVars = "eVar113,prop113,events"
s.linkTrackEvents = "event113"
s.tl(true, "o", "video_start")Translation
Each lab field, the GA4 name, and the example Adobe variable. Scope is the part that usually gets lost in the translation.
Title
GA4. Parameter video_title on video_start, video_progress, and video_complete.
Adobe. Example eVar113, expire on the hit.
Scope. Event. A user property would keep this clip’s title on the next visit.
Provider
GA4. Parameter video_provider. The clip sends html5. The optional embed sends youtube.
Adobe. Example prop113, which dies at the hit.
Scope. Event on the hit. It is not a visit property.
Milestone
GA4. Parameter video_percent on video_progress. Marks are 10, 25, 50, 75, 90, and 100.
Adobe. Example eVar113 for one percent. Not a stored progress on the user.
Scope. Event. Each mark is its own hit.
Attention score
GA4. Not sent. attentionScore is drawn on the page.
Adobe. Example prop113. Do not write the score into a prop. Not sent.
Scope. A local calculation. It is not an event and not a user property.
Recommended next
Why these picksReading path transitions…