Back to docs

Documentation

Analytics and consent

Optional GA4, Plausible, and Clarity injection after user consent.

Article
PreviousNext

Analytics providers are configured from zship.app.json and only load after an explicit consent decision.

Supported providers

  • Google Analytics 4 via analytics.googleAnalytics.measurementId
  • Plausible via analytics.plausible.domain
  • Microsoft Clarity via analytics.clarity.projectId
  • Consent banner is controlled by analytics.consentBanner.enabled
  • Decision is persisted in localStorage
  • Scripts inject only after accept; decline keeps third-party analytics off

Implementation notes

  • Banner: src/components/AnalyticsConsentBanner.tsx
  • Script injection: src/components/AnalyticsScripts.tsx
  • Storage helpers: src/lib/client/analytics-consent.ts

For stricter compliance later, add a consent center page or first-party analytics proxy before enabling production IDs.