Boost My AgentGet Boost OS
GA4

GA4 starter module

Client tag and consent

Maps the GA4 tag, consent choices, environment values, and Next.js page tracking.

Files
15
Lines
789
Languages
Config + Markdown + TypeScript + JSON

Included files

This page lists paths and purposes, not source contents.

  • .env.example

    Configuration required by this starter pack.

    Config

    20 lines

  • ADAPT.md

    Give these instructions to the coding agent working in the buyer's Next.js project.

    Markdown

    127 lines

  • app/analytics-demo/route.ts

    Serves a dependency-free GA4 demo page with consent, browser events, and a purchase simulation.

    TypeScript

    96 lines

  • app/api/analytics/demo-purchase/route.ts

    Simulates the trusted server signal and runs the complete purchase reporting flow.

    TypeScript

    68 lines

  • app/api/analytics/track/route.ts

    Ready-to-serve mount.

    TypeScript

    3 lines

  • app/api/analytics/verify/route.ts

    Ready-to-serve mount.

    TypeScript

    9 lines

  • OPERATIONS.md

    The code handles event delivery.

    Markdown

    53 lines

  • package.json

    Configuration required by this starter pack.

    JSON

    14 lines

  • README.md

    This starter gives a Next.js App Router application consent-aware GA4 browser tagging, trusted server revenue events, first-party relay tracking, attribution helpers, and a readable verification route.

    Markdown

    88 lines

  • src/setup/check-setup.ts

    Checks GA4 setup through the validation endpoint because dashboard automation requires OAuth.

    TypeScript

    103 lines

  • src/setup/consent.ts

    Reads, writes, and replays the visitor's Consent Mode choice.

    TypeScript

    26 lines

  • src/setup/ga4-tag.ts

    Builds the dependency-free GA4 head tags with Consent Mode v2 ordering.

    TypeScript

    70 lines

  • starter.json

    Configuration required by this starter pack.

    JSON

    6 lines

  • TROUBLESHOOTING.md

    Find your symptom and apply the fix first.

    Markdown

    91 lines

  • tsconfig.json

    Configuration required by this starter pack.

    JSON

    15 lines

Questions about client tag and consent

Is this a GA4 Next.js starter?

Yes. The pack is built for Next.js apps that need client tags, consent-aware tracking, campaign attribution, funnel events, server-side revenue events, and verification.