amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-analytics not generating some visibility pings on Safari

Open tdrl opened this issue 9 years ago • 8 comments

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?

  1. 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
  2. This page has two <amp-ad type="doubleclick"> slots. Scroll the first one into view.
  3. Note that amp-a4a creates an amp-analytics element in the amp-ad slot 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"
    }
  }
  1. In Network tab, note a ping to https://pagead2.googlesyndication.com/activeview, corresponding to the first amp-ad being in viewport for > 1 second.
  2. Scroll second amp-ad into view. Note a second activeview ping being sent.
  3. Without scrolling, reload the page. Note that it remains centered on the second amp-ad slot.
  4. Watch the Network tab. Note that no activeview ping is sent, regardless of the time on screen.
  5. Scroll back to the first amp-ad slot. An activeview ping should be sent when it has been on screen > 1 sec.
  6. Scroll back to the second ad slot. No ping is sent, even when on screen for > 1 second.
  7. Scroll first amp-ad slot back into view and reload. Slot remains centered; no ping is sent.
  8. Now can scroll down to second ad slot and do get an activeview ping.

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

tdrl avatar Mar 31 '17 13:03 tdrl

/cc @ampproject/a4a

tdrl avatar Mar 31 '17 13:03 tdrl

To be clear, this is for Fast Fetch only.

keithwrightbos avatar Mar 31 '17 14:03 keithwrightbos

Thanks for filing the details. Taking a look right now.

lannka avatar Mar 31 '17 16:03 lannka

@tdrl Could you please try this with visibility-v3 experiment on?

dvoytenko avatar Mar 31 '17 16:03 dvoytenko

tried locally, v3 seems to fix the issue. still looking for root cause

lannka avatar Mar 31 '17 16:03 lannka

Found the root cause. v3 actually work around the bug accidentally. fix is here: #8535

lannka avatar Mar 31 '17 19:03 lannka

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.

lannka avatar Mar 31 '17 19:03 lannka

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.

tdrl avatar Mar 31 '17 19:03 tdrl