amp-ad never initiated
What's the issue?
On one particular publisher (dallas observer) our amp-ad component (type="teads") is never initiated when we scroll over it, and I really don't understand why. The AMP Framework never init this amp-ad component so I'm unable to do anything
note: the publisher's page is valid AMP https://validator.ampproject.org/#url=https%3A%2F%2Fwww.dallasobserver.com%2Famp%2Fnews%2Fthe-whole-story-behind-dallas-city-councilman-kingstons-so-called-ethics-breach-10056516
How do we reproduce the issue?
-
just go to this url https://www.dallasobserver.com/amp/news/the-whole-story-behind-dallas-city-councilman-kingstons-so-called-ethics-breach-10056516
-
scroll to the amp-ad type="teads" component
-
as you can see, nothing append :( the teads tag is never called, no error, nothing...
What browsers are affected?
All
Which AMP version is affected?
All for this publisher only
Thanks for your help !
I noticed the ad has width=300 height=1 layout=responsive. Can you try with a more realistic height?
Hi @lannka , and thanks for your time
Sorry but this height is realistic for us, we use this behavior since almost two years across hundreds of publisher, but this case is really the first time for us.
As you can see here https://amp.teads.tv the height=1 is not a trouble for the AMP Framework, we use this behavior to avoid a "blank slot" effect if nothing to serve and closing request denied. In contrary we prefer ask for an opening if possible when an ad is available
So I really don't understand why on this specific AMP page this amp-ad component does not react like on others publishers
Do you mean you expect the request to be sent with this dimension, and request resize after the ad is back?
After debugging, here is the finding:
CSS display: table does not work with AMP layout=responsive.
When layout=responsive, we insert a placeholder div inside amp-ad with padding-top equals to the desired aspect ration. However, this trick does not work when the parent is display: table.
A quick work around for you is probably to use layout=fixed-height instead, since you're going to resize the ad anyway.
For a real fix of the problem, @dvoytenko @jridgewell any idea? Or we have to document it clearly that people should avoid display: table on layout=responsive?
Thanks a lot @lannka for your help on this !
I will contact the publisher to remove the display: table OR go to layout=fixed-height for our amp-ad component (easier for him I think)
I also think that is a good idea to put a note on the AMP layout README concerning the layout=responsive + display: table to avoid these kind of issue ;)
Thanks again AMP Team, we will try this behavior
Short of @jpettitt's intrinsic proposal, there's nothing else we an do to fix responsive inside 0-width containers.
I think @bpaduch already documented this kind of error with responsive?
You can fix it inside a responsive by adding min-width and min-height to the css. This will cause the floated element to have some size which will trigger the amp-ad to run and normal responsive behavior from there.
I just added this your page in chrome dev tools and the ad triggers
.Body amp-ad {
display: table;
margin: 20px auto;
min-width: 1px;
min-height: 1px;
}
Looks like you've also got an issue withe a http url that should be https based on the console message I'm seeing.
And yes the new layout=intrinsic will fix this. Not sure when that will go live.
I think @bpaduch already documented this kind of error with responsive?
I don't see it mentioned in amp-html-layout.md. @bpaduch can you confirm?
@lannka & @bpaduch- it's the same issue as I had with images. Because a layout=responsive amp-* tag has no intrinsic size (starts off 0x0) the browser renders the floated parent as zero width and then the runtime decides the tag isn't visible and doesn't bother to run it.
The new layout=intrinsic option will fix this by using an img withe a data url svg as the sizing element (img has intrinsic size) and that will cause the tag to inflate the floated parent. I'll commit an update to amp-html-layout.md with the new code. I'll also add it to the allowed layouts for amp-ad.
@lannka & @jridgewell - I appreciate Justin's confidence that I wrote something about it, but I cannot locate any mention of "no intrinsic size". This doesn't just only affect responsive, but also fill and and fixed-height; I guess wherever AMP doesn't have the full dimensions in a float. I am investigating to better understand this, so that I can better cover in the appropriate docs; of course, also including the new "intrinsic" layout.
@bpaduch :-) created an issue to track the documentation.
closing this for now.