Browse Source

feature : 埋点还差sid等参数待改动

梦辉 2 months ago
parent
commit
d8bf0582c9

+ 43 - 0
public/index.html

@@ -27,6 +27,49 @@
     <!--  type="text/javascript"-->
     <!--  src="//assets.zjzwfw.gov.cn/assets/zwlog/1.0.0/zwlog.js"-->
     <!--&gt;</script>-->
+      <script src='https://wpkgate-emas.ding.zj.gov.cn/static/wpk-jssdk.1.0.2/wpkReporter.js' crossorigin='true'></script>
+      <script>
+          try {
+              const config = {
+                  bid: 'nbyzjcybt_zzdpro',
+                  signkey: '1234567890abcdef',
+                  gateway: 'https://wpkgate-emas.ding.zj.gov.cn'
+              };
+              const wpk = new wpkReporter(config);
+              wpk.installAll();
+              window._wpk = wpk;
+          } catch (err) {
+              console.error('WpkReporter init fail', err);
+          }
+      </script>
+      <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://alidt.alicdn.com/alilog/mlog/aplus_cloud.js';
+              f.parentNode.insertBefore(j, f);
+          })(window, document, 'script', 'aplus_queue');
+
+          aplus_queue.push({
+              action: 'aplus.setMetaInfo',
+              arguments: ['aplus-rhost-v', 'alog-api.ding.zj.gov.cn']
+          });
+          aplus_queue.push({
+              action: 'aplus.setMetaInfo',
+              arguments: ['aplus-rhost-g', 'alog-api.ding.zj.gov.cn']
+          });
+
+          var u = navigator.userAgent
+          var isAndroid = u.indexOf('Android') > -1
+          var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
+
+          aplus_queue.push({
+              action: 'aplus.setMetaInfo',
+              arguments: ['appId', isAndroid ? '28302650' : isIOS ? '28328447' : '47130293']
+          });
+      </script>
   </head>
 
   <body>

+ 2 - 0
src/pages/blank/blank.vue

@@ -256,6 +256,7 @@ export default {
       const res = await dd.getAuthCode({
         corpId: '50329019'
       })
+      sessionStorage.setItem('accountId', res.accountId);
       if(res) {
         try{
           const exemptionRes  =  await exemption({
@@ -273,6 +274,7 @@ export default {
               openId: exemptionRes.data.userInfo.id,
               uuid: exemptionRes.data.userInfo.id,
             });
+
             app.globalData.openid = exemptionRes.data.userInfo.id;
             uni.reLaunch({
               url: "/pages/home/home",

+ 4 - 0
src/pages/home/home.vue

@@ -6,6 +6,7 @@ import EnterPriseList from "./components/enterpriseList/index.vue";
 import TemplateList from "./components/templateList/index.vue";
 import RecentlySearch from "./components/recentlySearch/index.vue";
 import {searchCommitment} from "@/api/commitment";
+import buriedPoint from "@/utils/dd.buriedPoint";
 
 
 export default {
@@ -17,6 +18,9 @@ export default {
     TemplateList,
     RecentlySearch
   },
+  onLoad() {
+    buriedPoint("首页",1,'pages/home/home')
+  },
   data() {
     return {
       activeIndex: 0, // 当前激活的菜单索引

+ 5 - 1
src/pages/message/message.vue

@@ -1,5 +1,6 @@
 <script>
 import RemindList from '@/components/bussinessComponents/remind-list/index.vue'
+import buriedPoint from "@/utils/dd.buriedPoint";
 export default {
   data() {
     return {
@@ -8,7 +9,10 @@ export default {
   },
   components: {
     RemindList
-  }
+  },
+  onLoad() {
+    buriedPoint('消息','2','pages/message/message')
+  },
 }
 </script>
 

+ 4 - 0
src/pages/my/my.vue

@@ -154,6 +154,7 @@ import {getUserInfo, updateUserInfo, getMyDoorplateAll, getPersonalHouseNumber}
 import { storageUserInfo } from "@/utils/index";
 import { DOOR_TYPE } from "@/utils/const";
 import Vue from "vue";
+import buriedPoint from "@/utils/dd.buriedPoint";
 const app = getApp();
 
 export default {
@@ -191,6 +192,9 @@ export default {
     this.userInfo = uni.getStorageSync("userInfo") || {};
     this.bindStatus = app.globalData.bindStatus;
     this.getUserInfo();
+
+    buriedPoint("我的",'3','pages/my/my')
+
   },
   onShow() {
     if (app.globalData.doorplateInfo.code) {

+ 4 - 0
src/subPages/pages/commitment/commitmentDetail/index.vue

@@ -5,6 +5,7 @@ import DividerComponents from "@/subPages/pages/commitment/commitmentDetail/comp
 import IndicatorComponents from "@/subPages/pages/commitment/commitmentDetail/components/IndicatorComponents.vue";
 import {downFileBase64, editVerifyTask} from "@/api/commitment";
 import CommitmentConfirmForm from "@/subPages/pages/commitment/components/commitmentConfirmForm/index.vue";
+import buriedPoint from "@/utils/dd.buriedPoint";
 
 export default {
   components: {CommitmentConfirmForm, IndicatorComponents, DividerComponents, InputComponents, DescriptionText},
@@ -31,6 +32,9 @@ export default {
       ]
     };
   },
+  onLoad(){
+    buriedPoint('经营承诺详情','1-2','subPages/pages/commitment/commitmentDetail/index')
+  },
   computed: {
     templateJson: {
       get() {

+ 4 - 0
src/subPages/pages/commitment/enterpriseCommitment/index.vue

@@ -3,6 +3,7 @@ import ScoreList from "@/subPages/pages/commitment/enterpriseCommitment/componen
 import {getEnterpriseDetail, getPromiseList} from "@/api/commitment";
 import PromiseList from "@/subPages/pages/commitment/components/promiseList/index.vue";
 import RemindList from "@/components/bussinessComponents/remind-list/index.vue";
+import buriedPoint from "@/utils/dd.buriedPoint";
 
 export default {
   components: {
@@ -10,6 +11,9 @@ export default {
     ScoreList,
     RemindList
   },
+  onLoad(){
+    buriedPoint('企业承诺','1-3','subPages/pages/commitment/enterpriseCommitment/index')
+  },
   data() {
     return {
       enterpriseDetail: {},

+ 4 - 0
src/subPages/pages/commitment/home/index.vue

@@ -6,6 +6,7 @@ import EnterPriseList from "./components/enterpriseList/index.vue";
 import TemplateList from "./components/templateList/index.vue";
 import RecentlySearch from "./components/recentlySearch/index.vue";
 import {searchCommitment} from "@/api/commitment";
+import buriedPoint from "@/utils/dd.buriedPoint";
 
 
 export default {
@@ -17,6 +18,9 @@ export default {
     TemplateList,
     RecentlySearch
   },
+  onLoad(){
+    buriedPoint('经营承诺','1-3','subPages/pages/commitment/home/index')
+  },
   data() {
     return {
       activeIndex: 0, // 当前激活的菜单索引

+ 4 - 0
src/subPages/pages/commitment/remindDetail/index.vue

@@ -1,5 +1,6 @@
 <script>
 import {downFileBase64, reminderDetails} from "@/api/commitment";
+import buriedPoint from "@/utils/dd.buriedPoint";
 
 export default {
   watch: {
@@ -22,6 +23,9 @@ export default {
       reminderDetail: {},
     }
   },
+  onLoad(){
+    buriedPoint('提醒详情','3-2','subPages/pages/commitment/remindDetail/index')
+  },
   methods: {
     handleGetDetail() {
       reminderDetails({

+ 47 - 0
src/utils/dd.buriedPoint.js

@@ -0,0 +1,47 @@
+/* eslint-disable */
+const buriedPoint = (name, id, url) => {
+    // 单页应用 或 “单个页面”需异步补充PV日志参数还需进行如下埋点:
+    aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        arguments: ['aplus-waiting', 'MAN']
+    });
+    // 如采集用户信息是异步行为需要先执行这个BLOCK埋点
+    aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        arguments: ['_hold', 'BLOCK']
+    });
+    // 单页应用路由切换后 或 在异步获取到pv日志所需的参数后再执行sendPV:
+    aplus_queue.push({
+        action: 'aplus.sendPV',
+        arguments: [{
+            is_auto: false
+        }, {
+            // 当前你的应用信息,此两行请勿修改
+            sapp_id: '19796',
+            sapp_name: 'nbyzjcybt',
+            // 自定义PV参数key-value键值对(只能是这种平铺的json,不能做多层嵌套),如:
+            page_id: id,
+            page_name: name,
+            page_url: url
+        }]
+    })
+    // 设置用户ID,用户设备ID可不做上报,若上报可使用开放平台JSAPI获取UUID
+    //用户id需要埋政钉用户真实信息,用户ID必须用accountId,可通过开放平台“获取用户详情”接口获取。
+    aplus_queue.push({
+        action: "aplus.setMetaInfo",
+        arguments: ["_user_id", sessionStorage.getItem('accountId')]
+    });
+    // aplus_queue.push({
+    //     action: "aplus.setMetaInfo",
+    //     arguments: ["_dev_id", "当前用户设备ID"]
+    // });
+
+    // 如采集用户信息是异步行为,需要先设置完用户信息后再执行这个START埋点
+    // 此时被block住的日志会携带上用户信息逐条发出
+    aplus_queue.push({
+        action: 'aplus.setMetaInfo',
+        arguments: ['_hold', 'START']
+    });
+}
+
+export default buriedPoint