InteractiveAdvertisingBureau / openvv

Other
81 stars 50 forks source link

Prefer an IntersectionObserver approach to viewability use cases (e.g. Viewable Impression) #120

Closed KenjiBaheux closed 7 years ago

KenjiBaheux commented 8 years ago

Hi,

This is Kenji Baheux from the web platform team in Chrome. We've been working on a new API called IntersectionObserver for viewability use cases. It's available in Chrome 51.

Essentially, IntersectionObservers let you know when an observed element enters or exits the browser’s viewport or any other area of interest.

Resources

Why IntersectionObserver should the preferred approach The current approach of polling every 100ms, with or without smart mitigations such as listening for scroll events, is inherently inefficient and a performance footgun (e.g inopportune calls to functions that lead to layout trashing).

To make this more concrete, here is a recent example. A couple of days ago, this tweet by John Gruber caught my attention: "One Chrome tab open to Forbes: CPU shot up to 77% and iMac’s fan came on for first time in weeks. Shocker that content blockers are popular." - John Gruber.

I did a deep dive and it turns out that this is largely explained by multiple third parties using the inefficient approach to viewable impression (as well as third parties that seem to be performing unwarranted work for ads that are offscreen). I'll reach out to individual stakeholders to get to the bottom of it.

jdreetz commented 7 years ago

I think we can close this issue now that Intersection Observer has been integrated into OpenVV.

KenjiBaheux commented 7 years ago

Great to hear!