Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions apps/array/src/renderer/lib/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import posthog from "posthog-js/dist/module.full.no-external";
// Import the recorder to set up __PosthogExtensions__.initSessionRecording
// The module.full.no-external bundle includes rrweb but not the initSessionRecording function
// This import adds the missing piece needed for session replay in Electron
import "posthog-js/dist/lazy-recorder";
// posthog-recorder (vs lazy-recorder) ensures recording is ready immediately
import "posthog-js/dist/posthog-recorder";
import type {
EventPropertyMap,
UserIdentifyProperties,
Expand All @@ -27,16 +27,13 @@ export function initializePostHog() {
posthog.init(apiKey, {
api_host: apiHost,
ui_host: uiHost,
capture_pageview: false,
capture_pageleave: false,
disable_session_recording: false,
debug: true, // Enable debug mode for now (TODO: turn this off before launch)
loaded: () => {
log.info("PostHog loaded");
// Log session recording status after remote config loads
setTimeout(() => {
logSessionRecordingStatus();
}, 3000);
// Start session recording immediately after load
// In Electron, we need to explicitly start since there's no page navigation trigger
posthog.startSessionRecording();
log.info("Session recording started");
},
});

Expand Down