Skip to content

Commit 13b59bb

Browse files
committed
Create client Posthog util function getSessionId
1 parent c0bc817 commit 13b59bb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { posthog } from '../client';
2+
3+
export function getSessionId(): string | undefined {
4+
return posthog?.get_session_id();
5+
}

src/lib/client/sentry/utils/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { posthog } from '$lib/client/posthog';
2+
import { getSessionId } from '$lib/client/posthog/utils';
23
import { sentry } from '$lib/shared/sentry';
34
import type { Integration } from '@sentry/types';
45

@@ -17,6 +18,6 @@ export function getClientSentryIntegrations(
1718

1819
export function setClientPosthogSessionId(): void {
1920
if (posthog) {
20-
sentry?.setTag(POSTHOG_SESSION_ID_TAG, posthog.get_session_id());
21+
sentry?.setTag(POSTHOG_SESSION_ID_TAG, getSessionId() as string);
2122
}
2223
}

0 commit comments

Comments
 (0)