Skip to content

Commit 760db9f

Browse files
include host in webserver events
1 parent eac7ea0 commit 760db9f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/web/src/lib/posthog.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export async function captureEvent<E extends PosthogEvent>(event: E, properties:
8585

8686
const distinctId = await tryGetDistinctId();
8787

88+
const headersList = await headers();
89+
const host = headersList.get("host") ?? undefined;
90+
8891
const posthog = new PostHog(env.POSTHOG_PAPIK, {
8992
host: 'https://us.i.posthog.com',
9093
flushAt: 1,
@@ -97,6 +100,7 @@ export async function captureEvent<E extends PosthogEvent>(event: E, properties:
97100
...properties,
98101
sourcebot_version: clientEnv.NEXT_PUBLIC_SOURCEBOT_VERSION,
99102
install_id: env.SOURCEBOT_INSTALL_ID,
103+
$host: host,
100104
},
101105
distinctId,
102106
});

0 commit comments

Comments
 (0)