Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch reporting is difficult due to when CLS reports are dispatched #165

Closed
philipwalton opened this issue Jul 1, 2021 · 0 comments · Fixed by #166
Closed

Batch reporting is difficult due to when CLS reports are dispatched #165

philipwalton opened this issue Jul 1, 2021 · 0 comments · Fixed by #166

Comments

@philipwalton
Copy link
Member

As of the current web-vitals version (2.0.1), the getCLS() function will not report (by default) unless the page's visibilityState is hidden.

This fits with our developer guidance, which has long been to use visibilitychange as a session-ending signal and the last reliable Page Lifecycle event.

What complicates this guidance, though, is due to browser bugs with Page Visibility in Safari the are many cases where developers still need to listen for the pagehide event in addition to the visibilitychange event.

If all you care about is monitoring CLS, then Safari bugs are not an issue because Safari does not support the Layout Instability API. However, you're using the web-vitals JS library as part of more comprehensive, cross-browser RUM implementation that batches multiple events together to send when the user is about to leave a page, this library fires the getCLS() callback too late.

To better accommodate batch reporting, this library should fire the getCLS() callback in the pagehide event (in addition to the visibilitychange event).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant