Option to delay showing of ads until essential images have been loaded
Currently there is no way of delaying an ad to appear only after the images have finished loading. Since animated ads are often made up of several independent images this leads to the ad appearing piece by piece; and unless loading indicators have been disabled on all images it's also full of scattered dot animations.
In JS based ads we always preload images since we believe that not showing an ad for a slightly longer period of time is better than showing a partially rendered one that looks broken, even if it's just for a split second. This is also the behavior that our clients are used to.
It would therefore be very useful to have a mechanism for specifying which images need to be loaded before the ad is shown. Perhaps this could be added in the form of a "preload" attribute on amp-img so that some images can be marked as essential while others can still be loaded progressively?
/to @dvoytenko @lannka @jasti
Currently we delay showing of the ad until we receive render-start event - thus we try to show the ad the sooner the better. We could extend that. But some low-hanging fruit: we definitely should NOT show loading indicators inside the ad since the ad itself has the loading indicator.
@lexandera is that from an advertiser's perspective or publisher's perspective? Since implementation wise it will be different. For instance, we would provide publisher an attribute in amp-ad like wait-for="ini-load". If it's for advertiser to have the control, then we need to come up with something else.
This is for advertiser control.
I'd definitely not want to allow this to customize by the publisher. Advertiser is ok, but also minimal. Btw, advertiser can do this already via their specific a4a implementation. Again, I think most of this is fixable with some low-hanging fruit optimizations, such as removal of unneeded loading indicators.
@dvoytenko From my understanding of this the problem isn't that a loading indicator is shown, but that the ad is displayed before the images are loaded, so the ad content could look "broken".
How can this be fixed by a specific A4A implementation?
Are we ok with the creative appearing blank (meaning the loading indicator has been removed) until the resources in question are loaded? If so, ideally we would use an amp extension (e.g. amp-bind) to remove visibility:hidden or similar CSS from the creative elements once load fires on the amp-img elements in question.
Dima, by A4A implementation do you mean that the creative would somehow message to the ad tag when the creative is ready at which time the creative would fire render-start? How would an AMP creative message the tag? We would need some new postMessage based API. Perhaps bind or analytics would allow for this?
On Tue, Mar 14, 2017 at 4:16 PM Alan Orozco [email protected] wrote:
@dvoytenko https://github.com/dvoytenko From my understanding of this the problem isn't that a loading indicator is shown, but that the ad is displayed before the images are loaded, so the ad content could look "broken".
How can this be fixed by a specific A4A implementation?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ampproject/amphtml/issues/7952#issuecomment-286473881, or mute the thread https://github.com/notifications/unsubscribe-auth/ABr0L46SviZAmIFF3rXIw5E14__QyMu8ks5rlr14gaJpZM4MSU8h .
@alanorozco
the ad is displayed before the images are loaded, so the ad content could look "broken". How can this be fixed by a specific A4A implementation?
This is not any different from what we do for normal AMP docs: we have some blocking rules, but overall we show it as soon as we can. I think typically the problem shows with animations: when animations start even before all images have been loaded. This problem we can solve on the animation level.
@keithwrightbos
How would an AMP creative message the tag?
Ideally we wouldn't do this and would rely on existing rules for showing content. As mentioned above, we can resolve animation use cases directly.
However, if we ever did something like this, the only approach I see is to mark some elements as "render blocking". If present, these elements would block "render-start" signal of the page until they are loaded. So, there would be NO need for amp-bind or additional analytics bindings to trigger this signal. Currently, the parent page hides content and runs "loading" indicator until the embed's "render-start" signal is received.
@dvoytenko
This problem we can solve on the animation level.
True, but I believe this also applies to cases without animation (e.g. overlaying text or buttons on an image that hasn't been loaded yet).
@alanorozco can you please review your design with @dvoytenko for this? Thanks.
@jasti There isn't a design for this yet, I will update this issue once that's ready
Design here. Will present during review meeting today.
The animations now correctly wait for all dependent elements as defined in #7921. The next step here is to disable all loading indicators inside an Ad/embed. The actual blocking of rendering however, I believe, we should not do. Let's complete all other issues and reassess.
@alanorozco When you get a chance, please go ahead and disable loading indicator inside embeds, including in-a-box and FIE.
That's a long(ish) task. Will create a separate issue.
Still doesn't solve the original two issues.
- Some assets could appear on screen before all assets appear, giving the ad a 'broken' feeling
- Some animations might be triggered before assets have even loaded, giving the user a broken animation.
Let's disable loading indicators inside embeds but explore if custom resource dependencies is something we want to do. Moving to prioritized FR.
This issue hasn't been updated in awhile. @alanorozco Do you have any updates?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.