加入教程数据统计

This commit is contained in:
marvzhang
2020-02-01 18:00:33 +08:00
parent 95c1be610b
commit acfbcad75c
13 changed files with 100 additions and 13 deletions

View File

@@ -1,4 +1,6 @@
import i18n from '../i18n'
import store from '../store'
import stats from './stats'
export default {
isFinishedTour: (tourName) => {
@@ -26,6 +28,29 @@ export default {
}
data[tourName] = 1
localStorage.setItem('tour', JSON.stringify(data))
// 发送统计数据
const finalStep = store.state.tour.tourFinishSteps[tourName]
const currentStep = store.state.tour.tourSteps[tourName]
if (currentStep === finalStep) {
stats.sendEv('教程', '完成', tourName)
} else {
stats.sendEv('教程', '跳过', tourName)
}
},
nextStep: (tourName, currentStep) => {
store.commit('tour/SET_TOUR_STEP', {
tourName,
step: currentStep + 1
})
stats.sendEv('教程', '下一步', tourName)
},
prevStep: (tourName, currentStep) => {
store.commit('tour/SET_TOUR_STEP', {
tourName,
step: currentStep - 1
})
stats.sendEv('教程', '上一步', tourName)
},
getOptions: (isShowHighlight) => {
return {