GoogleAnalytics injects Google Analytics 4 scripts into the document head and initializes gtag with the provided measurement id.tsx
import { GoogleAnalytics } from "@arkyn/components";
tsx
<GoogleAnalytics measurementId="G-XXXXXXXXXX" />
showInDevMode when you need local validation.tsx
// Production only (default)<GoogleAnalytics measurementId="G-XXXXXXXXXX" />// Force rendering in development<GoogleAnalytics measurementId="G-XXXXXXXXXX" showInDevMode />
gtag.js URL and inline bootstrap script.tsx
<GoogleAnalytics measurementId="G-TEST123456" showInDevMode />
ClientOnly, so script injection happens
only in the browser. No Google Analytics script tags are appended during
server rendering.G-XXXXXXXXXX). If
it is missing, the internal snippet generator emits a console warning.measurementId - string
Google Analytics 4 Measurement ID used to configure gtag.showInDevMode - boolean (default: false)
If true, renders and initializes analytics outside production.