File tree Expand file tree Collapse file tree
src/main/services/analytics Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'dotenv/config'
12import type { TrackEvents } from '@shared/types/main/analytics'
23import ua from 'universal-analytics'
34import { version } from '../../../../package.json'
@@ -8,8 +9,6 @@ const isDev = process.env.NODE_ENV === 'development'
89const analytics = ua ( 'UA-56182454-13' )
910
1011export const track = ( event : TrackEvents , payload ?: string ) => {
11- if ( isDev ) return
12-
1312 let os
1413 const p = platform ( )
1514
@@ -21,5 +20,9 @@ export const track = (event: TrackEvents, payload?: string) => {
2120 ? `${ version } /${ os } /${ event } /${ payload } `
2221 : `${ version } /${ os } /${ event } `
2322
24- analytics . pageview ( path ) . send ( )
23+ if ( isDev && process . env . DEBUG ?. includes ( 'analytics' ) ) {
24+ console . log ( '[analytics]:' , path )
25+ } else {
26+ analytics . pageview ( path ) . send ( )
27+ }
2528}
You can’t perform that action at this time.
0 commit comments