hml2020 2 lat temu
rodzic
commit
d0df54865c
1 zmienionych plików z 35 dodań i 27 usunięć
  1. 35 27
      purchase_H5/src/common/addRecord.js

+ 35 - 27
purchase_H5/src/common/addRecord.js

@@ -5,27 +5,45 @@ import {
 } from '../api/index'
 
 import sdk from './buriedPoint'
-
-const activityPoint = (cpnVal, eaVal, ettVal) => {
-  let { phone } = store.state.addrData
-  WoAnalytics.addPoint({
+const pointArr = [
+  {
     ad: '209263oNPKAcWHeWoE',
     pm: '',
     at: 'changshi20221101',
-    ett: ettVal,
-    ea: eaVal,
-    cpn: cpnVal,
-    mp: phone
+    spid: ['296', '298']
+  },
+  {
+    ad: '2092LOAjxP3YwpDa',
+    pm: '',
+    at: '20221125KEEP',
+    spid: ['1217', '1219']
+  },
+]
+
+const activityPoint = (cpnVal, eaVal, ettVal) => {
+  let { phone, product } = store.state.addrData
+  pointArr.forEach(val => {
+    val.spid.forEach(item => {
+      if (item == product.spid) {
+        WoAnalytics.addPoint({
+          ad: val.ad,
+          pm: val.pm,
+          at: val.at,
+          ett: ettVal,
+          ea: eaVal,
+          cpn: cpnVal,
+          mp: phone
+        })
+      }
+    })
   })
+
 }
 
 const overtime = () => {
-  let { product } = store.state.addrData
   if (store.state.global.js === 0) {
     if (store.state.global.point === 0) {
-      if (product.spid == '296' || product.spid == '298') {
-        activityPoint('pay_result', 'pay_result_success', 'open')
-      }
+      activityPoint('pay_result', 'pay_result_success', 'open')
     }
   }
 }
@@ -92,9 +110,7 @@ const loginSuccess = () => {
     if (store.state.global.point === 0) {
       VuePageVisitor.setMp(phone);
 
-      if (product.spid == '296' || product.spid == '298') {
-        activityPoint('activity_detail', 'activity_detail_login', 'custom')
-      }
+      activityPoint('activity_detail', 'activity_detail_login', 'custom')
     }
   }
 
@@ -179,9 +195,7 @@ const buyClick = () => {
           }
         }
 
-        if (product.spid == '296' || product.spid == '298') {
-          activityPoint('activity_detail', 'activity_detail_order', 'click')
-        }
+        activityPoint('activity_detail', 'activity_detail_order', 'click')
       }
     }
   }, 200)
@@ -224,9 +238,7 @@ const buySuccess = () => {
     }
     if (store.state.global.js === 0) {
       if (store.state.global.point === 0) {
-        if (product.spid == '296' || product.spid == '298') {
-          activityPoint('pay_result', 'pay_result_success', 'open')
-        }
+        activityPoint('pay_result', 'pay_result_success', 'open')
       }
     }
   }, 600)
@@ -267,9 +279,7 @@ const buyFail = (response) => {
   }
   if (store.state.global.js === 0) {
     if (store.state.global.point === 0) {
-      if (product.spid == '296' || product.spid == '298') {
-        activityPoint('pay_result', 'pay_result_failure', 'open')
-      }
+      activityPoint('pay_result', 'pay_result_failure', 'open')
     }
   }
 }
@@ -951,9 +961,7 @@ const openPage = () => {
           })
         }
       })
-      if (product.spid == '296' || product.spid == '298') {
-        activityPoint('activity_detail', 'activity_detail_view', 'open')
-      }
+      activityPoint('activity_detail', 'activity_detail_view', 'open')
 
     }
   }