Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an experimental feature that would allow lux.js to measure user timing events that occur after the main beacon has been sent.
How it works
Users of lux.js provide an "allow list" of user timing events that can be sent after the main beacon.
Possible enhancements
Right now there is a hard-coded 100 ms wait time before sending a supplementary user timing beacon. This is to ensure user timing events that occur in quick succession are batched into a single beacon request. I don't have any data to back this up but I suspect 100 ms would not be long enough to prevent multiple beacons from being sent. We could expose this wait time as a configurable value.
Alternative solutions
Send late user timing before unload
Another solution would be to have a boolean
LUX.lateUserTiming = true
configuration option that enabled all late user timing events to be sent before the page unload event. This would require very little effort from lux.js users, and could even be enabled via the SpeedCurve UI. The biggest drawback is that there are potentially hundreds or thousands of user timing events that occur before the unload event - probably from third parties. This could result in a massive beacon payload, and put extra strain on our beacon pipeline.A variation of this solution is to keep the "allow list" approach but send the supplementary user timing beacon before unload rather than after a 100 ms timer.