Bug 147885

Summary: [Meta] Beacon API support
Product: WebKit Reporter: Iraê <irae>
Component: New BugsAssignee: Chris Dumez <cdumez>
Status: ASSIGNED ---    
Severity: Normal CC: ap, binh.phan, cdumez, dave, joepeck, schmod, webkit-bug-importer, yahoomobile
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=177641
Bug Depends on: 175007, 175069, 175076, 175192, 175212, 175264, 175330, 175386, 175395, 175401, 175410, 175443, 175445, 175723, 175746, 175839    
Bug Blocks:    

Description Iraê 2015-08-11 11:07:58 PDT
User metrics is a very common way of measuring a product success, be it a small startup or products like Yahoo Search, which I currently work on.
Most of the motivation for this new spec is expressed in the spec itself and other browser vendors are already onboard and have this Last Call Editor's draft spec on their stable version of the browser.

http://www.w3.org/TR/beacon/

I would like to illustrate our particular use case in order to help WebKit prioritize this request. In legacy Yahoo Search we track most of the events server-side, even before HTML is sent to the client. This is fine for the "legacy" web, almost without Javascript. The current iteration of Yahoo Search is a so called "Single Page App", and all the runtime and even navigation is handled by Javascript and updates to the page are using XHR to fetch data. Moving user metrics aggregation to the client has been a challenge and we do variations on the techniques described in the aforementioned spec.

In our particular case, we would appreciate the `navigator.sendBeacon` API not only for the reasons stated there, but also we are very found of the following paragraph:

> "The User Agent SHOULD transmit data at the earliest available opportunity, but
> MAY prioritize the transmission of data lower compared to other network
> traffic. The User Agent SHOULD make a best effort attempt to eventually transmit
> the data."

Specially in areas with low coverage of cellular data access, this would mean a lot perceived performance improvements for the end-user, as we could use the new API to send all user metrics data, not only the clicks that happened before unloading the document, and Safari could potentially hold this requests until user has higher bandwidth available. Our search results would potentially load faster, the website the user is navigating to would load faster.
Comment 1 Radar WebKit Bug Importer 2016-03-28 14:18:59 PDT
<rdar://problem/25396198>
Comment 2 Joseph Pecoraro 2017-09-28 22:19:34 PDT
Chris, all sub-bugs of this are complete, does anything remain here?

I did file this one:
<https://webkit.org/b/177579> Include "beacon" ResourceTiming entry