Possible to measure core-web-vitals library attribution build in the browser?

42 views
Skip to first unread message

Simon Lovejoy

unread,
Dec 10, 2024, 11:09:51 AM12/10/24
to web-vitals-feedback
Hello All,

I have inserted the following script at the foot of the body in each of my HTML pages, but very possibly incorrectly so:

<!--Script measure CWV-->
<script type="module">
import {
onCLS, onINP, onLCP,
onCLS(console.log);  
onINP(console.log);  
onLCP(console.log);
</script>
<!--End Script measure CWV-->

Although this appears to return values for the CLS, INP and LCP, there is nothing coming back for the attribution data - am i incorrect in thinking it is possible to get this from the browser as with the standard web-vitals-library?

Many thanks,
S

Barry Pollard

unread,
Dec 10, 2024, 11:13:04 AM12/10/24
to Simon Lovejoy, web-vitals-feedback
That code looks correct to me.

As you can see on this glitch project (which is just the default Glitch Hello world, with your details added):
https://yielding-cheerful-fedora.glitch.me/

BTW, the web-vitals repo is the better place to ask for specific questions about that library:
https://github.com/GoogleChrome/web-vitals/issues


--
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 [email protected].
To view this discussion visit https://groups.google.com/d/msgid/web-vitals-feedback/162bafe0-e60c-4674-bcc4-f5713b0f92b6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages