But what about the ads?

“Cool, you made the content faster, but what about the ads? Aren’t they the worst offenders for page load times?”

  • Content first. AMP loads ads after the rest of the content, so ads would never slow down load time.
  • Containment. AMP strictly manages the area of a page that ads can access and control to a well defined rectangle. Among other things this avoids pages “jumping around” as ads pop in.
  • Mitigation. AMP mitigates against various JavaScript worst practices often found in ad tech such as `document.write`, by limiting their effect on the ad itself vs. the entire page.
  • Intervention. AMP slows down timers such as those used for animations for ads that are not currently visible, so that ads use much less battery and CPU when they aren’t being seen. Firefox, Safari, Opera and Chrome have recently started doing this by default and we’ll be happy to delete the code when this rolls out to more users. Because in AMP all legacy ads run inside iframes (many ads outside of AMP have access to the host page), these new browser interventions work particularly well in AMP.

The coordination problem

Source: Daniel Stockman, License: CC BY-SA 2.0

That is the coordination problem: Even perfectly engineered ads can, in aggregation, negatively impact user experience.

Introducing AMP for ads

“AMP worked super well for general content. Couldn’t we just use it for ads?”

Separating ad requests from ad rendering

Example video of the performance improvements that A4A brings to simple ads.

Going deeper: A restricted subset of AMP

Re-using AMP

The coordination solution

Source: Daniel Stockman, License: CC BY-SA 2.0

Cross platform

So, that is what we are doing with ads

  • ads will be statically analyzable to be safe and behave well,
  • they will be able to use a common set of functionality to significantly reduce bandwidth consumption,
  • CPU usage will be limited to on-screen ads, maximizing battery life,
  • and ads will be coordinated with the page making sure that primary content and functionality can always be buttery smooth at 60 frames per second.

--

--

--

Chief Architect at Vercel. Curator of @JSConfEU. Writer at industrialempathy.com. he/him

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Malte Ubl

Malte Ubl

Chief Architect at Vercel. Curator of @JSConfEU. Writer at industrialempathy.com. he/him

More from Medium

I got out of bed before 10:30am on three consecutive days and you can too!

What are the preferred working hours in Remote Culture?

A Gen Z’ers Guide To Making Your Workspace Progressive

3 Ways to Build Trust with Remote and Hybrid Teams