Skip to content

Commit

Permalink
Clarify sending to Google Analytics in reportWebVitals (#16664)
Browse files Browse the repository at this point in the history
Clarifies #16662

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
  • Loading branch information
balazsorban44 and Timer committed Aug 30, 2020
1 parent c03d493 commit d6188a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/advanced-features/measuring-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ export function reportWebVitals(metric) {
>
> ```js
> 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:
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
> eventAction: name,
Expand Down

0 comments on commit d6188a8

Please sign in to comment.