include host in webserver events

This commit is contained in:
bkellam 2025-12-11 12:21:27 -08:00
parent eac7ea0555
commit 760db9f3e1

View file

@ -85,6 +85,9 @@ export async function captureEvent<E extends PosthogEvent>(event: E, properties:
const distinctId = await tryGetDistinctId(); const distinctId = await tryGetDistinctId();
const headersList = await headers();
const host = headersList.get("host") ?? undefined;
const posthog = new PostHog(env.POSTHOG_PAPIK, { const posthog = new PostHog(env.POSTHOG_PAPIK, {
host: 'https://us.i.posthog.com', host: 'https://us.i.posthog.com',
flushAt: 1, flushAt: 1,
@ -97,6 +100,7 @@ export async function captureEvent<E extends PosthogEvent>(event: E, properties:
...properties, ...properties,
sourcebot_version: clientEnv.NEXT_PUBLIC_SOURCEBOT_VERSION, sourcebot_version: clientEnv.NEXT_PUBLIC_SOURCEBOT_VERSION,
install_id: env.SOURCEBOT_INSTALL_ID, install_id: env.SOURCEBOT_INSTALL_ID,
$host: host,
}, },
distinctId, distinctId,
}); });