visual-buried-point-platform-uni 1.0.0-alpha.7 → 1.0.0-alpha.9

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/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Uni版自定义埋点SDK集成文档
2
2
 
3
+ ### SDK更新日志
4
+ - 1.0.0-alpha.07 最新uni、终端通用埋点sdk;
5
+ - 1.0.0-alpha.08 自定义上报数据结构删除path字段;
6
+
3
7
  ### 1、引入方式
4
8
 
5
9
  ```js
package/index.js CHANGED
@@ -109,7 +109,7 @@ export function setCustomEvent(data) {
109
109
  reportData = {
110
110
  ctk: data.$ctk ? data.$ctk : "",
111
111
  duration: "",
112
- element: null,
112
+ element: data.$element ? data.$element : null,
113
113
  eventId: data.$event_id ? data.$event_id : "",
114
114
  event: data.$event_code ? data.$event_code : "",
115
115
  groupId: "",
@@ -122,7 +122,6 @@ export function setCustomEvent(data) {
122
122
  title: _page.title ? _page.title : "",
123
123
  url: _path ? _path : getUrl(platform),
124
124
  },
125
- path: data.$path ? data.$path : "",
126
125
  properties: data.$extend_param ? JSON.stringify(data.$extend_param) : "",
127
126
  traceId: "",
128
127
  trackId: trackId,
@@ -192,15 +191,25 @@ function assemblyTrackData(type) {
192
191
  if (busObj) {
193
192
  let obj = getTrackObj(busObj, platform);
194
193
  let trackData = null;
194
+ let cirtemp;
195
195
  if (type === "destroy") {
196
+ cirtemp = 3;
196
197
  startTime = (Date.now() - startTimeLong) / 1000;
198
+ } else {
199
+ if (startTime === 0) {
200
+ startTime === 0;
201
+ cirtemp = 1;
202
+ } else {
203
+ startTime = 15;
204
+ cirtemp = 2;
205
+ }
197
206
  }
198
207
  trackData = {
199
208
  busSegment: busObj.busSegment,
200
- circulation: obj.circulation,
209
+ circulation: cirtemp,
201
210
  ctk: busObj.ctk ? busObj.ctk : "",
202
211
  domain: obj.domain,
203
- duration: startTime === 0 ? 0 : startTime,
212
+ duration: startTime,
204
213
  module: busObj.module,
205
214
  path: obj.path,
206
215
  properties: busObj.extend_param
package/lsi-md5.js CHANGED
@@ -1,15 +1,14 @@
1
1
  // 此js在npm build,根据name + version + md5后会自动修改package.json中的lsi
2
2
  // 注:发给后端,作为标识依据和上报字段lsi值
3
- import fs from 'fs' ;
4
- import MD5 from 'md5' ;
5
- const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
6
-
3
+ import fs from "fs";
4
+ import MD5 from "md5";
5
+ const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
7
6
 
8
7
  const { name, version } = packageJson;
9
8
  // MD5
10
9
  const combinedString = name + "-" + version;
11
10
  const md5Str = MD5(combinedString);
12
- packageJson.lsi = md5Str;
11
+ packageJson.lsi = md5Str + "#" + version;
13
12
  //base64
14
13
  // const combinedString = name.substring(0, 16) + "v" + version;
15
14
  // const base64Str = btoa(combinedString);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "visual-buried-point-platform-uni",
3
- "version": "1.0.0-alpha.07",
4
- "lsi": "e582f1f81f1398a0441584a6a87e5f80",
3
+ "version": "1.0.0-alpha.09",
4
+ "lsi": "2fd45101ac37118f6d823ce6589d52fb#1.0.0-alpha.09",
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": {
package/tools.js CHANGED
@@ -173,8 +173,8 @@ export function getTrackObj(busObj, platform) {
173
173
  path: gcp.route,
174
174
  domain: busObj.domain ? busObj.domain : "",
175
175
  url: busObj.url ? busObj.url : getUrl(platform),
176
- circulation: gcp.length > 1 ? 2 : 1,
177
- visitPage: gcp.length,
176
+ circulation: pages.length > 1 ? 2 : 1,
177
+ visitPage: pages.length,
178
178
  sourceDomain: busObj.sourceDomain ? busObj.sourceDomain : "",
179
179
  sourceUrl: busObj.sourceUrl ? busObj.sourceUrl : "",
180
180
  title: busObj.title ? busObj.title : "",