You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-10Lines changed: 12 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
1
# web-vitals-reporter
2
2
3
-
> A tiny (800 bytes) library, that makes collecting [Web Vitals](https://github.com/GoogleChrome/web-vitals) as simple, as sending one `POST` request.
3
+
> Report [Web Vitals](https://web.dev/vitals/) to your API with one POST request per session.
4
4
5
-
[Web-vitals](https://github.com/GoogleChrome/web-vitals) is a small and powerful library from Google Chrome team that accurately measures [Web Vitals](https://web.dev/vitals/). It has no opinion on how to report data from the browser to analytics.
5
+
The [web-vitals](https://github.com/GoogleChrome/web-vitals) is a small and powerful library that accurately measures [Web Vitals](https://web.dev/vitals/). It has no opinion on how to report data from a browser to your analytics. It results in multiple API calls, session tracking, and lost metrics. The `web-vitals-reporter` makes [Web Vitals](https://github.com/GoogleChrome/web-vitals) reporting as simple as sending one `POST` request.
6
6
7
7
**Features**:
8
8
9
-
- Collect [Web Vitals](https://web.dev/vitals/) with one request per session;
10
-
- Associate a useful device information, like number of `cpus`, memory size, and connection type;
9
+
- Report [Web Vitals](https://web.dev/vitals/) with one request per session;
10
+
- Associate useful device information like the number of `cpus`, `memory` size, and `connection` type;
11
+
- Report custom front end metrics;
11
12
- Handle edge-cases like multiple CLS calls, round values, and `sendBeacon` fallback;
12
-
- Report custom front-end metrics;
13
-
- It's tiny (800 bytes), functional, and modular.
13
+
- It's a tiny (800 bytes) library without external dependencies.
14
14
15
15
## Usage
16
16
17
-
Report [Core Web Vitals](https://web.dev/vitals/) to an API endpoint:
17
+
Report [Core Web Vitals](https://web.dev/vitals/)and device information to an API endpoint:
@@ -66,8 +66,10 @@ export { report as reportWebVitals }
66
66
67
67
### createApiReporter(url, [options])
68
68
69
-
Create a report function, that accepts [Web Vitals' Metric](https://github.com/GoogleChrome/web-vitals#metric) or any `{ name: string, value: number }` object.
70
-
At the end of the session, it sends collected data to `url` using a POST request.
69
+
Create a report function that accepts [Web Vitals' Metric](https://github.com/GoogleChrome/web-vitals#metric) object.
70
+
At the end of the session, it sends collected data to the `url` using a POST request.
71
+
72
+
It accepts any `{ name: string, value: number }` object, making it a useful tool for reporting any metric to the API using the one-request-per-session pattern.
0 commit comments