trackersdk2 1.0.6 → 1.0.7
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/dist/TrackerSDK.d.ts +8 -0
- package/dist/index.cjs.js +13 -6
- package/dist/index.d.ts +10 -3
- package/dist/index.esm.js +14 -6
- package/dist/index.umd.js +13 -6
- package/dist/types.d.ts +1 -0
- package/package.json +41 -41
package/dist/TrackerSDK.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export declare class TrackerSDK {
|
|
|
6
6
|
private batchTimer;
|
|
7
7
|
private hasSentBeforeUnload;
|
|
8
8
|
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* @description 初始化埋点SDK
|
|
11
|
+
* @param config TrackerConfig
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
9
14
|
init(config: TrackerConfig): void;
|
|
10
15
|
/**
|
|
11
16
|
* @description 重试批量上报之前上报失败的数据
|
|
@@ -62,6 +67,9 @@ export declare class TrackerSDK {
|
|
|
62
67
|
private saveFailedBatch;
|
|
63
68
|
/**
|
|
64
69
|
* @description 自定义点击事件
|
|
70
|
+
*
|
|
71
|
+
* @param event 上报事件名称
|
|
72
|
+
* @param properties 上报数据
|
|
65
73
|
*/
|
|
66
74
|
track(event: string, properties?: Record<string, any>): void;
|
|
67
75
|
/**
|
package/dist/index.cjs.js
CHANGED
|
@@ -295,9 +295,15 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
295
295
|
enableAutoClickTagNameList: [],
|
|
296
296
|
autoTrack: false,
|
|
297
297
|
batchSize: 10,
|
|
298
|
-
batchInterval: 5000
|
|
298
|
+
batchInterval: 5000,
|
|
299
|
+
enablePerformanceTracking: true
|
|
299
300
|
};
|
|
300
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* @description 初始化埋点SDK
|
|
304
|
+
* @param config TrackerConfig
|
|
305
|
+
* @return void
|
|
306
|
+
*/
|
|
301
307
|
return _createClass(TrackerSDK, [{
|
|
302
308
|
key: "init",
|
|
303
309
|
value: function init(config) {
|
|
@@ -313,7 +319,9 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
313
319
|
}
|
|
314
320
|
this.config = _objectSpread2(_objectSpread2({}, this.config), config);
|
|
315
321
|
this.setupErrorTracking();
|
|
316
|
-
this.
|
|
322
|
+
if (this.config.enablePerformanceTracking) {
|
|
323
|
+
this.setupPerformanceTracking();
|
|
324
|
+
}
|
|
317
325
|
this.trackUV();
|
|
318
326
|
// 监听页面卸载
|
|
319
327
|
this.setupPageUnloadHandler();
|
|
@@ -681,6 +689,9 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
681
689
|
}
|
|
682
690
|
/**
|
|
683
691
|
* @description 自定义点击事件
|
|
692
|
+
*
|
|
693
|
+
* @param event 上报事件名称
|
|
694
|
+
* @param properties 上报数据
|
|
684
695
|
*/
|
|
685
696
|
}, {
|
|
686
697
|
key: "track",
|
|
@@ -1002,10 +1013,6 @@ var index = {
|
|
|
1002
1013
|
}
|
|
1003
1014
|
}
|
|
1004
1015
|
};
|
|
1005
|
-
function useTracker() {
|
|
1006
|
-
return tracker;
|
|
1007
|
-
}
|
|
1008
1016
|
|
|
1009
1017
|
exports.default = index;
|
|
1010
1018
|
exports.tracker = tracker;
|
|
1011
|
-
exports.useTracker = useTracker;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface TrackerConfig {
|
|
|
8
8
|
debug?: boolean;
|
|
9
9
|
batchSize?: number;
|
|
10
10
|
batchInterval?: number;
|
|
11
|
+
enablePerformanceTracking?: boolean;
|
|
11
12
|
}
|
|
12
13
|
interface TrackProperties {
|
|
13
14
|
[propName: string]: string | number | boolean | null | undefined;
|
|
@@ -26,6 +27,11 @@ declare class TrackerSDK {
|
|
|
26
27
|
private batchTimer;
|
|
27
28
|
private hasSentBeforeUnload;
|
|
28
29
|
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* @description 初始化埋点SDK
|
|
32
|
+
* @param config TrackerConfig
|
|
33
|
+
* @return void
|
|
34
|
+
*/
|
|
29
35
|
init(config: TrackerConfig): void;
|
|
30
36
|
/**
|
|
31
37
|
* @description 重试批量上报之前上报失败的数据
|
|
@@ -82,6 +88,9 @@ declare class TrackerSDK {
|
|
|
82
88
|
private saveFailedBatch;
|
|
83
89
|
/**
|
|
84
90
|
* @description 自定义点击事件
|
|
91
|
+
*
|
|
92
|
+
* @param event 上报事件名称
|
|
93
|
+
* @param properties 上报数据
|
|
85
94
|
*/
|
|
86
95
|
track(event: string, properties?: Record<string, any>): void;
|
|
87
96
|
/**
|
|
@@ -146,6 +155,4 @@ declare const _default: {
|
|
|
146
155
|
install(app: any, options: TrackerConfig): void;
|
|
147
156
|
};
|
|
148
157
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
export { _default as default, tracker, useTracker };
|
|
158
|
+
export { _default as default, tracker };
|
package/dist/index.esm.js
CHANGED
|
@@ -291,9 +291,15 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
291
291
|
enableAutoClickTagNameList: [],
|
|
292
292
|
autoTrack: false,
|
|
293
293
|
batchSize: 10,
|
|
294
|
-
batchInterval: 5000
|
|
294
|
+
batchInterval: 5000,
|
|
295
|
+
enablePerformanceTracking: true
|
|
295
296
|
};
|
|
296
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* @description 初始化埋点SDK
|
|
300
|
+
* @param config TrackerConfig
|
|
301
|
+
* @return void
|
|
302
|
+
*/
|
|
297
303
|
return _createClass(TrackerSDK, [{
|
|
298
304
|
key: "init",
|
|
299
305
|
value: function init(config) {
|
|
@@ -309,7 +315,9 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
309
315
|
}
|
|
310
316
|
this.config = _objectSpread2(_objectSpread2({}, this.config), config);
|
|
311
317
|
this.setupErrorTracking();
|
|
312
|
-
this.
|
|
318
|
+
if (this.config.enablePerformanceTracking) {
|
|
319
|
+
this.setupPerformanceTracking();
|
|
320
|
+
}
|
|
313
321
|
this.trackUV();
|
|
314
322
|
// 监听页面卸载
|
|
315
323
|
this.setupPageUnloadHandler();
|
|
@@ -677,6 +685,9 @@ var TrackerSDK = /*#__PURE__*/function () {
|
|
|
677
685
|
}
|
|
678
686
|
/**
|
|
679
687
|
* @description 自定义点击事件
|
|
688
|
+
*
|
|
689
|
+
* @param event 上报事件名称
|
|
690
|
+
* @param properties 上报数据
|
|
680
691
|
*/
|
|
681
692
|
}, {
|
|
682
693
|
key: "track",
|
|
@@ -998,8 +1009,5 @@ var index = {
|
|
|
998
1009
|
}
|
|
999
1010
|
}
|
|
1000
1011
|
};
|
|
1001
|
-
function useTracker() {
|
|
1002
|
-
return tracker;
|
|
1003
|
-
}
|
|
1004
1012
|
|
|
1005
|
-
export { index as default, tracker
|
|
1013
|
+
export { index as default, tracker };
|
package/dist/index.umd.js
CHANGED
|
@@ -295,9 +295,15 @@
|
|
|
295
295
|
enableAutoClickTagNameList: [],
|
|
296
296
|
autoTrack: false,
|
|
297
297
|
batchSize: 10,
|
|
298
|
-
batchInterval: 5000
|
|
298
|
+
batchInterval: 5000,
|
|
299
|
+
enablePerformanceTracking: true
|
|
299
300
|
};
|
|
300
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* @description 初始化埋点SDK
|
|
304
|
+
* @param config TrackerConfig
|
|
305
|
+
* @return void
|
|
306
|
+
*/
|
|
301
307
|
return _createClass(TrackerSDK, [{
|
|
302
308
|
key: "init",
|
|
303
309
|
value: function init(config) {
|
|
@@ -313,7 +319,9 @@
|
|
|
313
319
|
}
|
|
314
320
|
this.config = _objectSpread2(_objectSpread2({}, this.config), config);
|
|
315
321
|
this.setupErrorTracking();
|
|
316
|
-
this.
|
|
322
|
+
if (this.config.enablePerformanceTracking) {
|
|
323
|
+
this.setupPerformanceTracking();
|
|
324
|
+
}
|
|
317
325
|
this.trackUV();
|
|
318
326
|
// 监听页面卸载
|
|
319
327
|
this.setupPageUnloadHandler();
|
|
@@ -681,6 +689,9 @@
|
|
|
681
689
|
}
|
|
682
690
|
/**
|
|
683
691
|
* @description 自定义点击事件
|
|
692
|
+
*
|
|
693
|
+
* @param event 上报事件名称
|
|
694
|
+
* @param properties 上报数据
|
|
684
695
|
*/
|
|
685
696
|
}, {
|
|
686
697
|
key: "track",
|
|
@@ -1002,13 +1013,9 @@
|
|
|
1002
1013
|
}
|
|
1003
1014
|
}
|
|
1004
1015
|
};
|
|
1005
|
-
function useTracker() {
|
|
1006
|
-
return tracker;
|
|
1007
|
-
}
|
|
1008
1016
|
|
|
1009
1017
|
exports.default = index;
|
|
1010
1018
|
exports.tracker = tracker;
|
|
1011
|
-
exports.useTracker = useTracker;
|
|
1012
1019
|
|
|
1013
1020
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1014
1021
|
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "trackersdk2",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "一个适用于uni-app h5的前端埋点SDK,支持多种数据上报方式,帮助开发者轻松收集和分析用户行为数据。",
|
|
5
|
-
"main": "dist/index.cjs.js",
|
|
6
|
-
"module": "dist/index.esm.js",
|
|
7
|
-
"browser": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "rollup -c",
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"前端",
|
|
15
|
-
"埋点",
|
|
16
|
-
"sdk",
|
|
17
|
-
" tracker",
|
|
18
|
-
"uni-app",
|
|
19
|
-
"h5"
|
|
20
|
-
],
|
|
21
|
-
"author": "",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"files": [
|
|
24
|
-
"dist"
|
|
25
|
-
],
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@babel/preset-env": "^7.28.6",
|
|
28
|
-
"@babel/preset-typescript": "^7.28.5",
|
|
29
|
-
"@rollup/plugin-babel": "^6.1.0",
|
|
30
|
-
"rollup": "^4.55.1",
|
|
31
|
-
"rollup-plugin-dts": "^6.3.0",
|
|
32
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
33
|
-
"typescript": "^5.9.3"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"web-vitals": "^5.1.0"
|
|
37
|
-
},
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": ">=19.3.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "trackersdk2",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "一个适用于uni-app h5的前端埋点SDK,支持多种数据上报方式,帮助开发者轻松收集和分析用户行为数据。",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"browser": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rollup -c",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"前端",
|
|
15
|
+
"埋点",
|
|
16
|
+
"sdk",
|
|
17
|
+
" tracker",
|
|
18
|
+
"uni-app",
|
|
19
|
+
"h5"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@babel/preset-env": "^7.28.6",
|
|
28
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
29
|
+
"@rollup/plugin-babel": "^6.1.0",
|
|
30
|
+
"rollup": "^4.55.1",
|
|
31
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
32
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
33
|
+
"typescript": "^5.9.3"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"web-vitals": "^5.1.0"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=19.3.0"
|
|
40
|
+
}
|
|
41
|
+
}
|