Using the Beacon API

Опубликовано: 22 Июнь 2026
на канале: Request Metrics
2,367
51

Users are so annoying! There they go, leaving the page before we can save the data to the API. Back in the old days, we would attach a `window.unload` handler and try to send an AJAX request, but this was slow and unreliable.

Enter the Beacon API to give us a better way.


The Beacon provides a reliable way to send a small amount of data after the page has been unloaded. It's not bound to the lifetime of the page and it doesn't slow down the user.


Read more at https://requestmetrics.com/making-of/...