Analytics & Feedback
Optional PostHog analytics and a feedback link: wire them in when you need them.
Both of these are optional, and both stay off until you set an environment variable. Out of the box nothing tracks your users and no feedback link renders; you opt in when you need them.
PostHog analytics
PostHog gives you product analytics, session replay, and feature flags. It is wired but dormant: initialized in web/next/instrumentation-client.ts (Next.js's client-instrumentation entry, which runs once before the app hydrates), following PostHog's current App Router setup. Its defaults date turns on PostHog's current defaults, including single-page-app pageview capture, so no provider or manual pageview component is needed. It no-ops until the key is present.
Turn it on with two env vars (the key enables it, the host picks your region):
NEXT_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com
NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN=Use https://us.i.posthog.com for US Cloud, https://eu.i.posthog.com for EU, or your self-hosted URL. Both are declared optional in packages/env/src/web-next.ts, so an empty key simply means PostHog never initializes, which is also how you disable it.
Wired, but not called for you
The starter sets up initialization, but it does not call capture, identify, or read a feature flag anywhere. Pageviews and session replay begin once the key is set; everything below is yours to add where it makes sense.
Capture events and identify users from the shared client:
import posthog from "posthog-js"
posthog.capture("signup_clicked", { plan: "pro" })
posthog.identify(user.id, { email: user.email, name: user.name })Inside components, reach the same singleton and read flags off it (isFeatureEnabled resolves once flags have loaded):
import posthog from "posthog-js"
function Dashboard() {
const showNew = posthog.isFeatureEnabled("new-dashboard")
return showNew ? <New onClick={() => posthog.capture("used_new")} /> : <Old />
}PostHog is privacy-configurable: the host picks EU or US data residency, session recordings can be masked or turned off, and its built-in opt-out honors users who decline tracking.
User feedback
The feedback link is simpler still (one env var, no SDK):
NEXT_PUBLIC_USERJOT_URL=The name points at UserJot, but the value is just a URL: set it to any feedback destination you like. When it is set, a link appears in two places: the docs sidebar footer (next to the v{version} label) and the dashboard user menu, directly above "Log out". Both open the URL in a new tab. Leave the variable empty and neither renders; the footer still shows the version.
Next
- Environment Variables: how these optional keys are declared and validated.
- Dashboard: the app shell where the feedback link and user menu live.