Analytics Config

Configure Google Analytics and PostHog tracking.

Overview

The config/analytics.config.ts file configures analytics providers. DirectoryKit supports Google Analytics and PostHog out of the box.

Environment variables

VariableProviderDescription
NEXT_PUBLIC_GA_MEASUREMENT_IDGoogle AnalyticsGA4 measurement ID
NEXT_PUBLIC_POSTHOG_KEYPostHogPostHog project API key
NEXT_PUBLIC_POSTHOG_HOSTPostHogPostHog instance URL

Enhanced analytics

When the analytics feature flag is enabled, DirectoryKit tracks additional data:

  • Device and browser information
  • Country-level geo data
  • Per-project page view events
  • Custom event tracking

See Analytics for the full guide.