Adds more tracking all around the app (#142)

* Adds more tracking all around the app

* more events

* lint

* using better analytics naming

* missed file

* more fixes
This commit is contained in:
Aryan Goharzad
2023-02-02 19:48:36 -05:00
committed by GitHub
parent 8b310d91f0
commit cede0c772c
21 changed files with 196 additions and 24 deletions
+35
View File
@@ -0,0 +1,35 @@
export class Logger {
isDisabled: boolean
constructor(isDisabled: boolean = process.env.NODE_ENV === 'production') {
this.isDisabled = isDisabled
}
enable() {
this.isDisabled = false
}
disable() {
this.isDisabled = true
}
info(message?: any, ...optionalParams: any[]): void {
if (!this.isDisabled) {
console.info(message, ...optionalParams)
}
}
warn(message?: any, ...optionalParams: any[]): void {
if (!this.isDisabled) {
console.warn(message, ...optionalParams)
}
}
error(message?: any, ...optionalParams: any[]): void {
if (!this.isDisabled) {
console.error(message, ...optionalParams)
}
}
}
export const createLogger = (isDisabled?: boolean) => new Logger(isDisabled)
+9
View File
@@ -0,0 +1,9 @@
import {createClient} from '@segment/analytics-react-native'
// import {createLogger} from './logger'
export const segmentClient = createClient({
writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI',
trackAppLifecycleEvents: true,
// Uncomment to debug:
// logger: createLogger(),
})