feat: add frontend analytics tracking
This commit is contained in:
@@ -3,6 +3,7 @@ import { ref } from 'vue'
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||
import { useAppStore } from './stores/app.js'
|
||||
import { logRuntimeEnv } from './services/request.js'
|
||||
import analytics from './services/analytics.js'
|
||||
|
||||
const statusBarHeight = ref(0)
|
||||
const safeAreaTop = ref(0)
|
||||
@@ -10,6 +11,7 @@ const safeAreaBottom = ref(0)
|
||||
|
||||
onLaunch(async () => {
|
||||
console.log('App Launch')
|
||||
analytics.initAnalytics()
|
||||
logRuntimeEnv('app:onLaunch')
|
||||
const store = useAppStore()
|
||||
await store.initialize()
|
||||
@@ -25,10 +27,13 @@ onLaunch(async () => {
|
||||
|
||||
onShow(() => {
|
||||
console.log('App Show')
|
||||
analytics.track('app_show', {}, { eventType: 'app' })
|
||||
})
|
||||
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
analytics.track('app_hide', {}, { eventType: 'app' })
|
||||
analytics.flush()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user