render_ga4_nextjs_component
Generates a Next.js client component to load GA4 gtag using an environment variable or inline measurement ID, with optional consent gating.
Instructions
Return a Next.js client component (next/script) for GA4. mode: env (read NEXT_PUBLIC_GA_MEASUREMENT_ID) or inline (embed id). consent_gated: only load gtag after localStorage cookie consent is accepted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | env | |
| consent_gated | No | ||
| measurement_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |