Observability Tooling Ready
Enable Vercel Analytics, Speed Insights, and GTM via config and environment flags, with draft-mode safeguards and shared app logging.
Overview
The starter provides observability wiring points and feature flags so teams can turn on runtime and product telemetry in a controlled way.
The implementation is split between:
- config-driven toggles in
apps/web/config/analytics.ts - rendering containers in
apps/web/src/lib/analytics/VercelContainer.tsxandapps/web/src/lib/gtm/components/GtmContainer.tsx - shared app logging through
apps/web/src/lib/logger/logger.tsandpackages/logger/logger.ts
Vercel telemetry toggles
apps/web/config/analytics.ts defines two Vercel flags:
NEXT_PUBLIC_VERCEL_ENABLE_ANALYTICSNEXT_PUBLIC_VERCEL_ENABLE_SPEED_INSIGHTS
apps/web/src/lib/analytics/VercelContainer.tsx reads those flags and conditionally renders:
Analyticsfrom@vercel/analytics/reactSpeedInsightsfrom@vercel/speed-insights/next
This keeps activation explicit and environment-driven.
Draft-mode safeguards
Both telemetry containers check draftMode() and suppress tracking when draft mode is enabled:
apps/web/src/lib/analytics/VercelContainer.tsxapps/web/src/lib/gtm/components/GtmContainer.tsx
This prevents preview/editorial sessions from polluting production analytics.
GTM support and controls
The same config file also exposes GTM controls:
NEXT_PUBLIC_GTM_IDNEXT_PUBLIC_GTM_ENABLEDNEXT_PUBLIC_GTM_DEBUG
GtmContainer passes these values through a provider and only injects GoogleTagManager when enabled and not in draft mode.
Baseline operational logging
The app logger is intentionally simple and shared:
apps/web/src/lib/logger/logger.tsinstantiatescreateLogger({ level: 4 })packages/logger/logger.tsmaps log levels to console methods (error,warn,log,info,debug)
This gives a common logging interface today, and a clear extension point if you later forward logs to a managed observability platform.
Implementation notes for enterprise teams
- Keep feature flags default-off for production until dashboards and alerting are validated.
- Enable telemetry per environment (dev/staging/prod) by setting env vars in deployment config rather than hardcoding.
- Route new instrumentation through shared containers/wrappers so compliance and redaction controls stay centralised.
Last updated: 27 Apr 2026, 14:59:48
Error Monitoring Ready
Ship with an error-capture abstraction and existing call sites so you can wire Sentry (or another provider) without refactoring business logic.
Google Tag Manager
Enable Google Tag Manager with environment-driven toggles, automatic page view and 404 tracking, and draft-mode-safe behaviour grounded in the enterprise starter implementation.
