Unverified Commit d6188a8e authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

Clarify sending to Google Analytics in reportWebVitals (#16664)

Clarifies #16662
Co-authored-by: 's avatarJoe Haddad <joe.haddad@zeit.co>
parent c03d4931
...@@ -158,7 +158,9 @@ export function reportWebVitals(metric) { ...@@ -158,7 +158,9 @@ export function reportWebVitals(metric) {
> >
> ```js > ```js
> export function reportWebVitals({ id, name, label, value }) { > export function reportWebVitals({ id, name, label, value }) {
> ga('send', 'event', { > // Use `window.gtag` if you initialized Google Analytics as this example:
> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js
> window.gtag('send', 'event', {
> eventCategory: > eventCategory:
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric', > label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
> eventAction: name, > eventAction: name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment