On an AMP story with multiple pages:
All browsers
Version 2007302351001
@ampproject/wg-ui-and-ally
Is there anyone from @ampproject/wg-ui-and-a11y familiar with video analytics who can help us (@ampproject/wg-stories) debug this integration?
@nainar (as the facilitator of the UI and a11y working group), do you know what the next steps would be to get insights from someone in the team knowledgeable about video analytics?
Friendly ping to UI folks
@kristoferbaxter do you know who might be able to help us look into this? I think this will require understanding from both the stories and amp-video side, and want to make sure we're designing a solution correctly here.
@alanorozco @ampproject/wg-analytics
@micajuine-ho worked on this before. Do you mind taking a look? Thanks!
Yes, I can take a look at this :)
The issue is that the video-manager-impl is never receiving the VideoEvents.LOAD from amp-video, and so the video's analytics percentage tracker is never started.
We short circuit the video's layoutCallback (in amp-video), because we want it to be handled by the media pool within amp-story-page:
But by not returning promise, we are not dispatching the VideoEvents.LOAD event:
https://github.com/ampproject/amphtml/blob/44ea165c34f9cce37979f2849a88ca90016d568a/extensions/amp-video/0.1/amp-video.js#L357-L367
Off to @ampproject/wg-stories for a proper fix.
Thanks @micajuine-ho!
@mszylkowski if you have extra cycles coming up soon, can you investigate based on what Mica posted above?
Will assign it to @micajuine-ho as well to help on this.
From what I've seen, dispatchCustomEvent is being called for all the videos, but amp-analytics handleEvent does not get called for the events coming from the other pages
We short circuit the video's layoutCallback (in amp-video), because we want it to be handled by the media pool within amp-story-page:
But by not returning promise, we are not dispatching the VideoEvents.LOAD event:
The fact that the VideoEvents.LOAD event is not dispatched has nothing to do with the early return. The loadPromise will resolve no matter what, this is totally independent from the video.layoutCallback return value.
The issue is that the video element passed to the loadPromise will later be replaced by the media pool. When the media pool does this switch, it notifies the amp-video extension through the resetOnDomChange method:
This method should start listening for load events and dispatch VideoEvents.LOAD when required. We should not spread the logic across different files, amp-video should keep handling all the video logic and events triggering.
Most helpful comment
The fact that the VideoEvents.LOAD event is not dispatched has nothing to do with the early return. The loadPromise will resolve no matter what, this is totally independent from the
video.layoutCallbackreturn value.The issue is that the video element passed to the loadPromise will later be replaced by the media pool. When the media pool does this switch, it notifies the
amp-videoextension through the resetOnDomChange method:https://github.com/ampproject/amphtml/blob/7e21559950ab9bf74650fd6d4ca02d6cc373685f/extensions/amp-video/0.1/amp-video.js#L610-L623
This method should start listening for load events and dispatch VideoEvents.LOAD when required. We should not spread the logic across different files,
amp-videoshould keep handling all the video logic and events triggering.