visual-buried-point-platform-h5 1.3.4 → 1.3.5
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 +7 -5
- package/dist/buried-point-h5.js +1 -1
- package/package.json +2 -2
- package/src/config/index.ts +8 -15
- package/src/handlers.ts +6 -1
- package/src/utils/lazyReport.ts +32 -25
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-buried-point-platform-h5",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"lsi": "
|
|
3
|
+
"version": "1.3.5",
|
|
4
|
+
"lsi": "881af3bb46cc596ee04597d3611aec4f",
|
|
5
5
|
"description": "可视化埋点WebSdk",
|
|
6
6
|
"main": "dist/buried-point-h5.js",
|
|
7
7
|
"scripts": {
|
package/src/config/index.ts
CHANGED
|
@@ -78,19 +78,8 @@ function setReportPath(environment: string): {
|
|
|
78
78
|
"https://buryingpoint.gcongo.com.cn/api/report/data/reportDataFromWeb",
|
|
79
79
|
reportEventUrl: "https://buryingpoint.gcongo.com.cn/client/api/event",
|
|
80
80
|
reportTrackUrl: "https://buryingpoint.gcongo.com.cn/client/api/track",
|
|
81
|
-
eventListPath:
|
|
82
|
-
|
|
83
|
-
"https://buryingpoint.gcongo.com.cn/api/report/data/reportData/browse",
|
|
84
|
-
metaConfigPath:
|
|
85
|
-
"https://buryingpoint.gcongo.com.cn/api/metadataConfig/queryByProject/",
|
|
86
|
-
};
|
|
87
|
-
case "press":
|
|
88
|
-
return {
|
|
89
|
-
reportUrl:
|
|
90
|
-
"https://buryingpoint.gcongo.com.cn/api/report/data/reportDataFromWeb",
|
|
91
|
-
reportEventUrl: "",
|
|
92
|
-
reportTrackUrl: "",
|
|
93
|
-
eventListPath: "https://buryingpoint.gcongo.com.cn/api/event/query/",
|
|
81
|
+
eventListPath:
|
|
82
|
+
"https://buryingpoint.gcongo.com.cn/api/event/query/eventList",
|
|
94
83
|
reportPUVUrl:
|
|
95
84
|
"https://buryingpoint.gcongo.com.cn/api/report/data/reportData/browse",
|
|
96
85
|
metaConfigPath:
|
|
@@ -102,7 +91,8 @@ function setReportPath(environment: string): {
|
|
|
102
91
|
"https://buryingpoint.onebuygz.com/api/report/data/reportDataFromWeb",
|
|
103
92
|
reportEventUrl: "https://buryingpoint.onebuygz.com/client/api/event",
|
|
104
93
|
reportTrackUrl: "https://buryingpoint.onebuygz.com/client/api/track",
|
|
105
|
-
eventListPath:
|
|
94
|
+
eventListPath:
|
|
95
|
+
"https://buryingpoint.onebuygz.com/api/event/query/eventList",
|
|
106
96
|
reportPUVUrl:
|
|
107
97
|
"https://buryingpoint.onebuygz.com/api/report/data/reportData/browse",
|
|
108
98
|
metaConfigPath:
|
|
@@ -114,7 +104,10 @@ function setReportPath(environment: string): {
|
|
|
114
104
|
"https://buryingpoint.onebuygz.com/api/report/data/reportDataFromWeb",
|
|
115
105
|
reportEventUrl: "https://buryingpoint.onebuygz.com/client/api/event",
|
|
116
106
|
reportTrackUrl: "https://buryingpoint.onebuygz.com/client/api/track",
|
|
117
|
-
eventListPath: "https://buryingpoint.onebuygz.com/api/event/query/",
|
|
107
|
+
// eventListPath: "https://buryingpoint.onebuygz.com/api/event/query/",
|
|
108
|
+
//新的接口
|
|
109
|
+
eventListPath:
|
|
110
|
+
"https://buryingpoint.onebuygz.com/api/event/query/eventList",
|
|
118
111
|
reportPUVUrl:
|
|
119
112
|
"https://buryingpoint.onebuygz.com/api/report/data/reportData/browse",
|
|
120
113
|
metaConfigPath:
|
package/src/handlers.ts
CHANGED
|
@@ -828,8 +828,13 @@ function echo(type: boolean, eventList: any[]) {
|
|
|
828
828
|
*/
|
|
829
829
|
export function queryEventList(type = false, projectId?: string) {
|
|
830
830
|
request({
|
|
831
|
-
url: `${Config.eventListPath}${Config.token}`,
|
|
831
|
+
// url: `${Config.eventListPath}${Config.token}`,
|
|
832
|
+
url: Config.eventListPath,
|
|
832
833
|
type: "get",
|
|
834
|
+
data: {
|
|
835
|
+
projectId: Config.token,
|
|
836
|
+
terminalType: "web",
|
|
837
|
+
},
|
|
833
838
|
async: false,
|
|
834
839
|
success: (res) => {
|
|
835
840
|
try {
|
package/src/utils/lazyReport.ts
CHANGED
|
@@ -254,6 +254,7 @@ export function lazyReportCache(data, timeout = 3000) {
|
|
|
254
254
|
export function onCustReport(data) {
|
|
255
255
|
const _page = data.$page ? data.$page : "";
|
|
256
256
|
const _path = _page.path ? _page.path : window.location.pathname;
|
|
257
|
+
let _href = window.location.href;
|
|
257
258
|
const reportEventData = {
|
|
258
259
|
ctk: data.$ctk ? data.$ctk : "",
|
|
259
260
|
duration: data.$duration ? data.$duration : "",
|
|
@@ -273,6 +274,7 @@ export function onCustReport(data) {
|
|
|
273
274
|
pageId: MD5(_path),
|
|
274
275
|
path: _path,
|
|
275
276
|
title: _page.title ? _page.title : "",
|
|
277
|
+
url: _href ? _href : "",
|
|
276
278
|
},
|
|
277
279
|
};
|
|
278
280
|
|
|
@@ -295,36 +297,41 @@ export function onCustReport(data) {
|
|
|
295
297
|
*/
|
|
296
298
|
const getTrackObj = () => {
|
|
297
299
|
let gcp = GlobalVal.routerArray;
|
|
298
|
-
let
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
300
|
+
let wl = window.location;
|
|
301
|
+
let docTitle = document.title;
|
|
302
|
+
let refurl = document.referrer;
|
|
303
|
+
let parsedUrl;
|
|
304
|
+
if (refurl) {
|
|
305
|
+
parsedUrl = new URL(refurl);
|
|
306
|
+
} else {
|
|
307
|
+
let busRefUrl = busObj.sourceUrl;
|
|
308
|
+
if (busRefUrl) {
|
|
309
|
+
parsedUrl = new URL(busRefUrl);
|
|
304
310
|
} else {
|
|
305
|
-
|
|
311
|
+
parsedUrl = "";
|
|
306
312
|
}
|
|
313
|
+
}
|
|
314
|
+
if (gcp) {
|
|
307
315
|
return {
|
|
308
|
-
path:
|
|
316
|
+
path: wl.pathname,
|
|
317
|
+
domain: wl.hostname,
|
|
318
|
+
url: wl.href,
|
|
309
319
|
circulation: gcp.length > 1 ? 2 : 1,
|
|
310
|
-
sourceUrl: sUrl,
|
|
311
320
|
visitPage: gcp.length,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
let sUrl = hs.back ? hs.back : curPath;
|
|
316
|
-
return {
|
|
317
|
-
path: curPath,
|
|
318
|
-
circulation: hs.back ? 2 : 1,
|
|
319
|
-
sourceUrl: sUrl,
|
|
320
|
-
visitPage: hs.position + 1,
|
|
321
|
+
sourceDomain: parsedUrl ? parsedUrl.hostname : "",
|
|
322
|
+
sourceUrl: parsedUrl,
|
|
323
|
+
title: docTitle,
|
|
321
324
|
};
|
|
322
325
|
} else {
|
|
323
326
|
return {
|
|
324
|
-
path:
|
|
327
|
+
path: wl.pathname,
|
|
328
|
+
domain: wl.hostname,
|
|
329
|
+
url: wl.href,
|
|
325
330
|
circulation: 1,
|
|
326
|
-
sourceUrl: "/",
|
|
327
331
|
visitPage: 1,
|
|
332
|
+
sourceDomain: parsedUrl ? parsedUrl.hostname : "",
|
|
333
|
+
sourceUrl: parsedUrl,
|
|
334
|
+
title: docTitle,
|
|
328
335
|
};
|
|
329
336
|
}
|
|
330
337
|
};
|
|
@@ -334,21 +341,21 @@ const onTrackReport = (type: string) => {
|
|
|
334
341
|
if (type === "destroy") {
|
|
335
342
|
startTime = (Date.now() - startTimeLong) / 1000;
|
|
336
343
|
}
|
|
337
|
-
let dt = document.title;
|
|
338
344
|
let obj = getTrackObj();
|
|
339
345
|
puvData = {
|
|
340
346
|
busSegment: busObj.busSegment ? busObj.busSegment : Config.busSegment,
|
|
341
347
|
circulation: obj.circulation,
|
|
342
348
|
ctk: busObj.ctk ? busObj.ctk : "",
|
|
343
|
-
domain:
|
|
349
|
+
domain: obj.domain ? obj.domain : "",
|
|
344
350
|
duration: startTime === 0 ? 0 : startTime,
|
|
345
351
|
module: busObj.module ? busObj.module : Config.module,
|
|
346
352
|
path: obj.path,
|
|
347
|
-
|
|
348
|
-
sourceDomain:
|
|
353
|
+
url: obj.url,
|
|
354
|
+
sourceDomain: obj.sourceDomain,
|
|
349
355
|
sourceUrl: obj.sourceUrl,
|
|
356
|
+
properties: busObj.extend_param ? JSON.stringify(busObj.extend_param) : "",
|
|
350
357
|
sourceType: "route",
|
|
351
|
-
title:
|
|
358
|
+
title: obj.title,
|
|
352
359
|
traceId: "",
|
|
353
360
|
trackId: GlobalVal.trackId,
|
|
354
361
|
visitPage: obj.visitPage,
|