Skip to content

Commit

Permalink
Fix: Avoid crash if posthog is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxou44 committed Oct 27, 2024
1 parent 3a7d57b commit 29b11eb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/renderer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import App from './App';
import { BUILD, POSTHOG_TOKEN } from './config';

try {
posthog.init(POSTHOG_TOKEN, {
api_host: 'https://us.i.posthog.com',
person_profiles: 'always',
autocapture: false,
disable_session_recording: true,
});
if (POSTHOG_TOKEN) {
posthog.init(POSTHOG_TOKEN, {
api_host: 'https://us.i.posthog.com',
person_profiles: 'always',
autocapture: false,
disable_session_recording: true,
});
}
} catch (err) { } // eslint-disable-line no-empty

window.track = (eventName, data = {}) => {
try {
posthog.capture(eventName, data);
if (POSTHOG_TOKEN) {
posthog.capture(eventName, data);
}
} catch (err) { } // eslint-disable-line no-empty
};

Expand Down

0 comments on commit 29b11eb

Please sign in to comment.