瀏覽代碼

feat: 新增唯一标示ID

zhangyuhan 4 年之前
父節點
當前提交
0fe84ca001
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/web/staticres/js/track/track.js

+ 7 - 4
src/web/staticres/js/track/track.js

@@ -878,7 +878,8 @@ class JyTrackRecord {
       element_tag: data.element_tag,
       xmlpath: data.xmlpath,
       sessionid: getCookieByName('SESSIONID'),
-      _d: getCookieByName('ud_safe')
+      _d: getCookieByName('ud_safe'),
+      onlyKey: null
     }
   }
   getAjaxTimeParams (inTime) {
@@ -892,7 +893,8 @@ class JyTrackRecord {
       params: JSON.stringify(this.utils.href().params),
       refer: document.referrer || null,
       sessionid: getCookieByName('SESSIONID'),
-      _d: getCookieByName('ud_safe')
+      _d: getCookieByName('ud_safe'),
+      onlyKey: null
     }
   }
   ajaxFn (type, params, async = true) {
@@ -915,7 +917,8 @@ class JyTrackRecord {
           }
         })
       } else {
-        const onlyHashKey = `${paramsData.href}?time=${paramsData.entrytime}&event=${paramsData.event}&path=${paramsData.xmlpath}&hash=${new Date().getTime()}`
+        const randomN = Number(Math.random().toString().substr(3, 15) + Date.now()).toString(36);
+        const onlyHashKey = `${paramsData.href}?time=${paramsData.entrytime}&event=${paramsData.event}&path=${paramsData.xmlpath}&hash=${randomN}`
         _jyTrackUp.setPending({
           type: 'event',
           onlyKey: onlyHashKey,
@@ -1047,7 +1050,7 @@ class JyTrackUp {
         type: params.type,
         update: params.update,
         ajax: params.ajax,
-        data: params.data
+        data: Object.assign(params.data, { onlyKey: md5Key })
       })
     })
   }