2 ms·
Normally, the way that late loading adds cause reflow / layout shift / jumpiness is that you don't know what size an ad slot is going to be until after the auct
by jefftk 6y ago
Normally, the way that late loading adds cause reflow / layout shift / jumpiness is that you don't know what size an ad slot is going to be until after the auction. You could run an auction just for a single size, but you'd have fewer bidders and make less money, so publishers generally choose to offer a bunch of sizes. On a regular page, this looks like an ad coming in and shifting all the other content on the page.
AMP had several design goals, one of which was that it should be impossible to create pages with certain types of bad user experience, including reflow. An AMP page requires that every element on the page be sized only by information directly visible in the HTML (including inline CSS, but no inline JS) which allows the browser to lay the whole page out immediately. When an ad loads off screen there can be a request to the AMP runtime to resize the slot, but the runtime will reject the request if the resize might cause user visible effects.
More details: https://blog.amp.dev/2020/04/16/cumulative-layout-shift-in-amp/ https://blog.amp.dev/2020/04/16/cumulative-layout-shift-in-a...