amp-analytics not generating some visibility pings on Safari
Short description of your issue:
In some cases on Safari, amp-analytics appears to fail to generate visibility pings for amp-ad slots when it should.
How do we reproduce the issue?
- In desktop or iPhone Safari, with debugger network tab open, load this page: https://www-theatlantic-com.cdn.ampproject.org/c/s/www.theatlantic.com/amp/article/521262/?exp=a4a:2
- This page has two
<amp-ad type="doubleclick">slots. Scroll the first one into view. - Note that
amp-a4acreates anamp-analyticselement in theamp-adslot with the following config:
{"transport": {"beacon":false,"xhrpost":false},
"triggers": {
"continuousVisible": {
"on":"visible",
"visibilitySpec": {
"selector":"amp-ad",
"selectionMethod":"closest",
"visiblePercentageMin":50,
"continuousTimeMin":1000
},
"request":["visibility1"]
}
},
"requests": {
"visibility1":"https://pagead2.googlesyndication.com/activeview?id=ampim&avi=REDACTED&cid=REDACTED&o=${elementX},${elementY}&d=${elementWidth},${elementHeight}&ss=${screenWidth},${screenHeight}&bs=${viewportWidth},${viewportHeight}&mtos=0,0,${maxContinuousVisibleTime},${maxContinuousVisibleTime},${maxContinuousVisibleTime}&tos=0,0,${totalVisibleTime},0,0&tfs=${firstSeenTime}&tls=${lastSeenTime}&g=${minVisiblePercentage}&h=${maxVisiblePercentage}&r=v&pt=${pageLoadTime}&tt=${totalTime}&adk=1768659967"
}
}
- In Network tab, note a ping to
https://pagead2.googlesyndication.com/activeview, corresponding to the firstamp-adbeing in viewport for > 1 second. - Scroll second
amp-adinto view. Note a secondactiveviewping being sent. - Without scrolling, reload the page. Note that it remains centered on the second
amp-adslot. - Watch the Network tab. Note that no
activeviewping is sent, regardless of the time on screen. - Scroll back to the first
amp-adslot. Anactiveviewping should be sent when it has been on screen > 1 sec. - Scroll back to the second ad slot. No ping is sent, even when on screen for > 1 second.
- Scroll first
amp-adslot back into view and reload. Slot remains centered; no ping is sent. - Now can scroll down to second ad slot and do get an
activeviewping.
Repeat with Chrome and note that pings are sent in all cases.
What browsers are affected?
Safari, both iOS/phone and laptop. Verified on 10.0.3 (laptop) and 10.0 (phone); may be present on other versions.
Which AMP version is affected?
021490652623650 and 1490899213109
/cc @ampproject/a4a
To be clear, this is for Fast Fetch only.
Thanks for filing the details. Taking a look right now.
@tdrl Could you please try this with visibility-v3 experiment on?
tried locally, v3 seems to fix the issue. still looking for root cause
Found the root cause. v3 actually work around the bug accidentally. fix is here: #8535
I also want to point out that this bug should not be relevant to the discrepancy you saw between Android and iOS, since that was for delayed fetch.
I also want to point out that this bug should not be relevant to the discrepancy you saw between Android and iOS, since that was for delayed fetch.
Well, it's true that the iOS ActiveView rate is lower in DF iOS than in DF Android. We do need to understand that. But it's also the case that AV rates are lower in FF than DF in both iOS and Android (and dropped after the AMP release on Mar 23), while we would expect them to be higher. This issue might account for some of that gap.