visual-buried-point-platform-uni 1.0.0-alpha.17 → 1.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/autoutils.js CHANGED
@@ -72,7 +72,6 @@ function autoTrackData(type) {
72
72
  const puvData = {
73
73
  busSegment: atObj.busSegment || "",
74
74
  circulation: cirtemp,
75
- ctk: "",
76
75
  domain: atObj.domain,
77
76
  duration: atDuration,
78
77
  module: atObj.module || "",
package/eventutils.js CHANGED
@@ -16,6 +16,7 @@ function getCurPath() {
16
16
 
17
17
  // 自定义部分 type=>custom event=>到四种具体事件类型 extend_param 扩展字段
18
18
  export function eventCommonStore(data) {
19
+ if (!data) return;
19
20
  const _page = data.$page ? data.$page : "";
20
21
  const _path = _page.path ? _page.path : getCurPath();
21
22
  let reportEventData = {
@@ -25,8 +26,8 @@ export function eventCommonStore(data) {
25
26
  eventId: data.$event_id ? data.$event_id : "",
26
27
  event: data.$event_code ? data.$event_code : "",
27
28
  groupId: "",
28
- busSegment: data.$busSegment,
29
- module: data.$module,
29
+ busSegment: data.$busSegment ? data.$busSegment : "",
30
+ module: data.$module ? data.$module : "",
30
31
  page: {
31
32
  domain: _page.domain ? _page.domain : "",
32
33
  pageId: MD5(_path),
@@ -57,14 +58,11 @@ export function eventCommonStore(data) {
57
58
  * 插入Event数据合并
58
59
  */
59
60
  export function insertEventData(cData) {
60
- console.log("写入Event数据 ", cData);
61
61
  const cd = uni.getStorageSync(BPNEvent);
62
62
  let allEventData = cd ? JSON.parse(cd) : [];
63
63
  if (cData && cData.length) {
64
64
  // concat方法
65
65
  allEventData.concat(cData);
66
- // ...方法
67
- // allEventData = { ...allEventData, ...cData };
68
66
  uni.setStorageSync(BPNEvent, JSON.stringify(allEventData));
69
67
  }
70
68
  }
package/index.js CHANGED
@@ -29,7 +29,6 @@ export function init(config) {
29
29
  Global.upEventUrl = _cf.reportUrl;
30
30
  Global.upTrackUrl = _cf.reportTrackUrl;
31
31
  Object.assign(Global, config);
32
- console.log("global:: ", Global);
33
32
  getBaseicInfo();
34
33
  _comInfo.distinctId = uni.getStorageSync("v_userId")
35
34
  ? uni.getStorageSync("v_userId")
@@ -43,9 +42,9 @@ export function init(config) {
43
42
  } else {
44
43
  console.log("init config error, please check config!");
45
44
  }
46
- // 开启全局定时器
45
+ // Enabling a global timer
47
46
  startGlobalTime();
48
- // 监听页面的加载、卸载
47
+ // Monitor page loading and unloading
49
48
  uniInterceptorListener();
50
49
  }
51
50
 
@@ -69,7 +68,7 @@ export function setUserId(userId) {
69
68
  }
70
69
  }
71
70
 
72
- //对外开放,获取跟踪Id
71
+ // get trackId
73
72
  export function getTrackId() {
74
73
  return sdkTrackIdVal();
75
74
  }
@@ -89,12 +88,12 @@ export function onDestroyTrack() {
89
88
  uStopTrackPVData();
90
89
  }
91
90
 
92
- // auto track 预置的属性
91
+ // auto track Preset attribute
93
92
  export function setPageExtraObj(tData) {
94
93
  uUpdatePageExtraArray(tData);
95
94
  }
96
95
 
97
- // 数据上报
96
+ // data upload
98
97
  export function reportTrackEventServer(upType, data, sFailKey) {
99
98
  if (!upType) {
100
99
  console.error("please set upload data upType");
@@ -142,7 +141,7 @@ function commonData(allData) {
142
141
  };
143
142
  }
144
143
 
145
- //获取基本信息
144
+ // get baseInfo
146
145
  function getBaseicInfo() {
147
146
  uni.getSystemInfo({
148
147
  success: function (res) {
@@ -162,7 +161,7 @@ function getBaseicInfo() {
162
161
  Global.platform = "weixin";
163
162
  appData = getWXInfo();
164
163
  }
165
- deviceData = getDeviceInfo(res, Global.platform);
164
+ deviceData = getDeviceInfo(res);
166
165
  },
167
166
  fail: function (error) {
168
167
  deviceData = getDeviceInfoError();
package/manualutils.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { AUTOTRACKTYPE, insertPVUVData } from "./autoutils.js";
2
2
  import {
3
3
  getTrackObj,
4
- getUtmObj, randomUUID,
4
+ getUtmObj,
5
+ randomUUID,
5
6
  sdkTrackIdVal,
6
- timeToStr
7
+ timeToStr,
7
8
  } from "./tools.js";
8
9
 
9
10
  // 流量上报采集
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "visual-buried-point-platform-uni",
3
- "version": "1.0.0-alpha.17",
4
- "lsi": "2df7d9fee02691e293eb3e32b4593ade#1.0.0-alpha.17",
3
+ "version": "1.0.0-alpha.19",
4
+ "lsi": "76e68a623e8df7515867ffd998b9f487#1.0.0-alpha.19",
5
5
  "description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "build": "webpack --mode production && npm run lsi-md5",
9
+ "build": "rimraf dist && webpack --mode production && npm run lsi-md5",
10
10
  "lsi-md5": "node lsi-md5.js"
11
11
  },
12
12
  "repository": {
@@ -21,6 +21,7 @@
21
21
  "md5": "^2.3.0"
22
22
  },
23
23
  "devDependencies": {
24
+ "rimraf": "^6.0.1",
24
25
  "webpack": "^5.72.1",
25
26
  "webpack-cli": "4.9.2"
26
27
  }
package/tools.js CHANGED
@@ -107,7 +107,6 @@ export function getWebH5Info(result) {
107
107
  packageName: hostname ? hostname : "",
108
108
  version: "",
109
109
  carrier: "h5",
110
- //ecology: ecology,
111
110
  ecology: "h5",
112
111
  };
113
112
  }
@@ -123,7 +122,6 @@ export function getWXInfo() {
123
122
  ? accInfo.miniProgram.envVersion + accInfo.miniProgram.version
124
123
  : "",
125
124
  carrier: "mini",
126
- // ecology: "wechat",
127
125
  ecology: "mini",
128
126
  };
129
127
  }
@@ -159,8 +157,8 @@ export function getAppInfo(result) {
159
157
  return app;
160
158
  }
161
159
 
162
- function getCurDeviceType(res, platform) {
163
- if (platform !== "wx") {
160
+ function getCurDeviceType(res) {
161
+ if (Global.platform === "web" || platform === "h5") {
164
162
  const userAgent = res.ua.toLowerCase();
165
163
  if (/(windows|win32|win64|wow64)/.test(userAgent)) {
166
164
  return 1;
@@ -181,7 +179,7 @@ function getCurDeviceType(res, platform) {
181
179
  }
182
180
 
183
181
  //获取设备信息
184
- export function getDeviceInfo(res, platform) {
182
+ export function getDeviceInfo(res) {
185
183
  let device = {
186
184
  lang: res.osLanguage ? res.osLanguage : res.hostLanguage,
187
185
  brand: res.deviceBrand + " " + res.deviceModel,
@@ -192,7 +190,7 @@ export function getDeviceInfo(res, platform) {
192
190
  browserVersion: res.browserVersion,
193
191
  color: "",
194
192
  deviceId: res.deviceId,
195
- deviceType: getCurDeviceType(res, platform),
193
+ deviceType: getCurDeviceType(res),
196
194
  network: "",
197
195
  };
198
196
  return device;
@@ -279,14 +277,14 @@ export function uUpdatePageExtraArray(d) {
279
277
 
280
278
  // 得到utm
281
279
  export function getUtmObj() {
282
- let utm = {
283
- utmSource: "",
284
- utmCampaign: "",
285
- utmTerm: "",
286
- utmContent: "",
287
- ctk: "",
288
- };
289
280
  if (Global.platform === "web" || Global.platform === "h5") {
281
+ let utm = {
282
+ utmSource: "",
283
+ utmCampaign: "",
284
+ utmTerm: "",
285
+ utmContent: "",
286
+ ctk: "",
287
+ };
290
288
  if (window.location.href) {
291
289
  const paramsUrl = window.location.href.split("?")[1] || "";
292
290
  if (paramsUrl) {
@@ -303,6 +301,8 @@ export function getUtmObj() {
303
301
  utm.ctk = urlParams.get("ctk") || "";
304
302
  }
305
303
  }
304
+ return utm;
305
+ } else {
306
+ return null;
306
307
  }
307
- return utm;
308
308
  }