I am trying to setup a multi-size DFP ad unit that will show the biggest ad possible.
<amp-ad
width="auto"
height="250"
data-override-width="970"
data-override-height="250"
data-multi-size="300x250,970x250,970x90"
data-multi-size-validation="false"
type="doubleclick"
data-slot="..."
</amp-ad>
But the unit is sometimes loading creative that is too large for the available viewport. For example, on mobile screens it is showing 970x250 creatives.
You can achieve that via media queries and multiple amp-ad tags.
That thought did occur to me, and I am working on it. But isn't this a basic feature? Especially since multi sized are recommended to increase auction pressure.
The returned creative will be one of the sizes specified on the request, regardless of viewport size. So, if you request a creative of size 970x250, you may very well get a creative of size 970x250, even if your viewport is smaller than that. I'm not all that familiar with media queries, but it sounds like that's the route you want to go.
Will it be possible to expose defineSizeMapping API of doubleclick in the corresponding ad type via a data attribute say data-size-mapping?
This issue hasn't been updated in awhile. @glevitzky Do you have any updates?
This issue hasn't been updated in awhile. @glevitzky Do you have any updates?
This seems pretty counter-intuitive behavior to go over the constraints of the viewport.
Closing as it appears there is a solution with media queries. Please reopen if further discussion is needed.
Most helpful comment
The returned creative will be one of the sizes specified on the request, regardless of viewport size. So, if you request a creative of size 970x250, you may very well get a creative of size 970x250, even if your viewport is smaller than that. I'm not all that familiar with media queries, but it sounds like that's the route you want to go.