Commit 29067597 by 李伟康

增加埋点需在登陆后触发

1 parent add10f1d
......@@ -17,7 +17,7 @@
import { bigdatautilApi } from '@/api'
export default {
name: 'App',
data() {
data () {
return {
timer: null
}
......@@ -25,46 +25,50 @@ export default {
watch: {
watchFlag: {
immediate: true,
handler(newval) {
handler (newval) {
this.showWindow = newval
this.hideLoading()
this.init()
}
}
},
computed: {
watchFlag() {
watchFlag () {
return this.$store.state.app.showWindow
}
},
mounted() {
this.openListener()
window.addEventListener('pagehide', () => {
this.leave()
this.closeListener()
// console.log('页面要关闭了')
})
mounted () {
},
methods: {
init () {
this.openListener()
window.addEventListener('pagehide', () => {
this.leave()
this.closeListener()
// console.log('页面要关闭了')
})
},
// 心跳检测
openListener() {
openListener () {
this.timer = setInterval(() => {
this.heartbeat()
}, 60 * 1000)
},
closeListener() {
closeListener () {
clearInterval(this.timer)
},
// 心跳检测
heartbeat() {
heartbeat () {
this.trackFn('heartbeat', 5)
},
//离开事件
leave() {
leave () {
// console.log('离开时间')
this.trackFn('leaveReportTrack', 5)
},
trackFn(name, actionType) {
trackFn (name, actionType) {
const { id } = this.getQuery()
bigdatautilApi[name](id, actionType)
}
......
......@@ -26,6 +26,7 @@ const reportTrack = (id, view = 1, share_channel = '', url = commonUrl, method =
const userInfo = util.getUserInfo()
const params = util.getLocalStorage('wx_scrm_link_params') || {}
const ISWXWORK = util.getLocalStorage('is_wxwork')
if(!userInfo) return
if (ISWXWORK) {
if (userInfo.loginList.length && userInfo.loginList[0].phone) userInfo.phone = userInfo.loginList[0].phone
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!