File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/common/analytics-plugins Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,14 @@ export default function userpilotPlugin(pluginSettings: UserpilotConfig) {
2929 name : 'userpilot' ,
3030 config : { ...pluginSettings } ,
3131 initialize : ( { config } : { config : UserpilotConfig } ) => {
32- Userpilot . initialize ( config . token ) ;
32+ if ( isDev ( ) ) {
33+ const previewEnabled = localStorage . getItem ( 'userpilot_ug_preview' ) ;
34+ if ( previewEnabled !== null ) {
35+ Userpilot . initialize ( config . token ) ;
36+ }
37+ } else {
38+ Userpilot . initialize ( config . token ) ;
39+ }
3340 } ,
3441 identify : ( { payload } : { payload : IIdentifyPayload } ) => {
3542 const { userId, traits } = payload ;
@@ -57,9 +64,6 @@ export default function userpilotPlugin(pluginSettings: UserpilotConfig) {
5764 Userpilot . track ( event , { ...properties , userId } ) ;
5865 } ,
5966
60- loaded : ( ) => {
61- const previewEnabled = localStorage . getItem ( 'userpilot_ug_preview' ) ;
62- return isDev ( ) && previewEnabled !== null ? true : ! ! window . userpilot ;
63- } ,
67+ loaded : ( ) => true ,
6468 } ;
6569}
You can’t perform that action at this time.
0 commit comments