From 04db5183133a15378688fa459c0c14c1bcde4dbd Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 29 Nov 2024 10:02:59 +0000 Subject: [PATCH 1/3] feat: add property --- src/extensions/replay/sessionrecording.ts | 2 +- src/posthog-core.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/extensions/replay/sessionrecording.ts b/src/extensions/replay/sessionrecording.ts index bfa2693a9..a7bcfdeb6 100644 --- a/src/extensions/replay/sessionrecording.ts +++ b/src/extensions/replay/sessionrecording.ts @@ -383,7 +383,7 @@ export class SessionRecording { * defaults to buffering mode until a decide response is received * once a decide response is received status can be disabled, active or sampled */ - private get status(): SessionRecordingStatus { + get status(): SessionRecordingStatus { if (!this.receivedDecide) { return 'buffering' } diff --git a/src/posthog-core.ts b/src/posthog-core.ts index db362d2af..0120911ba 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -941,6 +941,10 @@ export class PostHog { properties['$window_id'] = windowId } + if (this.sessionRecording) { + properties['$recording_status'] = this.sessionRecording.status + } + if (this.requestRouter.region === RequestRouterRegion.CUSTOM) { properties['$lib_custom_api_host'] = this.config.api_host } From f72ccdca7ad4ac34079f926d3ccb249fb36064b2 Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 29 Nov 2024 10:34:15 +0000 Subject: [PATCH 2/3] fix test --- src/__tests__/posthog-core.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/__tests__/posthog-core.ts b/src/__tests__/posthog-core.ts index 7f37eec5d..3bc96c8f1 100644 --- a/src/__tests__/posthog-core.ts +++ b/src/__tests__/posthog-core.ts @@ -459,6 +459,7 @@ describe('posthog core', () => { $lib_custom_api_host: 'https://custom.posthog.com', $is_identified: false, $process_person_profile: false, + $recording_status: 'buffering', }) }) From 3ac6a9eaefa163356e67dcbbbed7f5dc8f82b332 Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 29 Nov 2024 12:12:41 +0000 Subject: [PATCH 3/3] fix tests --- src/__tests__/posthog-core.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/__tests__/posthog-core.ts b/src/__tests__/posthog-core.ts index 3bc96c8f1..b3f2c1c9c 100644 --- a/src/__tests__/posthog-core.ts +++ b/src/__tests__/posthog-core.ts @@ -437,6 +437,7 @@ describe('posthog core', () => { $session_id: 'sessionId', $is_identified: false, $process_person_profile: false, + $recording_status: 'buffering', }) })