Unverified Commit d4a8d4fc authored by Vahid Hallaji's avatar Vahid Hallaji Committed by GitHub

fix gtag syntax in measuring docs (#16933)

parent 66593349
...@@ -160,13 +160,12 @@ export function reportWebVitals(metric) { ...@@ -160,13 +160,12 @@ export function reportWebVitals(metric) {
> export function reportWebVitals({ id, name, label, value }) { > export function reportWebVitals({ id, name, label, value }) {
> // Use `window.gtag` if you initialized Google Analytics as this example: > // 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 > // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js
> window.gtag('send', 'event', { > window.gtag('event', name, {
> eventCategory: > event_category:
> label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric', > label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
> eventAction: name, > value: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers
> eventValue: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers > event_label: id, // id unique to current page load
> eventLabel: id, // id unique to current page load > non_interaction: true, // avoids affecting bounce rate.
> nonInteraction: true, // avoids affecting bounce rate.
> }) > })
> } > }
> ``` > ```
......
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