Implementing WebVitals script to get page performance

Silver Contributor
Silver Contributor

Hello,

Has anyone tried implementing webVitals mentioned here-

https://github.com/GoogleChrome/web-vitals

I tried the easier option of implementing the CDN script hosted here- https://unpkg.com/web-vitals@0.2.2/dist/web-vitals.es5.umd.min.js

But I feel there is a timing issue and hence the data isn't getting stored in a UDO variable. The approach mentioned in the link for GTM works perfectly fine.

ksugam
2 REPLIES 2
Highlighted

Implementing WebVitals script to get page performance

Silver Contributor
Silver Contributor

Has anybody not worked on web vitals? Please let me know

ksugam
Highlighted

Implementing WebVitals script to get page performance

Silver Contributor
Silver Contributor

I have finally got this working. Since the webvitals data isn't available directly on page load, I capture each data point in localstorage. When user navigates to next page, I collect all data points into one and send it to analytics during the next page call.

ksugam