Beacons not sent with active Service Worker

Hello,

after we noticed discrepencies in our tracking data we did some testing and it seems as if beacons sent via the navigator.sendBeacon API are not arriving at our servers in all cases. Specifically when leaving the page and trying to send the beacon via the visibilitychange, pagehide or unload event it is shown as (pending) in the dev tools console but does not reach our backend.

This only happens if a service worker is active. In this case the beacons are not even reaching the service worker. When we bypass the service worker all beacons are sent correctly and arrive at the backend. We tested this with a very simplistic service worker which would just fetch any request it receives.

So far we tested with this local device:
“Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/13.2 Chrome/83.0.4103.106 Mobile Safari/537.36”

Hello @marian.schaub ,

Hope you are doing well! We are very sorry to hear about your inconvenience.
We would like to try out the same scenario on the latest version of Google Chrome and Samsung Internet Browser Beta, and share your results.

To help us investigate your query further, please share the relevant screen recordings (Samsung Internet Browser and Chrome Developer Tools) as well. We would also like to request you to share access to the sample web application as well if possible.

Please let us know if you have any further queries. Looking forward to hearing back from you soon!

Best Regards,
Shuvo
Samsung Developer Program

Hey @shuvo.saha ,
I just built a small example page at Beacon Test Page .
Basically when navigating away from the page by clicking the link you will be taken to a second page which will show you all the beacons sent for the previous page impression. The page should send 5 beacons at the DOMContentLoaded Event and two beacons each for visibilitychange, pageHide and unload events. The info whether the beacon was fetched or ignored by the Service Worker is just present for some testing we did, it only says whether the service worker should fetch the beacon’s url or ignore it, since we wanted to see whether the issue was related the service worker actually doing the fetching. But we did not see any differences.

At first I was a bit surprised when testing with this setup since I was not able to replicate the issue, but then I noticed there had been a release last weekend which upgraded my Samsung Internet to version 14. In the new version I was not able to replicate the behaviour so far. I also tried the current Chrome for Android, where everything works fine. After rolling back Samsung Internet to version 13.2.3.2 the problem reappeared. I attached some screen captures for all three browsers. To bypass the active service worker I checked the ‘bypass for network’ option in the Application → Service Worker dev tools tab.

We also took a look into our data to investigate whether the new version had an impact on the beacons we received for our customers. While for version 13 we saw 78% fewer beacons overall in comparison to other browsers this dropped to 22% for version 14. So while a big part of the issue seems to be resolved with the release there still might be a problem. So far we were not able to replicate this though.

Best regards
Marian

Samsung Internet 13

Chrome

Samsung Internet 14

1 Like

Hello @marian.schaub ,

Thank you for your informative response. We really appreciate the level of detail and the sample web application shared!

Since the issue doesn’t occur in the latest version of the Samsung Internet Browser, it might be a known issue that has already been fixed. We would like to request you to inform all of your users to use the latest version of Samsung Internet Browser available for the best experience.

Please let us know if you have any further queries. Looking forward to hearing back from you soon!

Best Regards,
Shuvo
Samsung Developer Program

1 Like

Hey @shuvo.saha ,

do you have any insights into whether there could be an explanation why we are still seeing differences in the tracking data for Samsung Internet v14? We have just rechecked the data and while the difference is significantly lower than the gap we saw with v13, we are still seeing about 20% less beacons in v14 than we would expect.

Best regards
Marian

Hello @marian.schaub ,

Hope you are doing well! We are very sorry to hear about your inconvenience.
In order to investigate your query, we need additional information steps such as the exact reproduction path, screen recordings, Samsung Internet Browser S/W version.

Without these information, it is very difficult for us to adequately support you.
We hope you understand our limitations. Please let us know if you have any other queries.

Best Regards,
Shuvo
Samsung Developer Program