Amphtml: Limit ad sizes by available width when using multi-size ads

Created on 21 May 2018  路  8Comments  路  Source: ampproject/amphtml

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.

A4A fast fetch Soon DiscussioQuestion monetization

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.

All 8 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

westonruter picture westonruter  路  3Comments

mrjoro picture mrjoro  路  3Comments

gmajoulet picture gmajoulet  路  3Comments

aghassemi picture aghassemi  路  3Comments

choumx picture choumx  路  3Comments