Skip to content

Commit d6188a8

Browse files
balazsorban44Timer
andauthoredAug 30, 2020
Clarify sending to Google Analytics in reportWebVitals (#16664)
Clarifies #16662 Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
1 parent c03d493 commit d6188a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎docs/advanced-features/measuring-performance.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ export function reportWebVitals(metric) {
158158
>
159159
> ```js
160160
> export function reportWebVitals({ id, name, label, value }) {
161-
> ga('send', 'event', {
161+
> // Use `window.gtag` if you initialized Google Analytics as this example:
162+
> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js
163+
> window.gtag('send', 'event', {
162164
> eventCategory:
163165
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
164166
> eventAction: name,

0 commit comments

Comments
 (0)
Please sign in to comment.