Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

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

37 views
Skip to first unread message

Simon Lovejoy

unread,
Dec 10, 2024, 12:09:51 PM12/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, 12:13:04 PM12/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 web-vitals-feed...@googlegroups.com.
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