From 2c25c92cec8640af46165383ecb24b5060bf7e52 Mon Sep 17 00:00:00 2001 From: wangwei <wangwei1> Date: Wed, 26 Dec 2018 10:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=9E=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/author.vue | 6 ++++ src/components/bindMobile.vue | 3 ++ src/components/buy/index.vue | 8 +++++ src/components/index.vue | 39 ++++++++++++++++++++-- src/components/map/index.vue | 13 ++++++++ src/components/mine.vue | 6 ++++ src/components/myGoodsList.vue | 6 ++++ src/components/order.vue | 6 ++++ src/main.js | 24 ++++++------- src/router/index.js | 61 ++++++++++++++++------------------ 10 files changed, 126 insertions(+), 46 deletions(-) diff --git a/src/components/author.vue b/src/components/author.vue index 82966e9f..e519f5a7 100644 --- a/src/components/author.vue +++ b/src/components/author.vue @@ -30,6 +30,12 @@ export default { }, methods: { onPageReload: function () { + this.$sa.track('buttonClick',{ + tabTitle:'授æƒ', + moduleTitle:'授æƒ', + buttonType:'釿–°æŽˆæƒ', + buttonName:'釿–°æŽˆæƒ' + }); window.location.reload() } } diff --git a/src/components/bindMobile.vue b/src/components/bindMobile.vue index b9c70534..b2539e01 100644 --- a/src/components/bindMobile.vue +++ b/src/components/bindMobile.vue @@ -122,6 +122,8 @@ } this.time=30; this.timeO(); + + this.$sa.track('clickSendcode',{}); sendMobileCodeApi(json).then(res=>{ if(res === 'æ“作æˆåŠŸ'){ Toast('验è¯ç å·²å‘é€'); @@ -143,6 +145,7 @@ } }, bindMobile(){ + this.$sa.track('clickSignUp',{}); if(this.flag){ this.flag = false; if(this.msgCode===''||!this.msgCode) { diff --git a/src/components/buy/index.vue b/src/components/buy/index.vue index c9aafea8..582e8a30 100644 --- a/src/components/buy/index.vue +++ b/src/components/buy/index.vue @@ -388,6 +388,14 @@ }); } + this.$sa.track('viewCourseDetail',{ + courseID:this.groupDetail.id, + courseCate:this.groupDetail.course_type === 1 ? '体验课' : 'æ£å¼è¯¾', + lessonNumber:this.groupDetail.watch_num, + courseTitle:this.groupDetail.name, + coursePrice:this.groupDetail.original_price/100, + discountPrice:this.groupDetail.current_price/100 + }); if(this.groupDetail.goods_type === 2){ if(localStorage.getItem('cc_token')){ getStatusWechatApi({goods_id:this.shopId}).then(res=>{ diff --git a/src/components/index.vue b/src/components/index.vue index c15e2a9d..810f73d2 100644 --- a/src/components/index.vue +++ b/src/components/index.vue @@ -3,7 +3,7 @@ <div class="banner-block"> <swiper :options="swiperOption" class="banner" ref="mySwiper"> <swiper-slide v-for="(data,index) in bannerList" :key="index"> - <img class="banner" :src="data.url+'?imageslim'" @click="toBannerUrl(data.link)"> + <img class="banner" :src="data.url+'?imageslim'" @click="toBannerUrl(data)"> </swiper-slide> </swiper> </div> @@ -116,16 +116,39 @@ }, methods:{ toOld(e){ + this.$sa.track('buttonClick',{ + tabTitle:'首页', + moduleTitle:'功能按钮', + buttonType:'æ¿å—按钮', + buttonName:'晚安电å°' + }); // this.$sa.quick('trackHeatMap',e.srcElement) window.location.href = 'https://appanqlfkth3717.h5.xiaoeknow.com/content_page/eyJ0eXBlIjozLCJyZXNvdXJjZV90eXBlIjoiIiwicmVzb3VyY2VfaWQiOiIiLCJwcm9kdWN0X2lkIjoicF81YjE0YjdjMjdjNDZiX2Rvd0xicDc1IiwiYXBwX2lkIjoiYXBwYU5RTGZrdEgzNzE3In0?state=2f12ab00cbc58f98cdc8193c8151437f_Sc7T3q' }, toBannerUrl(data){ - window.location.href = data + this.$sa.track('adClick',{ + adTitle:data.title, + adID:data.link, + adPage:'首页' + }); + window.location.href = data.link }, toHear(){ + this.$sa.track('buttonClick',{ + tabTitle:'首页', + moduleTitle:'功能按钮', + buttonType:'æ¿å—按钮', + buttonName:'磨耳朵' + }); this.$router.push({name:'collection'}) }, toNewUrl(){ + this.$sa.track('buttonClick',{ + tabTitle:'首页', + moduleTitle:'课程', + buttonType:'没课banner', + buttonName:'没有更多课程' + }); window.location.href = this.newUrl }, initPage(){ @@ -160,6 +183,12 @@ }) }, toGoodsList(){ + this.$sa.track('buttonClick',{ + tabTitle:'首页', + moduleTitle:'课程', + buttonType:'æ¿å—按钮', + buttonName:'我的课程' + }); this.$router.push({name:'myGoodsList'}) }, dateParse(dateString){ @@ -188,6 +217,12 @@ } }, toMap(data) { + this.$sa.track('buttonClick',{ + tabTitle:'首页', + moduleTitle:'课程', + buttonType:'课程', + buttonName:'进入课程' + }); if(this.dateCompare(new Date(),this.dateParse(data.start_at))<1){ this.$router.push({ name: 'map', diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 6e62c4eb..f34b68f7 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -317,6 +317,19 @@ }, // 切æ¢ä¸»é¢˜ changeCateGory(data,flag){ + // 神ç–埋点 + this.$sa.track('selectCategory',{ + themeID:data.category_id, + themeName:data.category_name, + courseID:'', + courseCate:this.$route.query.course_type == 0 ? 'æ£å¼è¯¾' : '体验课', + lessonNumber:'', + courseTitle:'', + periodID:'', + periodName:'', + teacherID:'', + teacherName:'' + }); if(!flag){ this.parent_category_id = data.category_id; this.$router.push({name:'map',query:{periods_id:this.periods_id,course_type:this.shopType,parent_category_id: this.parent_category_id}}); diff --git a/src/components/mine.vue b/src/components/mine.vue index 66f8add5..93265cfa 100644 --- a/src/components/mine.vue +++ b/src/components/mine.vue @@ -46,6 +46,12 @@ }) }, clearBoth(){ + this.$sa.track('buttonClick',{ + tabTitle:'我的', + moduleTitle:'我的', + buttonType:'清楚缓å˜', + buttonName:'清楚缓å˜' + }); localStorage.clear(); Toast('清除æˆåŠŸ') diff --git a/src/components/myGoodsList.vue b/src/components/myGoodsList.vue index f77f8928..b672a50f 100644 --- a/src/components/myGoodsList.vue +++ b/src/components/myGoodsList.vue @@ -59,6 +59,12 @@ } }, toMap(data){ + this.$sa.track('buttonClick',{ + tabTitle:'课程列表', + moduleTitle:'课程', + buttonType:'课程', + buttonName:'进入课程' + }); if(this.dateCompare(new Date(),this.dateParse(data.start_at))<1) { this.$router.push({ name: 'map', diff --git a/src/components/order.vue b/src/components/order.vue index c4b53dd6..298f7afd 100644 --- a/src/components/order.vue +++ b/src/components/order.vue @@ -80,6 +80,12 @@ }) }, shareOrder(data){ + this.$sa.track('buttonClick',{ + tabTitle:'订å•', + moduleTitle:'订å•', + buttonType:'分享', + buttonName:'团è´åˆ†äº«' + }); this.showShare = true; let shareData = JSON.parse(data.share_desc); let that =this; diff --git a/src/main.js b/src/main.js index e7168385..a5ab2893 100644 --- a/src/main.js +++ b/src/main.js @@ -6,20 +6,20 @@ import router from './router' import store from './store' import MintUI from 'mint-ui' import VueClipboard from 'vue-clipboard2' -// import sa from'sa-sdk-javascript'; +import sa from'sa-sdk-javascript'; import 'mint-ui/lib/style.css' Vue.config.productionTip = false; -// Vue.prototype.$sa = sa; -// Vue.prototype.$sa.init({ -// server_url: 'http://47.107.250.38:8106/sa?project=default', // æ›¿æ¢æˆè‡ªå·±çš„神ç–åœ°å€ -// heatmap: { -// //是å¦å¼€å¯ç‚¹å‡»å›¾ï¼Œé»˜è®¤ default 表示开å¯ï¼Œè‡ªåЍ采集 $WebClick 事件,å¯ä»¥è®¾ç½® 'not_collect' è¡¨ç¤ºå…³é— -// clickmap:'default', -// show_log: true, // 打å°console,自己é…置,å¯ä»¥çœ‹åˆ°è‡ªå·±æ˜¯å¦è¸©ç‚¹æˆåŠŸï¼Œä»¥åŠ -// //是å¦å¼€å¯è§¦è¾¾æ³¨æ„力图,默认 default 表示开å¯ï¼Œè‡ªåЍ采集 $WebStay 事件,å¯ä»¥è®¾ç½® 'not_collect' è¡¨ç¤ºå…³é— -// scroll_notice_map:'default', -// } -// }); +Vue.prototype.$sa = sa; +Vue.prototype.$sa.init({ + server_url: 'http://47.107.250.38:8106/sa?project=default', // æ›¿æ¢æˆè‡ªå·±çš„神ç–åœ°å€ + heatmap: { + //是å¦å¼€å¯ç‚¹å‡»å›¾ï¼Œé»˜è®¤ default 表示开å¯ï¼Œè‡ªåЍ采集 $WebClick 事件,å¯ä»¥è®¾ç½® 'not_collect' è¡¨ç¤ºå…³é— + clickmap:'default', + show_log: true, // 打å°console,自己é…置,å¯ä»¥çœ‹åˆ°è‡ªå·±æ˜¯å¦è¸©ç‚¹æˆåŠŸï¼Œä»¥åŠ + //是å¦å¼€å¯è§¦è¾¾æ³¨æ„力图,默认 default 表示开å¯ï¼Œè‡ªåЍ采集 $WebStay 事件,å¯ä»¥è®¾ç½® 'not_collect' è¡¨ç¤ºå…³é— + scroll_notice_map:'default', + } +}); Vue.use(MintUI); Vue.use(VueClipboard); /* eslint-disable no-new */ diff --git a/src/router/index.js b/src/router/index.js index 43c8c7d4..551dbd5e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,6 +5,27 @@ import Router from 'vue-router' import sa from'sa-sdk-javascript'; Vue.use(Router); +let browser = { + versions: function () { + let u = navigator.userAgent, app = navigator.appVersion; + + return { //移动终端æµè§ˆå™¨ç‰ˆæœ¬ä¿¡æ¯ + trident: u.indexOf('Trident') > -1, //IEå†…æ ¸ + presto: u.indexOf('Presto') > -1, //operaå†…æ ¸ + webKit: u.indexOf('AppleWebKit') > -1, //苹果ã€è°·æŒå†…æ ¸ + gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //ç«ç‹å†…æ ¸ + mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是å¦ä¸ºç§»åŠ¨ç»ˆç«¯ + ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 + android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或ucæµè§ˆå™¨ + iPhone: u.indexOf('iPhone') > -1, //是å¦ä¸ºiPhone或者QQHDæµè§ˆå™¨ + iPad: u.indexOf('iPad') > -1, //是å¦iPad + webApp: u.indexOf('Safari') == -1 //是å¦web应该程åºï¼Œæ²¡æœ‰å¤´éƒ¨ä¸Žåº•部 + }; + }(), + + language: (navigator.browserLanguage || navigator.language).toLowerCase() +}; +let ua = window.navigator.userAgent.toLowerCase(); const router =new Router({ routes: [ { @@ -162,47 +183,23 @@ const router =new Router({ }); router.beforeEach((to,from,next)=> { - // Vue.nextTick(() => { - // sa.quick("autoTrackSinglePage"); - // }); - let ua = window.navigator.userAgent.toLowerCase(); + // 神ç–路由埋点 + Vue.nextTick(() => { + sa.quick("autoTrackSinglePage"); + }); + // åˆ¤æ–æ˜¯å¦æ˜¯å¾®ä¿¡çŽ¯å¢ƒ 排除本地 if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_'){ if(to.name == 'noWechat'){ next({name:'index'}); } }else{ - if(to.name !== 'noWechat') { + if(to.name !== 'noWechat' && process.env.NODE_ENV === 'production') { next({name:'noWechat'}); } } - let browser = { - versions: function () { - let u = navigator.userAgent, app = navigator.appVersion; - - return { //移动终端æµè§ˆå™¨ç‰ˆæœ¬ä¿¡æ¯ - trident: u.indexOf('Trident') > -1, //IEå†…æ ¸ - presto: u.indexOf('Presto') > -1, //operaå†…æ ¸ - webKit: u.indexOf('AppleWebKit') > -1, //苹果ã€è°·æŒå†…æ ¸ - gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, //ç«ç‹å†…æ ¸ - mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是å¦ä¸ºç§»åŠ¨ç»ˆç«¯ - ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 - android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或ucæµè§ˆå™¨ - iPhone: u.indexOf('iPhone') > -1, //是å¦ä¸ºiPhone或者QQHDæµè§ˆå™¨ - iPad: u.indexOf('iPad') > -1, //是å¦iPad - webApp: u.indexOf('Safari') == -1 //是å¦web应该程åºï¼Œæ²¡æœ‰å¤´éƒ¨ä¸Žåº•部 - }; - }(), - - language: (navigator.browserLanguage || navigator.language).toLowerCase() - }; - if (browser.versions.mobile) {//åˆ¤æ–æ˜¯å¦æ˜¯ç§»åŠ¨è®¾å¤‡æ‰“å¼€ã€‚browser代ç åœ¨ä¸‹é¢ - let ua = navigator.userAgent.toLowerCase();//获å–判æ–用的对象 - if (ua.match(/MicroMessenger/i) == "micromessenger") { - - }else{ - } - } + // ç§»åŠ¨ç«¯åˆ¤æ– store.dispatch('isMobile',browser.versions.mobile); + // 默认title document.title = '唱唱å¯è’™è‹±è¯'; let goOn=function(){ if(localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== ''){ -- 2.21.0