Resetting core-web-vitals score on route change.

43 views
Skip to first unread message

Zajączkowski Szymon

unread,
Oct 11, 2024, 4:28:23 AMOct 11
to web-vital...@googlegroups.com

Hello!

Im trying to measure our SPA site with web-vitals, and to get more accurate score I was trying to “reset” the measurement when the route changes. But on current implementation of web-vitals it is not possible I assume.

 

Could you point me the way how could I achieve desired result, that is, to measure performance from “blank slate” on a new route?

 

Best regards, Szymon

Barry Pollard

unread,
Oct 11, 2024, 4:35:21 AMOct 11
to Zajączkowski Szymon, web-vital...@googlegroups.com
Hi Szymon,

That is currently not possible, for a couple of reasons:
  • The browser will not emit certain metrics (FCP, LCP, first-input) after interactions.
  • While in theory this still makes it possible to measure CLS and INP (since the browser keeps emitting those underlying events and web-vitals library could therefore reset and recalculate those metrics), correctly attributing those to the appropriate soft navigation (since they may be processed after the navigation) is tricky.
Chrome is looking to solve both issues as detailed here: https://developer.chrome.com/docs/web-platform/soft-navigations-experiment

And there is an experimental branch of web-vitals library to support this: https://github.com/GoogleChrome/web-vitals/pull/308

However, this currently requires flags to be enabled to opt into this, so it is not possible to measure for real users yet.

--
You received this message because you are subscribed to the Google Groups "web-vitals-feedback" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-vitals-feed...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web-vitals-feedback/AS4P251MB0682D053551C6A8F0157CBF5E5792%40AS4P251MB0682.EURP251.PROD.OUTLOOK.COM.
Reply all
Reply to author
Forward
0 new messages