Skip to content

Commit d2fdd08

Browse files
committed
fix: update userpilot token handling and improve loaded state check
1 parent 84807e6 commit d2fdd08

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const analytics = Analytics({
1515
}),
1616
}),
1717
userpilot({
18-
token: isDev() ? 'STG-NX-54e88e10' : 'NX-54e88e10',
18+
token: 'NX-54e88e10',
1919
}),
2020
],
2121
}),

src/common/analytics-plugins/userpilot.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { User } from 'src/features/api';
22
import { Userpilot } from 'userpilot';
3+
import { isDev } from '../isDevEnvironment';
34

45
declare global {
56
interface Window {
@@ -56,6 +57,9 @@ export default function userpilotPlugin(pluginSettings: UserpilotConfig) {
5657
Userpilot.track(event, { ...properties, userId });
5758
},
5859

59-
loaded: () => !!window.userpilot,
60+
loaded: () => {
61+
const previewEnabled = localStorage.getItem('userpilot_ug_preview');
62+
return isDev() && previewEnabled !== null ? true : !!window.userpilot;
63+
},
6064
};
6165
}

0 commit comments

Comments
 (0)