amp-ad: Make viewport distance for prefer-viewability-over-views configurable
Currently, the data-loading-strategy option for prefer-viewability-over-views by default loads the ads only within 1.25 viewports of the current viewport. If publishers want to, we should allow this number to be configurable so publishers can make ads load more eagerly or lazily.
CC @cramforce
https://github.com/ampproject/amphtml/pull/3113
It's worth thinking through if we still want to call it prefer-viewability-over-views cause if the viewport height < 1.25, it's the other way around or we could ensure that the configuration can only make it lazier. Think I'd prefer that.
@jridgewell I remember this one. Do you want to take this on next sprint since you already have a head start? Think we should make the config to be strictly > 1.25. Will need a doc update - feel free to make it or let me know.
Can we have it accept a float > 1.0 and less than ?? eg data-loading-strategy="1.8"
What's a good upper bound for how early to load ads? I'd to see maybe 4 (so we have a default of 2.5 +/- 1.5)
Default is 3 viewports, so I think that'd be the max.
Do you want to take this on next sprint since you already have a head start?
/to @zhouyx
I think the right min value is 0 (meaning: Do not render unless visible).
Agree on 3 (default) for max, unless anyone has a very good argument otherwise.
@jasti @cramforce any idea when would this feature be out and live?
@jasti do you know if anything changed with ad viewability reporting on or after 04/05?
Visibility v3 was launched that day which I do believe caused AV rate to increase
cc/ @dvoytenko
@ronakrathod18, you can expect this feature to be production by first or second week of May.
To summarize the discussion here:
- We will reuse the existing attribute
data-loading-strategy, which currently only supports 1 valueprefer-viewability-over-views. We will make it to accept a float number within range of[0, 3]. - To follow the current behavior, we ignore the attribute if it has an invalid value.
- We keep the default value to 3 (if the attribute is not specified).
I will also remove prefer-viewability-over-views from our doc.
Hi @lannka - Is this feature request now live?
@ronakrathod18 Yes. Let us know how it goes.