Conditionally load component based on size of another
Got an odd one to try and work out how to do in AMP.
Let's say there is a container in a grid that is 600 pixels high. The current 'web' behaviour I'm trying to match is:
An ad is loaded in the container. If the ad is is 600 pixels tall then nothing else happens as the area is filled.
If the ad is 300 pixels high then an additional call is made to bring in a second 300 pixels ad so that the container is full.
You can see the current implementation in the right of the top row on desktop here: http://www.independent.co.uk
/to @camelburrito /cc @ericlindley-g
Is there a non-ads use case for this?
/cc @jasti
Could this be solved by <amp-auto-ads>?
@tlong2 for if this relates to <amp-auto-ads>.
@bjalford this is indeed an odd one. Do you plan to see this sort of thing happen in mobile? I don't know of any other publisher doing this/ wanting this, so will be low priority for the core team. Please feel free to send a PR though.
I don't think <amp-auto-ads> will be particularly useful for this. Doesn't sound like what's being suggested here would ever need to resize the container. It would just need to shrink the first <amp-ad> to the size of it's contents and then insert a second <amp-ad> in the remaining space.
Doesn't sound like what's being suggested here would ever need to resize the container. It would just need to shrink the first
to the size of it's contents and then insert a second in the remaining space.
That's exactly what I mean. A call is made using <amp-auto-ads>, it decides it can fit 2 300px ads into this 600px container, it returns both ads.
I guess it depends what is making the choice about how big the ad is. I assumed that @bjalford was talking about having a 600px
If my interpretation above is correct, then the sizing decision is not something <amp-auto-ads> could help with since all it's logic runs before any kind of ad request is made.
Thanks - just a note to say I'll reply beginning of next week
Ping @bjalford