Re: [Beacon] spec feedback + few suggestions

On Sun, Nov 10, 2013 at 12:57 PM, David Bruant <bruant.d@gmail.com> wrote:

> Typically analytics beacons are set in the onunload or unbeforeunload
> events. However, analytics also sends data while a page is active.
> Typically you do this to avoid not getting data in case when the user would
> simply close the browser.
>
> This is already possible with xhr. The only thing sendBeacon adds is
> better scheduling for better battery use... and even that is arguable; an
> implementation could decide to better schedule xhrs.


That's not entirely true. Yes, in theory you can patch XHR such that next
time you make a request you also flush some pending queue of beacons, but
this is (a) non-trivial to implement / error-prone, and (b) does not work
across multiple apps / tabs - e.g. if you have multiple beacons firing
across multiple open tabs/apps, sendBeacon can aggregate those events and
dispatch them all at once.

Received on Monday, 11 November 2013 02:42:38 UTC