bejamas / gatsby-plugin-web-vitals Goto Github PK
View Code? Open in Web Editor NEWGatsby plugin that sends Web Vitals metrics to Google Analytics.
License: MIT License
Gatsby plugin that sends Web Vitals metrics to Google Analytics.
License: MIT License
The 2.x branch of web-vitals updates the implementation of CLS to use new definition outlined in Evolving the CLS metric. We would like to take advantage of this but this plugin depends on 1.x branch ^0.2.1.
This plugin converts all of the event values to integers before sending to GA, here:
// Google Analytics metrics must be integers, so the value is rounded.
ev: parseInt(delta),
Considering the key range for the CLS metric is 0 to 0.25 (with anything above that being "Poor"), the rounded values are meaningless.
The documentation for web-vitals suggests multiplying the value by 1000, or a larger multiplier for greater precision.
// Google Analytics metrics must be integers, so the value is rounded.
// For CLS the value is first multiplied by 1000 for greater precision
// (note: increase the multiplier for greater precision if needed).
eventValue: Math.round(name === 'CLS' ? delta * 1000 : delta),
Without the multiplier, 0.22145
is 0
. With the multiplier, it is 221
, which will be resolved as 0.221
by dividing the value by 1000 in our reports.
I'll submit a pull request shortly.
I'm getting this error twice when using web.dev audits on my site.
hello,
Is this library compatible with the latest version of GA4? I see the last commit was 9 months ago and GA4 was released on Oct 2020 so I'm worried it is not been updated to use the latest version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.