---
source: crates/oxc_linter/src/tester.rs
expression: next_script_for_ga
---
  ⚠ eslint-plugin-next(next-script-for-ga): Prefer `next/script` component when using the inline script for Google Analytics.
   ╭─[next_script_for_ga.tsx:7:21]
 6 │                             <h1>Hello title</h1>
 7 │                             <script async src='https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}' />
   ·                              ──────
 8 │                             <script
   ╰────
  help: See https://nextjs.org/docs/messages/next-script-for-ga

  ⚠ eslint-plugin-next(next-script-for-ga): Prefer `next/script` component when using the inline script for Google Analytics.
   ╭─[next_script_for_ga.tsx:8:21]
 7 │                             {/* Google Tag Manager - Global base code */}
 8 │                             <script
   ·                              ──────
 9 │                             dangerouslySetInnerHTML={{
   ╰────
  help: See https://nextjs.org/docs/messages/next-script-for-ga

  ⚠ eslint-plugin-next(next-script-for-ga): Prefer `next/script` component when using the inline script for Google Analytics.
   ╭─[next_script_for_ga.tsx:7:21]
 6 │                             <h1>Hello title</h1>
 7 │                             <script dangerouslySetInnerHTML={{
   ·                              ──────
 8 │                                 __html: `
   ╰────
  help: See https://nextjs.org/docs/messages/next-script-for-ga

  ⚠ eslint-plugin-next(next-script-for-ga): Prefer `next/script` component when using the inline script for Google Analytics.
    ╭─[next_script_for_ga.tsx:14:21]
 13 │                               }}/>
 14 │                             <script async src='https://www.google-analytics.com/analytics.js'></script>
    ·                              ──────
 15 │                           </div>
    ╰────
  help: See https://nextjs.org/docs/messages/next-script-for-ga

  ⚠ eslint-plugin-next(next-script-for-ga): Prefer `next/script` component when using the inline script for Google Analytics.
    ╭─[next_script_for_ga.tsx:18:21]
 17 │                             <script dangerouslySetInnerHTML={this.createGoogleAnalyticsMarkup()} />
 18 │                             <script async src='https://www.google-analytics.com/analytics.js'></script>
    ·                              ──────
 19 │                           </div>
    ╰────
  help: See https://nextjs.org/docs/messages/next-script-for-ga
