Use useVideoAttentionTracking for tracking YouTube player attention time#16178
Open
SHession wants to merge 2 commits into
Open
Use useVideoAttentionTracking for tracking YouTube player attention time#16178SHession wants to merge 2 commits into
useVideoAttentionTracking for tracking YouTube player attention time#16178SHession wants to merge 2 commits into
Conversation
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
SHession
commented
Jun 16, 2026
| const id = `youtube-player-${uniqueId}`; | ||
|
|
||
| const [isInView, setNode] = useIsInView({ | ||
| debounce: true, |
Contributor
Author
There was a problem hiding this comment.
I was seeing some inconsistent behaviour on YouTube videos on Fronts in Safari. Adding debounce seemed to help. Would value a second opinion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
As requested by the Ophan team, the current implementation of the YouTube player means attention times under-report as there may be little engagement when a video is playing. The historic mechanism to ensure Ophan continues to tracking attention time for video has long been unused.
This PR adds component attention time and ensures page attention time is captured by using the
useVideoAttentionTrackinghook implemented into the SelfHosted video player. That hook ensure attention time updates continue to be sent by dispatching events the Ophan tracker expects/Hook:
dotcom-rendering/dotcom-rendering/src/lib/useVideoAttentionTracking.ts
Line 54 in 9c76205
dotcom-rendering/dotcom-rendering/src/lib/useVideoAttentionTracking.ts
Line 62 in 9c76205
Ophan
Ophan Tracker JS - Attention Tracking
Why?
This PR will improve the attention time tracking for YouTube videos as requested by the Ophan team.