浙里办埋点 老版本
<script src="//at.alicdn.com/t/font_2166499_0tup9kbanl3.js"></script>
<script type="text/javascript" src="//assets.zjzwfw.gov.cn/assets/ZWJSBridge/1.0.1/zwjsbridge.js"></script>
index.html:
<!-- 埋点 --> <script> (function (w, d, s, q, i) { w[q] = w[q] || []; var f = d.getElementsByTagName(s)[0], j = d.createElement(s); j.async = true; j.id = 'beacon-aplus'; j.src = 'https://d.alicdn.com/alilog/mlog/aplus.js?id=202951085'; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'aplus_queue'); aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['aplus-waiting', 'MAN'] }) aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['aplus-rhost-v', 'alog.zjzwfw.gov.cn'] }); aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['aplus-rhost-g', 'alog.zjzwfw.gov.cn'] }); aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['appId', '60506758'] // 此appid固定 }); </script>
home.vue:
// 获取信息 设置埋点 getData() { const that = this let infos = { userType: '', lat: '', lon: '' } ZWJSBridge.onReady(() => { // 获取用户类型 ZWJSBridge.getUserType().then((result) => { infos.userType = result.userType that.SetZwaplus(infos) }).catch((error) => { console.log(error); }); // 获取经纬度 ZWJSBridge.getLocation().then((result) => { infos.lat = result.latitude infos.lon = result.longitude that.SetZwaplus(infos) }).catch((error) => { console.log(error); }); }) }, // 用户信息埋点 userAplus() { console.log('------------进入用户信息埋点---------------'); aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['_user_nick', '放项目获取到的用户名'] }) aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['_user_id', '放项目获取到的userid'] }) }, // 基础采集 SetZwaplus(infos) { if (infos.userType && infos.lon && infos.lat) { console.log(infos, '--------------进入PV日志参数埋点----------------'); aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['_hold', 'BLOCK'] }) // 单页应用路由切换后 或 在异步获取到 pv 日志所需的参数后再执行 sendPV: aplus_queue.push({ action: 'aplus.sendPV', arguments: [ { is_auto: false }, { miniAppId: '放自己项目的AppId', miniAppName: '放自己项目的AppName', long: infos.lon, lati: infos.lat, userType: infos.userType, } ] }) aplus_queue.push({ action: 'aplus.setMetaInfo', arguments: ['_hold', 'START'] }) } }
mounted() { this.userAplus() this.getData() }