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
| Variable | Provider | Description |
|---|---|---|
NEXT_PUBLIC_GA_MEASUREMENT_ID | Google Analytics | GA4 measurement ID |
NEXT_PUBLIC_POSTHOG_KEY | PostHog | PostHog project API key |
NEXT_PUBLIC_POSTHOG_HOST | PostHog | PostHog 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.