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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"measurement_id": "<measurement_id>"
},
"name": "render_ga4_nextjs_component"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | env | |
| consent_gated | No | ||
| measurement_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |