Skip to content

Commit 91286f3

Browse files
improve readme
1 parent 0beb34d commit 91286f3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# web-vitals-reporter
22

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.
44
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.
66

77
**Features**:
88

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;
1112
- 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.
1414

1515
## Usage
1616

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:
1818

1919
```js
2020
import { getCLS, getFID, getLCP } from 'web-vitals'
@@ -41,7 +41,7 @@ getCLS(sendToAnalytics)
4141
}
4242
```
4343

44-
Measure performance for [Next.js application](https://nextjs.org/docs/advanced-features/measuring-performance):
44+
Measure performance with [Next.js](https://nextjs.org/docs/advanced-features/measuring-performance):
4545

4646
```js
4747
import { createApiReporter } from 'web-vitals-reporter'
@@ -66,8 +66,10 @@ export { report as reportWebVitals }
6666

6767
### createApiReporter(url, [options])
6868

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.
7173

7274
#### options.initial
7375

0 commit comments

Comments
 (0)