Browser & Web Performance · Middle · Question 66 of 75
What is the most reliable moment to send analytics before the user leaves?
- 1In an
unloadhandler with a synchronous XHR - 2In
beforeunloadwithalert() - ✓Correct answer: When
visibilitychangereportshidden, usingnavigator.sendBeaconorfetchwithkeepalive
Explanation
On mobile, unload often doesn't fire when the app is switched or killed. hidden is the last reliable signal.