https://github.com/bejamas/gatsby-plugin-web-vitals
Gatsby plugin that sends Web Vitals metrics to Google Analytics.
https://github.com/bejamas/gatsby-plugin-web-vitals
gatsby-plugin performance-metrics web-vitals
Last synced: about 1 year ago
JSON representation
Gatsby plugin that sends Web Vitals metrics to Google Analytics.
- Host: GitHub
- URL: https://github.com/bejamas/gatsby-plugin-web-vitals
- Owner: bejamas
- License: mit
- Created: 2020-05-12T08:51:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-11-10T18:21:11.000Z (over 4 years ago)
- Last Synced: 2024-11-08T21:38:25.363Z (over 1 year ago)
- Topics: gatsby-plugin, performance-metrics, web-vitals
- Language: JavaScript
- Homepage:
- Size: 76.2 KB
- Stars: 26
- Watchers: 1
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gatsby-plugin-web-vitals
> [Web Vitals](https://web.dev/vitals/) is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience on the web.
This plugin sends Web Vitals metrics to Google Analytics.
## Install
`npm i gatsby-plugin-web-vitals`
or
`yarn add gatsby-plugin-web-vitals`
## Usage
```js
// gatsby-config.js
{
resolve: 'gatsby-plugin-web-vitals',
options: {
// The Google Analytics property ID; the reporting code won't be generated without it
trackingId: 'YOUR_GOOGLE_ANALYTICS_TRACKING_ID',
// An array with metrics you want to track and send to analytics
metrics: [`FID`, `TTFB`, `LCP`, `CLS`, `FCP`],
// Event Category (optional) { string }, default 'Web Vitals'
eventCategory: 'Performance',
// Include Web Vitals tracking in development
// Defaults to false meaning Vitals will only be tracked in production.
includeInDevelopment: false,
// Prints metrics in the console when true
debug: false,
}
}
```
---
Plugin based on [`nuxt-vitals`](https://github.com/daliborgogic/nuxt-vitals).