@fle-sdk/event-tracking-web 1.0.8 → 1.1.0

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.
@@ -1,4 +1,4 @@
1
- export interface _window extends Window {
1
+ export interface Target extends Window {
2
2
  /**
3
3
  * @description 自定义扩展取消监听函数
4
4
  * @default
@@ -10,126 +10,177 @@ export interface _window extends Window {
10
10
  */
11
11
  attachEvent?: (type: string, fun: (event: Event) => void, bol: boolean) => void;
12
12
  }
13
+ export interface EventParams extends Event {
14
+ /**
15
+ * @description 重写添加 arguments
16
+ * @default
17
+ */
18
+ arguments?: any[];
19
+ }
20
+ export interface JsonProps {
21
+ [key: string]: string | number | boolean;
22
+ }
13
23
  /**
14
24
  * @description 事件类型
15
25
  */
16
- export declare type EventTypes = "load" | "pushState" | "beforeunload" | "replaceState" | "replaceState" | "popstate" | "hashchange" | "click" | "customTrack";
17
- export interface JsonProps {
18
- [key: string]: any;
19
- }
20
- export interface ConfigProps extends JsonProps {
26
+ export declare type EventTypes = "PageView" | "PageRetained" | "CustomTrack" | "WebClick";
27
+ export interface PresetParams {
21
28
  /**
22
- * @description 项目唯一标识/项目ID
23
- * @default
29
+ * @description 应用唯一标识(由接口生成)
24
30
  */
25
- appKey: string;
31
+ appKey?: string;
26
32
  /**
27
- * @description 页面唯一标识
28
- * @default
33
+ * @description 数据接收地址
29
34
  */
30
- pageKey?: string;
35
+ serverUrl?: string;
31
36
  /**
32
- * @description 站点Id
33
- * @default
37
+ * @description 站点 ID
34
38
  */
35
39
  siteId?: string | number;
40
+ /**
41
+ * @description 是否在网页控制台打印发送的数据
42
+ * @default false
43
+ */
44
+ showLog?: boolean;
45
+ /**
46
+ * @description pc或h5
47
+ */
48
+ platform?: "h5" | "pc";
49
+ /**
50
+ * @description 是否开启全埋点 指的是:页面浏览、元素点击事件自动上报
51
+ * @default true
52
+ */
53
+ autoTrack?: boolean;
54
+ /**
55
+ * @description (是否使用客户端系统时间)注意:客户端系统时间可能会不准确,导致该字段不准确
56
+ * @default true
57
+ */
58
+ useClientTime?: boolean;
59
+ /**
60
+ * @description 队列单条数据最大发送时长,超过该时长将自动发送下一条数据,单位:毫秒
61
+ * @default 500
62
+ */
63
+ queueTimeout?: number;
64
+ /**
65
+ * @description 接口发送超时时长,超过该时长未发送成功将强制取消,单位:毫秒
66
+ * @default 3000
67
+ */
68
+ sendTimeout?: number;
69
+ /**
70
+ * @description 是否采集单页面应用的路由变化
71
+ * @default false
72
+ */
73
+ isTrackSinglePage?: boolean;
74
+ /**
75
+ * @description 数据类型
76
+ * @default "application/x-www-form-urlencoded"
77
+ */
78
+ contentType?: "application/x-www-form-urlencoded" | "application/json";
36
79
  }
37
- export interface OtherInfoProps extends JsonProps, SystemInfoProps {
80
+ export interface InitParams extends PresetParams {
38
81
  /**
39
- * @description 浏览器userAgent信息
40
- * @default
82
+ * @description 应用唯一标识(由接口生成)
41
83
  */
42
- userAgent?: string;
84
+ appKey: string;
43
85
  /**
44
- * @description 浏览器语言
45
- * @default
86
+ * @description 数据接收地址
87
+ */
88
+ serverUrl: string;
89
+ }
90
+ export interface ConfigTypes extends InitParams {
91
+ /**
92
+ * @description sdk版本
93
+ * @default "1.0.0"
46
94
  */
95
+ sdkVersion: string;
96
+ }
97
+ export interface SystemsInfo {
47
98
  language?: string;
99
+ location?: string;
100
+ network?: string;
101
+ ua?: string;
102
+ client?: string;
103
+ navigationStart?: number;
104
+ navigation?: string;
105
+ dns?: string;
106
+ tcp?: string;
107
+ "tcp (ssl)"?: string;
108
+ request?: string;
109
+ response?: string;
110
+ }
111
+ export interface TrackParams {
48
112
  /**
49
- * @description sdk 版本
50
- * @default
113
+ * @description 控件/自定义事件的唯一标识
51
114
  */
52
- sdkVersion?: string;
115
+ partkey: string | number;
116
+ /**
117
+ * @description 自定义代码埋点描述
118
+ * @default "自定义代码埋点上报"
119
+ */
120
+ desc?: string;
53
121
  /**
54
- * @description 设备类型
55
- * @default 'pc'
122
+ * @description 自定义属性
123
+ * @default {}
56
124
  */
57
- platformType?: "h5" | "pc";
125
+ business?: {
126
+ [key: string]: any;
127
+ };
58
128
  }
59
- export interface ApiConfigProps extends JsonProps {
129
+ export interface TargetEleProps {
60
130
  /**
61
- * @description 埋点上报api接口
62
- * @default
131
+ * @description dom节点名称
132
+ */
133
+ nodeName?: string;
134
+ /**
135
+ * @description id类名
63
136
  */
64
- serverApi: string;
137
+ id?: string;
65
138
  /**
66
- * @description 埋点上报服务器地址
67
- * @default
139
+ * @description class类名
68
140
  */
69
- serverHost: string;
70
- }
71
- export interface WebTrackingProps extends ConfigProps, ApiConfigProps {
141
+ className?: string;
72
142
  }
73
143
  export interface TargetEleProps {
74
144
  /**
75
145
  * @description dom节点名称
76
- * @default
77
146
  */
78
147
  nodeName?: string;
79
148
  /**
80
149
  * @description id类名
81
- * @default
82
150
  */
83
151
  id?: string;
84
152
  /**
85
153
  * @description class类名
86
- * @default
87
154
  */
88
155
  className?: string;
156
+ /**
157
+ * @description 元素位置
158
+ */
159
+ position?: number[];
89
160
  }
90
- export interface ExtroInfoProps extends OtherInfoProps {
161
+ export interface ExtroInfoProps {
91
162
  sourceUrl?: string;
92
163
  targetUrl?: string;
93
164
  business?: JsonProps;
94
165
  position?: number[];
95
166
  targetEle?: TargetEleProps;
167
+ currentUrl?: string;
96
168
  pageWidth?: number;
97
169
  pageHeight?: number;
98
170
  screenWidth?: number;
99
171
  screenHeight?: number;
100
- screenAvailWidth?: number;
101
- screenAvailHeight?: number;
102
- }
103
- export interface RequestProps {
104
- url: string;
105
- headers: {
106
- [key: string]: string;
107
- };
108
- params: string;
109
- async?: boolean;
110
- }
111
- export interface SystemInfoProps {
112
- language?: string;
113
- location?: string;
114
- network?: string;
115
- ua?: string;
116
- client?: string;
117
- navigationStart?: number;
118
- navigation?: string;
119
- dns?: string;
120
- tcp?: string;
121
- "tcp (ssl)"?: string;
122
- request?: string;
123
- response?: string;
172
+ pointerType?: string;
173
+ elementSelector?: string;
124
174
  }
125
- export interface TrackingPostProps {
175
+ export interface TrackingPostParams {
126
176
  event: EventTypes;
127
- desc?: string;
128
- itemKey: string;
177
+ desc: string;
178
+ itemKey?: string;
129
179
  extroInfo?: ExtroInfoProps;
130
180
  }
131
- export interface CustomTrackProps {
132
- desc?: string;
133
- partkey: string;
134
- business?: JsonProps;
181
+ export declare type HistoryType = "load" | "beforeunload" | "pushState" | "replaceState" | "popstate" | "hashchange";
182
+ export interface PageViewHandleParams {
183
+ currentUrl?: string;
184
+ targetUrl?: string;
185
+ type: HistoryType;
135
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fle-sdk/event-tracking-web",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "event tracking in web",
5
5
  "author": "飞象前端团队",
6
6
  "license": "ISC",
@@ -56,7 +56,7 @@
56
56
  "typescript": "^4.3.4"
57
57
  },
58
58
  "dependencies": {
59
- "@fle-sdk/event-tracking-web": "^1.0.8"
59
+ "@fle-sdk/event-tracking-web": "^1.1.0"
60
60
  },
61
- "gitHead": "cbae0485a02f891266c4f2b9ee13aa28926fd771"
61
+ "gitHead": "69fda470a359c02b164907386e9054478d39af98"
62
62
  }