Amphtml: Safari blocks <amp-analytics type="googleanalytics"> pageview requests

Created on 13 Nov 2018  路  10Comments  路  Source: ampproject/amphtml

What's the issue?

Affects: Safari iOS

  1. Enable the Develop menu in Safari Preferences, then click on the menu: 'Develop > Enter Responsive Design Mode'. Then select a mobile device such as 'iPhone 8',
  2. On the url bar go to: https://www.google.com/amp/s/www.travelsupermarket.com/en-gb/holidays/amp/spain/canary-islands/tenerife/
  3. Open the developer tools and go to the network tab, then filter by 'collect'
  4. When the page loads, the 'pageview' request will not be sent. Other requests such as the scroll pings work fine.

Incidentally, if you repeat these steps on Google Chrome, everything works as expected.
screen_shot_2018-11-13_at_11_21_30

analytics

Most helpful comment

After a couple hours of investigation, Here's what I found

  1. I am able to reproduce the issue with Safari
  2. It happens both with https://www.google.com/amp/s/www.travelsupermarket.com/en-gb/holidays/amp/spain/canary-islands/tenerife/ with viewer and https://www.travelsupermarket.com/en-gb/holidays/amp/spain/canary-islands/tenerife/ w/o viewer
  3. I can't reproduce with a simple local page with <amp-analytics type='googleanalytics'>
  4. I am still able to reproduce the issue when running the site with proxying and using local build script
  5. I am able to confirm that navigator.sendBeacon(pageviewUrl) is called when tracing the issue. Which means the pageview event is handled correctly.
  6. Though navigator.sendBeacon(pageviewUrl) hasn't been sent, no pageview request can be found under the Safari Network tab
  7. To verify that the request has been sent out, I changed the pageviewUrl and have it sent to my local server instead. Local server has received the request.
  8. I also tried calling naviator.sendBeacon(pageviewUrl) manually, where I copied the resolved pageviewUrl. I am not able to see the request in Safari Network tab. However to verify it's not some special character that breaks the request, I replaced the pageviewUrl domain with the localhost domain. I was able to receive the request, AND I was also able to locate the request in Safari Network tab then. cc @avimehta Do you have any idea on why this is the case?

@RonnieWinter Did you see a decrease of pageview in Safari server side? I have a feeling that this is only an issue with Safari Network tab.

Thanks @torch2424 for the help today

All 10 comments

/to @zhouyx @jeffjose

I'll take a look.

After a couple hours of investigation, Here's what I found

  1. I am able to reproduce the issue with Safari
  2. It happens both with https://www.google.com/amp/s/www.travelsupermarket.com/en-gb/holidays/amp/spain/canary-islands/tenerife/ with viewer and https://www.travelsupermarket.com/en-gb/holidays/amp/spain/canary-islands/tenerife/ w/o viewer
  3. I can't reproduce with a simple local page with <amp-analytics type='googleanalytics'>
  4. I am still able to reproduce the issue when running the site with proxying and using local build script
  5. I am able to confirm that navigator.sendBeacon(pageviewUrl) is called when tracing the issue. Which means the pageview event is handled correctly.
  6. Though navigator.sendBeacon(pageviewUrl) hasn't been sent, no pageview request can be found under the Safari Network tab
  7. To verify that the request has been sent out, I changed the pageviewUrl and have it sent to my local server instead. Local server has received the request.
  8. I also tried calling naviator.sendBeacon(pageviewUrl) manually, where I copied the resolved pageviewUrl. I am not able to see the request in Safari Network tab. However to verify it's not some special character that breaks the request, I replaced the pageviewUrl domain with the localhost domain. I was able to receive the request, AND I was also able to locate the request in Safari Network tab then. cc @avimehta Do you have any idea on why this is the case?

@RonnieWinter Did you see a decrease of pageview in Safari server side? I have a feeling that this is only an issue with Safari Network tab.

Thanks @torch2424 for the help today

@zhouyx Thanks for your reply. Yes we have seen a drop in pageview requests on our server side, and this is what lead us to investigate and find this issue.
Regards

Thank you @RonnieWinter. Could I get a bit more information on the data to help me investigate.

  1. When did the drop first happen?
  2. How much percentage is the drop?
  3. Does the drop happen across all Safari version? Mobile and Desktop?

Thank you!

Not sure why.

@zhouyx If I understand your investigation so far correctly, sendBeacon pings are not getting sent from the browser to GA. If you change the URL to point to a local server, the pings do go through and they also show up in Network tab. Is that correct?

@RonnieWinter Is this happening throughout your site or on one particular section? A date when this started happening will help debug the issue more (to check if there were some releases around that time). Also, in the reports, is the drop only on Safari or does it happen for other browsers as well?

@avimehta Based on my experiment. I can see #sendBeacon() being called. But I am not sure if the pings are sent to GA. One thing worth mention is that I am able to locate other scroll event pings in the Network tab.

If you change the URL to point to a local server, the pings do go through and they also show up in Network tab. Is that correct?

That's correct.

@avimehta
Hi, yes it seems like the pageview doesn't appear on the network tab for Safari, but it is actually being sent.
I have just had confirmation from the data team that they can see that there are iOS safari users that do register 'pageviews'. The real problem is that they do not convert once they click the search button (which takes them to the results page). This would therefore imply that their ClientIDs are changing once they leave the AMP cached page, to go to the results page (going cross-domain). Which means this bug is actually a manifestation of the issue described in #19172

Thank you @RonnieWinter for the investigation! I've also verified with the ampproject.org data, and no signs of pageview drop has been identified.

Lessons learned about Safari network tab : )

fyi, I am looking into the cross-domain issue and will report back here or on the other bug once I get some time to look into it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cvializ picture cvializ  路  3Comments

gmajoulet picture gmajoulet  路  3Comments

aghassemi picture aghassemi  路  3Comments

choumx picture choumx  路  3Comments

aghassemi picture aghassemi  路  3Comments