فهرست منبع

feat: 公共订单底部提交组件埋点

cuiyalong 3 سال پیش
والد
کامیت
c87f295939

+ 8 - 1
src/web/staticres/common-module/coupon/js/pay-order-template.js

@@ -125,7 +125,7 @@ var couponTem = {
           <div class="handle-btn">
             <div v-if="config.type == 'dataExport'" id="previewButton" class="btn-item btn-default" @click="previewFn">预览数据</div>
             <div v-if="config.type == 'vip-update'" id="cancelButton" class="btn-item btn-default" @click="cancelFn">取&nbsp;&nbsp;&nbsp;&nbsp;消</div>
-            <button type="button" class="btn-item btn-primary" id="submitButton" :disabled="submitStatus" @click="submitFn">@@btnText@@</button> 
+            <button type="button" :data-cl-event="confirmButtonEventAttr" class="btn-item btn-primary" id="submitButton" :disabled="submitStatus" @click="submitFn">@@btnText@@</button> 
           </div>
         </div>
         <div class="order-service">
@@ -142,6 +142,13 @@ var couponTem = {
     this.$emit('mounted')
   },
   computed: {
+    isWeiXinBrowser: function () {
+      return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+    },
+    confirmButtonEventAttr: function () {
+      var platform = this.isWeiXinBrowser ? 'wx' : 'app'
+      return `c_${platform}_buy_buttonclick`
+    },
     couponTypeTipClass: function () {
       if (this.coupon.type === '折扣券') {
         return 'discount'

+ 4 - 1
src/web/templates/weixin/dataExport/dataExport_payOrder.html

@@ -224,7 +224,7 @@
         </div>
     </main>
     <div class="fixed-bottom-box p15" id="coupon-vue">
-      <pay-order-template ref="couponRef" :config="$data" @update="updateS"></pay-order-template>
+      <pay-order-template ref="couponRef" :config="$data" @update="updateS" @mounted="payOrderTemplateMounted"></pay-order-template>
     </div>
     <div class="fixed-bottom-box p15" id="bottombox" style="display: none;">
         <div class="price" style="display: none">
@@ -1049,6 +1049,9 @@
       this.init()
     },
     methods: {
+        payOrderTemplateMounted: function () {
+          $('#submitButton').attr('data-cl-event', 'c_wx_buy_buttonclick')
+        },
         // 更新价格相关
         updatePrice: function (after, before) {
           console.log( '原价:' + before, '折扣价:' + after)