@huaqiu/dsh-analytics 0.4.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/LICENSE +21 -0
- package/cordis.patch.yml +5 -0
- package/lib/client.js +3221 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.mts +48 -0
- package/lib/index.mjs +106 -0
- package/package.json +54 -0
- package/src/client/analytics.ts +57 -0
- package/src/client/index.ts +103 -0
- package/src/index.ts +55 -0
- package/src/routes.ts +23 -0
- package/src/tool-events.ts +79 -0
package/lib/client.js
ADDED
|
@@ -0,0 +1,3221 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@huaqiu/dsh-analytics",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var __create = Object.create;
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
17
|
+
key = keys[i];
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: ((k) => from[k]).bind(null, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
28
|
+
}) : target, mod));
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/client/analytics.ts
|
|
31
|
+
var import_sensorsdata_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
32
|
+
(function(e) {
|
|
33
|
+
"object" == typeof exports && "object" == typeof module ? module.exports = e() : e();
|
|
34
|
+
})(function() {
|
|
35
|
+
try {
|
|
36
|
+
var e = { modules: {} }, t = e._ = {};
|
|
37
|
+
(function() {
|
|
38
|
+
var e = {
|
|
39
|
+
"function": !0,
|
|
40
|
+
object: !0
|
|
41
|
+
}, t = e[typeof window] && window || this;
|
|
42
|
+
var r = t.JSON, a = t.JSON3, i = !1, n = function s(r, a) {
|
|
43
|
+
r || (r = t.Object()), a || (a = t.Object());
|
|
44
|
+
var i = r.Number || t.Number, n = r.String || t.String, o = r.Object || t.Object, c = r.Date || t.Date, l = r.SyntaxError || t.SyntaxError, u = r.TypeError || t.TypeError, d = r.Math || t.Math, p = r.JSON || t.JSON;
|
|
45
|
+
"object" == typeof p && p && (a.stringify = p.stringify, a.parse = p.parse);
|
|
46
|
+
var f, _ = o.prototype, g = _.toString, h = _.hasOwnProperty;
|
|
47
|
+
function m(e, t) {
|
|
48
|
+
try {
|
|
49
|
+
e();
|
|
50
|
+
} catch (r) {
|
|
51
|
+
t && t();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var v = new c(-0xc782b5b800cec);
|
|
55
|
+
function y(e) {
|
|
56
|
+
if (null != y[e]) return y[e];
|
|
57
|
+
var t;
|
|
58
|
+
if ("bug-string-char-index" == e) t = "a" != "a"[0];
|
|
59
|
+
else if ("json" == e) t = y("json-stringify") && y("date-serialization") && y("json-parse");
|
|
60
|
+
else if ("date-serialization" == e) {
|
|
61
|
+
if (t = y("json-stringify") && v) {
|
|
62
|
+
var r = a.stringify;
|
|
63
|
+
m(function() {
|
|
64
|
+
t = "\"-271821-04-20T00:00:00.000Z\"" == r(new c(-864e13)) && "\"+275760-09-13T00:00:00.000Z\"" == r(new c(864e13)) && "\"-000001-01-01T00:00:00.000Z\"" == r(new c(-621987552e5)) && "\"1969-12-31T23:59:59.999Z\"" == r(new c(-1));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
var s, o = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}";
|
|
69
|
+
if ("json-stringify" == e) {
|
|
70
|
+
var l = "function" == typeof (r = a.stringify);
|
|
71
|
+
l && ((s = function() {
|
|
72
|
+
return 1;
|
|
73
|
+
}).toJSON = s, m(function() {
|
|
74
|
+
l = "0" === r(0) && "0" === r(new i()) && "\"\"" == r(new n()) && r(g) === f && r(f) === f && r() === f && "1" === r(s) && "[1]" == r([s]) && "[null]" == r([f]) && "null" == r(null) && "[null,null,null]" == r([
|
|
75
|
+
f,
|
|
76
|
+
g,
|
|
77
|
+
null
|
|
78
|
+
]) && r({ a: [
|
|
79
|
+
s,
|
|
80
|
+
!0,
|
|
81
|
+
!1,
|
|
82
|
+
null,
|
|
83
|
+
"\0\b\n\f\r "
|
|
84
|
+
] }) == o && "1" === r(null, s) && "[\n 1,\n 2\n]" == r([1, 2], null, 1);
|
|
85
|
+
}, function() {
|
|
86
|
+
l = !1;
|
|
87
|
+
})), t = l;
|
|
88
|
+
}
|
|
89
|
+
if ("json-parse" == e) {
|
|
90
|
+
var u, d = a.parse;
|
|
91
|
+
"function" == typeof d && m(function() {
|
|
92
|
+
0 !== d("0") || d(!1) || (s = d(o), (u = 5 == s.a.length && 1 === s.a[0]) && (m(function() {
|
|
93
|
+
u = !d("\" \"");
|
|
94
|
+
}), u && m(function() {
|
|
95
|
+
u = 1 !== d("01");
|
|
96
|
+
}), u && m(function() {
|
|
97
|
+
u = 1 !== d("1.");
|
|
98
|
+
})));
|
|
99
|
+
}, function() {
|
|
100
|
+
u = !1;
|
|
101
|
+
}), t = u;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return y[e] = !!t;
|
|
105
|
+
}
|
|
106
|
+
if (m(function() {
|
|
107
|
+
v = -109252 == v.getUTCFullYear() && 0 === v.getUTCMonth() && 1 === v.getUTCDate() && 10 == v.getUTCHours() && 37 == v.getUTCMinutes() && 6 == v.getUTCSeconds() && 708 == v.getUTCMilliseconds();
|
|
108
|
+
}), y["bug-string-char-index"] = y["date-serialization"] = y.json = y["json-stringify"] = y["json-parse"] = null, !y("json")) {
|
|
109
|
+
var S = y("bug-string-char-index"), w = function(t, r) {
|
|
110
|
+
var a, i, n, s = 0;
|
|
111
|
+
for (n in (a = function() {
|
|
112
|
+
this.valueOf = 0;
|
|
113
|
+
}).prototype.valueOf = 0, i = new a()) h.call(i, n) && s++;
|
|
114
|
+
return a = i = null, s ? w = function(e, t) {
|
|
115
|
+
var r, a, i = "[object Function]" == g.call(e);
|
|
116
|
+
for (r in e) i && "prototype" == r || !h.call(e, r) || (a = "constructor" === r) || t(r);
|
|
117
|
+
(a || h.call(e, r = "constructor")) && t(r);
|
|
118
|
+
} : (i = [
|
|
119
|
+
"valueOf",
|
|
120
|
+
"toString",
|
|
121
|
+
"toLocaleString",
|
|
122
|
+
"propertyIsEnumerable",
|
|
123
|
+
"isPrototypeOf",
|
|
124
|
+
"hasOwnProperty",
|
|
125
|
+
"constructor"
|
|
126
|
+
], w = function(t, r) {
|
|
127
|
+
var a, n, s = "[object Function]" == g.call(t), o = !s && "function" != typeof t.constructor && e[typeof t.hasOwnProperty] && t.hasOwnProperty || h;
|
|
128
|
+
for (a in t) s && "prototype" == a || !o.call(t, a) || r(a);
|
|
129
|
+
for (n = i.length; a = i[--n];) o.call(t, a) && r(a);
|
|
130
|
+
}), w(t, r);
|
|
131
|
+
};
|
|
132
|
+
if (!y("json-stringify") && !y("date-serialization")) {
|
|
133
|
+
var b = {
|
|
134
|
+
92: "\\\\",
|
|
135
|
+
34: "\\\"",
|
|
136
|
+
8: "\\b",
|
|
137
|
+
12: "\\f",
|
|
138
|
+
10: "\\n",
|
|
139
|
+
13: "\\r",
|
|
140
|
+
9: "\\t"
|
|
141
|
+
}, k = function(e, t) {
|
|
142
|
+
return ("000000" + (t || 0)).slice(-e);
|
|
143
|
+
}, j = function(e) {
|
|
144
|
+
var t, r, a, i, n, s, o, c, l;
|
|
145
|
+
if (v) t = function(e) {
|
|
146
|
+
r = e.getUTCFullYear(), a = e.getUTCMonth(), i = e.getUTCDate(), s = e.getUTCHours(), o = e.getUTCMinutes(), c = e.getUTCSeconds(), l = e.getUTCMilliseconds();
|
|
147
|
+
};
|
|
148
|
+
else {
|
|
149
|
+
var u = d.floor, p = [
|
|
150
|
+
0,
|
|
151
|
+
31,
|
|
152
|
+
59,
|
|
153
|
+
90,
|
|
154
|
+
120,
|
|
155
|
+
151,
|
|
156
|
+
181,
|
|
157
|
+
212,
|
|
158
|
+
243,
|
|
159
|
+
273,
|
|
160
|
+
304,
|
|
161
|
+
334
|
|
162
|
+
], f = function(e, t) {
|
|
163
|
+
return p[t] + 365 * (e - 1970) + u((e - 1969 + (t = +(t > 1))) / 4) - u((e - 1901 + t) / 100) + u((e - 1601 + t) / 400);
|
|
164
|
+
};
|
|
165
|
+
t = function(e) {
|
|
166
|
+
for (i = u(e / 864e5), r = u(i / 365.2425) + 1970 - 1; f(r + 1, 0) <= i; r++);
|
|
167
|
+
for (a = u((i - f(r, 0)) / 30.42); f(r, a + 1) <= i; a++);
|
|
168
|
+
i = 1 + i - f(r, a), s = u((n = (e % 864e5 + 864e5) % 864e5) / 36e5) % 24, o = u(n / 6e4) % 60, c = u(n / 1e3) % 60, l = n % 1e3;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return (j = function(e) {
|
|
172
|
+
return e > -1 / 0 && e < 1 / 0 ? (t(e), e = (r <= 0 || r >= 1e4 ? (r < 0 ? "-" : "+") + k(6, r < 0 ? -r : r) : k(4, r)) + "-" + k(2, a + 1) + "-" + k(2, i) + "T" + k(2, s) + ":" + k(2, o) + ":" + k(2, c) + "." + k(3, l) + "Z", r = a = i = s = o = c = l = null) : e = null, e;
|
|
173
|
+
})(e);
|
|
174
|
+
};
|
|
175
|
+
if (y("json-stringify") && !y("date-serialization")) {
|
|
176
|
+
function P(e) {
|
|
177
|
+
return j(this);
|
|
178
|
+
}
|
|
179
|
+
var O = a.stringify;
|
|
180
|
+
a.stringify = function(e, t, r) {
|
|
181
|
+
var a = c.prototype.toJSON;
|
|
182
|
+
c.prototype.toJSON = P;
|
|
183
|
+
var i = O(e, t, r);
|
|
184
|
+
return c.prototype.toJSON = a, i;
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
var D = function(e) {
|
|
188
|
+
var t = e.charCodeAt(0);
|
|
189
|
+
return b[t] || "\\u00" + k(2, t.toString(16));
|
|
190
|
+
}, A = /[\x00-\x1f\x22\x5c]/g, N = function(e) {
|
|
191
|
+
return A.lastIndex = 0, "\"" + (A.test(e) ? e.replace(A, D) : e) + "\"";
|
|
192
|
+
}, C = function(e, t, r, a, i, n, s) {
|
|
193
|
+
var o, l, d, p, _, h, v, y, S;
|
|
194
|
+
if (m(function() {
|
|
195
|
+
o = t[e];
|
|
196
|
+
}), "object" == typeof o && o && (o.getUTCFullYear && "[object Date]" == g.call(o) && o.toJSON === c.prototype.toJSON ? o = j(o) : "function" == typeof o.toJSON && (o = o.toJSON(e))), r && (o = r.call(t, e, o)), o == f) return o === f ? o : "null";
|
|
197
|
+
switch ("object" == (l = typeof o) && (d = g.call(o)), d || l) {
|
|
198
|
+
case "boolean":
|
|
199
|
+
case "[object Boolean]": return "" + o;
|
|
200
|
+
case "number":
|
|
201
|
+
case "[object Number]": return o > -1 / 0 && o < 1 / 0 ? "" + o : "null";
|
|
202
|
+
case "string":
|
|
203
|
+
case "[object String]": return N("" + o);
|
|
204
|
+
}
|
|
205
|
+
if ("object" == typeof o) {
|
|
206
|
+
for (v = s.length; v--;) if (s[v] === o) throw u();
|
|
207
|
+
if (s.push(o), p = [], y = n, n += i, "[object Array]" == d) {
|
|
208
|
+
for (h = 0, v = o.length; h < v; h++) _ = C(h, o, r, a, i, n, s), p.push(_ === f ? "null" : _);
|
|
209
|
+
S = p.length ? i ? "[\n" + n + p.join(",\n" + n) + "\n" + y + "]" : "[" + p.join(",") + "]" : "[]";
|
|
210
|
+
} else w(a || o, function(e) {
|
|
211
|
+
var t = C(e, o, r, a, i, n, s);
|
|
212
|
+
t !== f && p.push(N(e) + ":" + (i ? " " : "") + t);
|
|
213
|
+
}), S = p.length ? i ? "{\n" + n + p.join(",\n" + n) + "\n" + y + "}" : "{" + p.join(",") + "}" : "{}";
|
|
214
|
+
return s.pop(), S;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
a.stringify = function(t, r, a) {
|
|
218
|
+
var i, n, s, o;
|
|
219
|
+
if (e[typeof r] && r) {
|
|
220
|
+
if ("[object Function]" == (o = g.call(r))) n = r;
|
|
221
|
+
else if ("[object Array]" == o) {
|
|
222
|
+
s = {};
|
|
223
|
+
for (var c, l = 0, u = r.length; l < u;) c = r[l++], "[object String]" != (o = g.call(c)) && "[object Number]" != o || (s[c] = 1);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (a) if ("[object Number]" == (o = g.call(a))) {
|
|
227
|
+
if ((a -= a % 1) > 0) for (a > 10 && (a = 10), i = ""; i.length < a;) i += " ";
|
|
228
|
+
} else "[object String]" == o && (i = a.length <= 10 ? a : a.slice(0, 10));
|
|
229
|
+
return C("", ((c = {})[""] = t, c), n, s, i, "", []);
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (!y("json-parse")) {
|
|
234
|
+
var x, $, I = n.fromCharCode, R = {
|
|
235
|
+
92: "\\",
|
|
236
|
+
34: "\"",
|
|
237
|
+
47: "/",
|
|
238
|
+
98: "\b",
|
|
239
|
+
116: " ",
|
|
240
|
+
110: "\n",
|
|
241
|
+
102: "\f",
|
|
242
|
+
114: "\r"
|
|
243
|
+
}, U = function() {
|
|
244
|
+
throw x = $ = null, l();
|
|
245
|
+
}, T = function() {
|
|
246
|
+
for (var e, t, r, a, i, n = $, s = n.length; x < s;) switch (i = n.charCodeAt(x)) {
|
|
247
|
+
case 9:
|
|
248
|
+
case 10:
|
|
249
|
+
case 13:
|
|
250
|
+
case 32:
|
|
251
|
+
x++;
|
|
252
|
+
break;
|
|
253
|
+
case 123:
|
|
254
|
+
case 125:
|
|
255
|
+
case 91:
|
|
256
|
+
case 93:
|
|
257
|
+
case 58:
|
|
258
|
+
case 44: return e = S ? n.charAt(x) : n[x], x++, e;
|
|
259
|
+
case 34:
|
|
260
|
+
for (e = "@", x++; x < s;) if ((i = n.charCodeAt(x)) < 32) U();
|
|
261
|
+
else if (92 == i) switch (i = n.charCodeAt(++x)) {
|
|
262
|
+
case 92:
|
|
263
|
+
case 34:
|
|
264
|
+
case 47:
|
|
265
|
+
case 98:
|
|
266
|
+
case 116:
|
|
267
|
+
case 110:
|
|
268
|
+
case 102:
|
|
269
|
+
case 114:
|
|
270
|
+
e += R[i], x++;
|
|
271
|
+
break;
|
|
272
|
+
case 117:
|
|
273
|
+
for (t = ++x, r = x + 4; x < r; x++) (i = n.charCodeAt(x)) >= 48 && i <= 57 || i >= 97 && i <= 102 || i >= 65 && i <= 70 || U();
|
|
274
|
+
e += I("0x" + n.slice(t, x));
|
|
275
|
+
break;
|
|
276
|
+
default: U();
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
if (34 == i) break;
|
|
280
|
+
for (i = n.charCodeAt(x), t = x; i >= 32 && 92 != i && 34 != i;) i = n.charCodeAt(++x);
|
|
281
|
+
e += n.slice(t, x);
|
|
282
|
+
}
|
|
283
|
+
if (34 == n.charCodeAt(x)) return x++, e;
|
|
284
|
+
U();
|
|
285
|
+
default:
|
|
286
|
+
if (t = x, 45 == i && (a = !0, i = n.charCodeAt(++x)), i >= 48 && i <= 57) {
|
|
287
|
+
for (48 == i && (i = n.charCodeAt(x + 1)) >= 48 && i <= 57 && U(), a = !1; x < s && (i = n.charCodeAt(x)) >= 48 && i <= 57; x++);
|
|
288
|
+
if (46 == n.charCodeAt(x)) {
|
|
289
|
+
for (r = ++x; r < s && !((i = n.charCodeAt(r)) < 48 || i > 57); r++);
|
|
290
|
+
r == x && U(), x = r;
|
|
291
|
+
}
|
|
292
|
+
if (101 == (i = n.charCodeAt(x)) || 69 == i) {
|
|
293
|
+
for (43 != (i = n.charCodeAt(++x)) && 45 != i || x++, r = x; r < s && !((i = n.charCodeAt(r)) < 48 || i > 57); r++);
|
|
294
|
+
r == x && U(), x = r;
|
|
295
|
+
}
|
|
296
|
+
return +n.slice(t, x);
|
|
297
|
+
}
|
|
298
|
+
a && U();
|
|
299
|
+
var o = n.slice(x, x + 4);
|
|
300
|
+
if ("true" == o) return x += 4, !0;
|
|
301
|
+
if ("fals" == o && 101 == n.charCodeAt(x + 4)) return x += 5, !1;
|
|
302
|
+
if ("null" == o) return x += 4, null;
|
|
303
|
+
U();
|
|
304
|
+
}
|
|
305
|
+
return "$";
|
|
306
|
+
}, E = function(e) {
|
|
307
|
+
var t, r;
|
|
308
|
+
if ("$" == e && U(), "string" == typeof e) {
|
|
309
|
+
if ("@" == (S ? e.charAt(0) : e[0])) return e.slice(1);
|
|
310
|
+
if ("[" == e) {
|
|
311
|
+
for (t = []; "]" != (e = T());) r ? "," == e ? "]" == (e = T()) && U() : U() : r = !0, "," == e && U(), t.push(E(e));
|
|
312
|
+
return t;
|
|
313
|
+
}
|
|
314
|
+
if ("{" == e) {
|
|
315
|
+
for (t = {}; "}" != (e = T());) r ? "," == e ? "}" == (e = T()) && U() : U() : r = !0, "," != e && "string" == typeof e && "@" == (S ? e.charAt(0) : e[0]) && ":" == T() || U(), t[e.slice(1)] = E(T());
|
|
316
|
+
return t;
|
|
317
|
+
}
|
|
318
|
+
U();
|
|
319
|
+
}
|
|
320
|
+
return e;
|
|
321
|
+
}, L = function(e, t, r) {
|
|
322
|
+
var a = J(e, t, r);
|
|
323
|
+
a === f ? delete e[t] : e[t] = a;
|
|
324
|
+
}, J = function(e, t, r) {
|
|
325
|
+
var a, i = e[t];
|
|
326
|
+
if ("object" == typeof i && i) if ("[object Array]" == g.call(i)) for (a = i.length; a--;) L(g, w, i);
|
|
327
|
+
else w(i, function(e) {
|
|
328
|
+
L(i, e, r);
|
|
329
|
+
});
|
|
330
|
+
return r.call(e, t, i);
|
|
331
|
+
};
|
|
332
|
+
a.parse = function(e, t) {
|
|
333
|
+
var r, a;
|
|
334
|
+
return x = 0, $ = "" + e, r = E(T()), "$" != T() && U(), x = $ = null, t && "[object Function]" == g.call(t) ? J(((a = {})[""] = r, a), "", t) : r;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return a.runInContext = s, a;
|
|
339
|
+
}(t, t.JSON3 = { noConflict: function() {
|
|
340
|
+
return i || (i = !0, t.JSON = r, t.JSON3 = a, r = a = null), n;
|
|
341
|
+
} });
|
|
342
|
+
t.JSON = {
|
|
343
|
+
parse: n.parse,
|
|
344
|
+
stringify: n.stringify
|
|
345
|
+
};
|
|
346
|
+
}).call(this), function(t) {
|
|
347
|
+
if (t.atob) try {
|
|
348
|
+
t.atob(" ");
|
|
349
|
+
} catch (s) {
|
|
350
|
+
t.atob = (r = t.atob, (a = function(e) {
|
|
351
|
+
return r(String(e).replace(/[\t\n\f\r ]+/g, ""));
|
|
352
|
+
}).original = r, a);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
var r, a, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", n = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
356
|
+
t.btoa = function(t) {
|
|
357
|
+
t = String(t);
|
|
358
|
+
for (var r, a, n, s, o = "", c = 0, l = t.length % 3; c < t.length;) ((a = t.charCodeAt(c++)) > 255 || (n = t.charCodeAt(c++)) > 255 || (s = t.charCodeAt(c++)) > 255) && e.log("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range."), o += i.charAt((r = a << 16 | n << 8 | s) >> 18 & 63) + i.charAt(r >> 12 & 63) + i.charAt(r >> 6 & 63) + i.charAt(63 & r);
|
|
359
|
+
return l ? o.slice(0, l - 3) + "===".substring(l) : o;
|
|
360
|
+
}, t.atob = function(t) {
|
|
361
|
+
t = String(t).replace(/[\t\n\f\r ]+/g, ""), n.test(t) || e.log("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."), t += "==".slice(2 - (3 & t.length));
|
|
362
|
+
for (var r, a, s, o = "", c = 0; c < t.length;) r = i.indexOf(t.charAt(c++)) << 18 | i.indexOf(t.charAt(c++)) << 12 | (a = i.indexOf(t.charAt(c++))) << 6 | (s = i.indexOf(t.charAt(c++))), o += 64 === a ? String.fromCharCode(r >> 16 & 255) : 64 === s ? String.fromCharCode(r >> 16 & 255, r >> 8 & 255) : String.fromCharCode(r >> 16 & 255, r >> 8 & 255, 255 & r);
|
|
363
|
+
return o;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}(window), String.prototype.replaceAll || (String.prototype.replaceAll = function(e, t) {
|
|
367
|
+
return "[object regexp]" === Object.prototype.toString.call(e).toLowerCase() ? this.replace(e, t) : this.replace(new RegExp(e, "g"), t);
|
|
368
|
+
}), g = Array.prototype, h = Function.prototype, v = Object.prototype, y = g.slice, S = v.toString, w = v.hasOwnProperty, h.bind, b = g.forEach, g.indexOf, k = Array.isArray, j = {}, P = t.each = function(e, r, a) {
|
|
369
|
+
if (null == e) return !1;
|
|
370
|
+
if (b && e.forEach === b) e.forEach(r, a);
|
|
371
|
+
else if (t.isArray(e) && e.length === +e.length) {
|
|
372
|
+
for (var i = 0, n = e.length; i < n; i++) if (i in e && r.call(a, e[i], i, e) === j) return !1;
|
|
373
|
+
} else for (var s in e) if (w.call(e, s) && r.call(a, e[s], s, e) === j) return !1;
|
|
374
|
+
}, t.map = function(e, t) {
|
|
375
|
+
var r = [];
|
|
376
|
+
return null == e ? r : Array.prototype.map && e.map === Array.prototype.map ? e.map(t) : (P(e, function(e, a, i) {
|
|
377
|
+
r.push(t(e, a, i));
|
|
378
|
+
}), r);
|
|
379
|
+
}, t.extend = function(e) {
|
|
380
|
+
return P(y.call(arguments, 1), function(t) {
|
|
381
|
+
for (var r in t) w.call(t, r) && void 0 !== t[r] && (e[r] = t[r]);
|
|
382
|
+
}), e;
|
|
383
|
+
}, t.extend2Lev = function(e) {
|
|
384
|
+
return P(y.call(arguments, 1), function(r) {
|
|
385
|
+
for (var a in r) void 0 !== r[a] && (t.isObject(r[a]) && t.isObject(e[a]) ? t.extend(e[a], r[a]) : e[a] = r[a]);
|
|
386
|
+
}), e;
|
|
387
|
+
}, t.coverExtend = function(e) {
|
|
388
|
+
return P(y.call(arguments, 1), function(t) {
|
|
389
|
+
for (var r in t) void 0 !== t[r] && void 0 === e[r] && (e[r] = t[r]);
|
|
390
|
+
}), e;
|
|
391
|
+
}, t.isArray = k || function(e) {
|
|
392
|
+
return "[object Array]" === S.call(e);
|
|
393
|
+
}, t.isFunction = function(e) {
|
|
394
|
+
if (!e) return !1;
|
|
395
|
+
try {
|
|
396
|
+
return /^\s*\bfunction\b/.test(e);
|
|
397
|
+
} catch (t) {
|
|
398
|
+
return !1;
|
|
399
|
+
}
|
|
400
|
+
}, t.isArguments = function(e) {
|
|
401
|
+
return !(!e || !w.call(e, "callee"));
|
|
402
|
+
}, t.toArray = function(e) {
|
|
403
|
+
return e ? e.toArray ? e.toArray() : t.isArray(e) ? y.call(e) : t.isArguments(e) ? y.call(e) : t.values(e) : [];
|
|
404
|
+
}, t.values = function(e) {
|
|
405
|
+
var t = [];
|
|
406
|
+
return null == e ? t : (P(e, function(e) {
|
|
407
|
+
t[t.length] = e;
|
|
408
|
+
}), t);
|
|
409
|
+
}, t.indexOf = function(e, t) {
|
|
410
|
+
var r = e.indexOf;
|
|
411
|
+
if (r) return r.call(e, t);
|
|
412
|
+
for (var a = 0; a < e.length; a++) if (t === e[a]) return a;
|
|
413
|
+
return -1;
|
|
414
|
+
}, t.hasAttributes = function(e, r) {
|
|
415
|
+
if ("string" == typeof r) return t.hasAttribute(e, r);
|
|
416
|
+
if (t.isArray(r)) {
|
|
417
|
+
for (var a = !1, i = 0; i < r.length; i++) if (t.hasAttribute(e, r[i])) {
|
|
418
|
+
a = !0;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
return a;
|
|
422
|
+
}
|
|
423
|
+
}, t.hasAttribute = function(e, t) {
|
|
424
|
+
return e.hasAttribute ? e.hasAttribute(t) : !(!e.attributes[t] || !e.attributes[t].specified);
|
|
425
|
+
}, t.filter = function(e, t, r) {
|
|
426
|
+
var a = Object.prototype.hasOwnProperty;
|
|
427
|
+
if (e.filter) return e.filter(t);
|
|
428
|
+
for (var i = [], n = 0; n < e.length; n++) if (a.call(e, n)) {
|
|
429
|
+
var s = e[n];
|
|
430
|
+
t.call(r, s, n, e) && i.push(s);
|
|
431
|
+
}
|
|
432
|
+
return i;
|
|
433
|
+
}, t.inherit = function(e, t) {
|
|
434
|
+
return e.prototype = new t(), e.prototype.constructor = e, e.superclass = t.prototype, e;
|
|
435
|
+
}, t.trim = function(e) {
|
|
436
|
+
return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
437
|
+
}, t.isObject = function(e) {
|
|
438
|
+
return null != e && "[object Object]" == S.call(e);
|
|
439
|
+
}, t.isEmptyObject = function(e) {
|
|
440
|
+
if (t.isObject(e)) {
|
|
441
|
+
for (var r in e) if (w.call(e, r)) return !1;
|
|
442
|
+
return !0;
|
|
443
|
+
}
|
|
444
|
+
return !1;
|
|
445
|
+
}, t.isUndefined = function(e) {
|
|
446
|
+
return void 0 === e;
|
|
447
|
+
}, t.isString = function(e) {
|
|
448
|
+
return "[object String]" == S.call(e);
|
|
449
|
+
}, t.isDate = function(e) {
|
|
450
|
+
return "[object Date]" == S.call(e);
|
|
451
|
+
}, t.isBoolean = function(e) {
|
|
452
|
+
return "[object Boolean]" == S.call(e);
|
|
453
|
+
}, t.isNumber = function(e) {
|
|
454
|
+
return "[object Number]" == S.call(e) && /[\d\.]+/.test(String(e));
|
|
455
|
+
}, t.isElement = function(e) {
|
|
456
|
+
return !(!e || 1 !== e.nodeType);
|
|
457
|
+
}, t.isJSONString = function(e) {
|
|
458
|
+
try {
|
|
459
|
+
JSON.parse(e);
|
|
460
|
+
} catch (t) {
|
|
461
|
+
return !1;
|
|
462
|
+
}
|
|
463
|
+
return !0;
|
|
464
|
+
}, t.safeJSONParse = function(e) {
|
|
465
|
+
var t = null;
|
|
466
|
+
try {
|
|
467
|
+
t = JSON.parse(e);
|
|
468
|
+
} catch (r) {
|
|
469
|
+
return !1;
|
|
470
|
+
}
|
|
471
|
+
return t;
|
|
472
|
+
}, t.decodeURIComponent = function(e) {
|
|
473
|
+
var t = e;
|
|
474
|
+
try {
|
|
475
|
+
t = decodeURIComponent(e);
|
|
476
|
+
} catch (r) {
|
|
477
|
+
t = e;
|
|
478
|
+
}
|
|
479
|
+
return t;
|
|
480
|
+
}, t.decodeURI = function(e) {
|
|
481
|
+
var t = e;
|
|
482
|
+
try {
|
|
483
|
+
t = decodeURI(e);
|
|
484
|
+
} catch (r) {
|
|
485
|
+
t = e;
|
|
486
|
+
}
|
|
487
|
+
return t;
|
|
488
|
+
}, t.isDecodeURI = function(e, r) {
|
|
489
|
+
return e ? t.decodeURI(r) : r;
|
|
490
|
+
}, t.encodeDates = function(e) {
|
|
491
|
+
return t.each(e, function(r, a) {
|
|
492
|
+
t.isDate(r) ? e[a] = t.formatDate(r) : t.isObject(r) && (e[a] = t.encodeDates(r));
|
|
493
|
+
}), e;
|
|
494
|
+
}, t.mediaQueriesSupported = function() {
|
|
495
|
+
return "undefined" != typeof window.matchMedia || "undefined" != typeof window.msMatchMedia;
|
|
496
|
+
}, t.getScreenOrientation = function() {
|
|
497
|
+
var e = screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type, r = "未取到值";
|
|
498
|
+
if (e) r = e.indexOf("landscape") > -1 ? "landscape" : "portrait";
|
|
499
|
+
else if (t.mediaQueriesSupported()) {
|
|
500
|
+
var a = window.matchMedia || window.msMatchMedia;
|
|
501
|
+
a("(orientation: landscape)").matches ? r = "landscape" : a("(orientation: portrait)").matches && (r = "portrait");
|
|
502
|
+
}
|
|
503
|
+
return r;
|
|
504
|
+
}, t.now = Date.now || function() {
|
|
505
|
+
return (/* @__PURE__ */ new Date()).getTime();
|
|
506
|
+
}, t.throttle = function(e, r, a) {
|
|
507
|
+
var i, n, s, o = null, c = 0;
|
|
508
|
+
a || (a = {});
|
|
509
|
+
var l = function() {
|
|
510
|
+
c = !1 === a.leading ? 0 : t.now(), o = null, s = e.apply(i, n), o || (i = n = null);
|
|
511
|
+
};
|
|
512
|
+
return function() {
|
|
513
|
+
var u = t.now();
|
|
514
|
+
c || !1 !== a.leading || (c = u);
|
|
515
|
+
var d = r - (u - c);
|
|
516
|
+
return i = this, n = arguments, d <= 0 || d > r ? (o && (clearTimeout(o), o = null), c = u, s = e.apply(i, n), o || (i = n = null)) : o || !1 === a.trailing || (o = setTimeout(l, d)), s;
|
|
517
|
+
};
|
|
518
|
+
}, t.hashCode = function(e) {
|
|
519
|
+
if ("string" != typeof e) return 0;
|
|
520
|
+
var t = 0;
|
|
521
|
+
if (0 == e.length) return t;
|
|
522
|
+
for (var r = 0; r < e.length; r++) t = (t << 5) - t + e.charCodeAt(r), t &= t;
|
|
523
|
+
return t;
|
|
524
|
+
}, t.formatDate = function(e) {
|
|
525
|
+
function t(e) {
|
|
526
|
+
return e < 10 ? "0" + e : e;
|
|
527
|
+
}
|
|
528
|
+
return e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + " " + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + "." + t(e.getMilliseconds());
|
|
529
|
+
}, t.getRandomBasic = (d = (/* @__PURE__ */ new Date()).getTime(), function(e) {
|
|
530
|
+
return Math.ceil((d = (9301 * d + 49297) % 233280) / 233280 * e);
|
|
531
|
+
}), t.getRandom = function() {
|
|
532
|
+
if ("function" == typeof Uint32Array) {
|
|
533
|
+
var e = "";
|
|
534
|
+
if ("undefined" != typeof crypto ? e = crypto : "undefined" != typeof msCrypto && (e = msCrypto), t.isObject(e) && e.getRandomValues) {
|
|
535
|
+
var r = /* @__PURE__ */ new Uint32Array(1);
|
|
536
|
+
return e.getRandomValues(r)[0] / Math.pow(2, 32);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return t.getRandomBasic(0x8ac7230489e80000) / 0x8ac7230489e80000;
|
|
540
|
+
}, t.searchObjDate = function(e) {
|
|
541
|
+
t.isObject(e) && t.each(e, function(r, a) {
|
|
542
|
+
t.isObject(r) ? t.searchObjDate(e[a]) : t.isDate(r) && (e[a] = t.formatDate(r));
|
|
543
|
+
});
|
|
544
|
+
}, t.searchZZAppStyle = function(e) {
|
|
545
|
+
"undefined" != typeof e.properties.$project && (e.project = e.properties.$project, delete e.properties.$project), "undefined" != typeof e.properties.$token && (e.token = e.properties.$token, delete e.properties.$token);
|
|
546
|
+
}, t.formatJsonString = function(e) {
|
|
547
|
+
try {
|
|
548
|
+
return JSON.stringify(e, null, " ");
|
|
549
|
+
} catch (t) {
|
|
550
|
+
return JSON.stringify(e);
|
|
551
|
+
}
|
|
552
|
+
}, t.formatString = function(r, a) {
|
|
553
|
+
return t.isNumber(a) && r.length > a ? (e.log("字符串长度超过限制,已经做截取--" + r), r.slice(0, a)) : r;
|
|
554
|
+
}, t.searchObjString = function(r) {
|
|
555
|
+
t.isObject(r) && t.each(r, function(a, i) {
|
|
556
|
+
t.isObject(a) ? t.searchObjString(r[i]) : t.isString(a) && (r[i] = t.formatString(a, "$element_selector" === i ? 1024 : e.para.max_string_length));
|
|
557
|
+
});
|
|
558
|
+
}, t.parseSuperProperties = function(r) {
|
|
559
|
+
var a = r.properties, i = JSON.parse(JSON.stringify(r));
|
|
560
|
+
t.isObject(a) && (t.each(a, function(r, n) {
|
|
561
|
+
if (t.isFunction(r)) try {
|
|
562
|
+
a[n] = r(i), t.isFunction(a[n]) && (e.log("您的属性- " + n + " 格式不满足要求,我们已经将其删除"), delete a[n]);
|
|
563
|
+
} catch (s) {
|
|
564
|
+
delete a[n], e.log("您的属性- " + n + " 抛出了异常,我们已经将其删除");
|
|
565
|
+
}
|
|
566
|
+
}), t.strip_sa_properties(a));
|
|
567
|
+
}, t.filterReservedProperties = function(r) {
|
|
568
|
+
t.isObject(r) && t.each([
|
|
569
|
+
"distinct_id",
|
|
570
|
+
"user_id",
|
|
571
|
+
"id",
|
|
572
|
+
"date",
|
|
573
|
+
"datetime",
|
|
574
|
+
"event",
|
|
575
|
+
"events",
|
|
576
|
+
"first_id",
|
|
577
|
+
"original_id",
|
|
578
|
+
"device_id",
|
|
579
|
+
"properties",
|
|
580
|
+
"second_id",
|
|
581
|
+
"time",
|
|
582
|
+
"users"
|
|
583
|
+
], function(t, a) {
|
|
584
|
+
t in r && (a < 3 ? (delete r[t], e.log("您的属性- " + t + "是保留字段,我们已经将其删除")) : e.log("您的属性- " + t + "是保留字段,请避免其作为属性名"));
|
|
585
|
+
});
|
|
586
|
+
}, t.searchConfigData = function(e) {
|
|
587
|
+
if ("object" == typeof e && e.$option) {
|
|
588
|
+
var t = e.$option;
|
|
589
|
+
return delete e.$option, t;
|
|
590
|
+
}
|
|
591
|
+
return {};
|
|
592
|
+
}, t.unique = function(e) {
|
|
593
|
+
for (var t, r = [], a = {}, i = 0; i < e.length; i++) (t = e[i]) in a || (a[t] = !0, r.push(t));
|
|
594
|
+
return r;
|
|
595
|
+
}, t.strip_sa_properties = function(r) {
|
|
596
|
+
return t.isObject(r) ? (t.each(r, function(a, i) {
|
|
597
|
+
if (t.isArray(a)) {
|
|
598
|
+
var n = [];
|
|
599
|
+
t.each(a, function(r) {
|
|
600
|
+
t.isString(r) ? n.push(r) : e.log("您的数据-", i, a, "的数组里的值必须是字符串,已经将其删除");
|
|
601
|
+
}), r[i] = n;
|
|
602
|
+
}
|
|
603
|
+
t.isString(a) || t.isNumber(a) || t.isDate(a) || t.isBoolean(a) || t.isArray(a) || t.isFunction(a) || "$option" === i || (e.log("您的数据-", i, a, "-格式不满足要求,我们已经将其删除"), delete r[i]);
|
|
604
|
+
}), r) : r;
|
|
605
|
+
}, t.strip_empty_properties = function(e) {
|
|
606
|
+
var r = {};
|
|
607
|
+
return t.each(e, function(e, t) {
|
|
608
|
+
null != e && (r[t] = e);
|
|
609
|
+
}), r;
|
|
610
|
+
}, t.base64Encode = function(e) {
|
|
611
|
+
return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(e, t) {
|
|
612
|
+
return String.fromCharCode("0x" + t);
|
|
613
|
+
}));
|
|
614
|
+
}, t.base64Decode = function(e) {
|
|
615
|
+
var r = t.map(atob(e).split(""), function(e) {
|
|
616
|
+
return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
|
|
617
|
+
});
|
|
618
|
+
return decodeURIComponent(r.join(""));
|
|
619
|
+
}, t.UUID = (p = function() {
|
|
620
|
+
for (var e = 1 * /* @__PURE__ */ new Date(), t = 0; e == 1 * /* @__PURE__ */ new Date();) t++;
|
|
621
|
+
return e.toString(16) + t.toString(16);
|
|
622
|
+
}, function() {
|
|
623
|
+
var e = String(screen.height * screen.width);
|
|
624
|
+
e = e && /\d{5,}/.test(e) ? e.toString(16) : String(31242 * t.getRandom()).replace(".", "").slice(0, 8);
|
|
625
|
+
return p() + "-" + t.getRandom().toString(16).replace(".", "") + "-" + function(e) {
|
|
626
|
+
var t, r, a = navigator.userAgent, i = [], n = 0;
|
|
627
|
+
function s(e, t) {
|
|
628
|
+
var r, a = 0;
|
|
629
|
+
for (r = 0; r < t.length; r++) a |= i[r] << 8 * r;
|
|
630
|
+
return e ^ a;
|
|
631
|
+
}
|
|
632
|
+
for (t = 0; t < a.length; t++) r = a.charCodeAt(t), i.unshift(255 & r), i.length >= 4 && (n = s(n, i), i = []);
|
|
633
|
+
return i.length > 0 && (n = s(n, i)), n.toString(16);
|
|
634
|
+
}() + "-" + e + "-" + p() || (String(t.getRandom()) + String(t.getRandom()) + String(t.getRandom())).slice(2, 15);
|
|
635
|
+
}), t.getQueryParam = function(e, r) {
|
|
636
|
+
r = r.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"), e = t.decodeURIComponent(e);
|
|
637
|
+
var a = new RegExp("[\\?&]" + r + "=([^&#]*)").exec(e);
|
|
638
|
+
return null === a || a && "string" != typeof a[1] && a[1].length ? "" : t.decodeURIComponent(a[1]);
|
|
639
|
+
}, t.urlParse = function(t) {
|
|
640
|
+
var r = function(e) {
|
|
641
|
+
this._fields = {
|
|
642
|
+
Username: 4,
|
|
643
|
+
Password: 5,
|
|
644
|
+
Port: 7,
|
|
645
|
+
Protocol: 2,
|
|
646
|
+
Host: 6,
|
|
647
|
+
Path: 8,
|
|
648
|
+
URL: 0,
|
|
649
|
+
QueryString: 9,
|
|
650
|
+
Fragment: 10
|
|
651
|
+
}, this._values = {}, this._regex = null, this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/, void 0 !== e && this._parse(e);
|
|
652
|
+
};
|
|
653
|
+
return r.prototype.setUrl = function(e) {
|
|
654
|
+
this._parse(e);
|
|
655
|
+
}, r.prototype._initValues = function() {
|
|
656
|
+
for (var e in this._fields) this._values[e] = "";
|
|
657
|
+
}, r.prototype.addQueryString = function(e) {
|
|
658
|
+
if ("object" != typeof e) return !1;
|
|
659
|
+
var t = this._values.QueryString || "";
|
|
660
|
+
for (var r in e) t = new RegExp(r + "[^&]+").test(t) ? t.replace(new RegExp(r + "[^&]+"), r + "=" + e[r]) : "&" === t.slice(-1) ? t + r + "=" + e[r] : "" === t ? r + "=" + e[r] : t + "&" + r + "=" + e[r];
|
|
661
|
+
this._values.QueryString = t;
|
|
662
|
+
}, r.prototype.getUrl = function() {
|
|
663
|
+
var e = "";
|
|
664
|
+
return e += this._values.Origin, e += this._values.Port ? ":" + this._values.Port : "", e += this._values.Path, e += this._values.QueryString ? "?" + this._values.QueryString : "", e += this._values.Fragment ? "#" + this._values.Fragment : "";
|
|
665
|
+
}, r.prototype.getUrl = function() {
|
|
666
|
+
var e = "";
|
|
667
|
+
return e += this._values.Origin, e += this._values.Port ? ":" + this._values.Port : "", e += this._values.Path, e += this._values.QueryString ? "?" + this._values.QueryString : "";
|
|
668
|
+
}, r.prototype._parse = function(t) {
|
|
669
|
+
this._initValues();
|
|
670
|
+
var r = this._regex.exec(t);
|
|
671
|
+
for (var a in r || e.log("DPURLParser::_parse -> Invalid URL"), this._fields) "undefined" != typeof r[this._fields[a]] && (this._values[a] = r[this._fields[a]]);
|
|
672
|
+
this._values.Hostname = this._values.Host.replace(/:\d+$/, ""), this._values.Origin = this._values.Protocol + "://" + this._values.Hostname;
|
|
673
|
+
}, new r(t);
|
|
674
|
+
}, t.addEvent = function() {
|
|
675
|
+
function r(e) {
|
|
676
|
+
return e && (e.preventDefault = r.preventDefault, e.stopPropagation = r.stopPropagation, e._getPath = r._getPath), e;
|
|
677
|
+
}
|
|
678
|
+
r._getPath = function() {
|
|
679
|
+
var e = this;
|
|
680
|
+
return this.path || this.composedPath && this.composedPath() || function() {
|
|
681
|
+
try {
|
|
682
|
+
var t = e.target, r = [t];
|
|
683
|
+
if (null === t || null === t.parentElement) return [];
|
|
684
|
+
for (; null !== t.parentElement;) t = t.parentElement, r.unshift(t);
|
|
685
|
+
return r;
|
|
686
|
+
} catch (a) {
|
|
687
|
+
return [];
|
|
688
|
+
}
|
|
689
|
+
}();
|
|
690
|
+
}, r.preventDefault = function() {
|
|
691
|
+
this.returnValue = !1;
|
|
692
|
+
}, r.stopPropagation = function() {
|
|
693
|
+
this.cancelBubble = !0;
|
|
694
|
+
}, function(a, i, n) {
|
|
695
|
+
var s = !(!t.isObject(e.para.heatmap) || !e.para.heatmap.useCapture);
|
|
696
|
+
if (t.isObject(e.para.heatmap) && "undefined" == typeof e.para.heatmap.useCapture && "click" === i && (s = !0), a && a.addEventListener) a.addEventListener(i, function(e) {
|
|
697
|
+
e._getPath = r._getPath, n.call(this, e);
|
|
698
|
+
}, s);
|
|
699
|
+
else {
|
|
700
|
+
var o = "on" + i;
|
|
701
|
+
a[o] = function(e, t, a) {
|
|
702
|
+
return function(i) {
|
|
703
|
+
if (!(i = i || r(window.event))) return void 0;
|
|
704
|
+
i.target = i.srcElement;
|
|
705
|
+
var n, s, o = !0;
|
|
706
|
+
return "function" == typeof a && (n = a(i)), s = t.call(e, i), !1 !== n && !1 !== s || (o = !1), o;
|
|
707
|
+
};
|
|
708
|
+
}(a, n, a[o]);
|
|
709
|
+
}
|
|
710
|
+
}.apply(null, arguments);
|
|
711
|
+
}, t.addHashEvent = function(e) {
|
|
712
|
+
var r = "pushState" in window.history ? "popstate" : "hashchange";
|
|
713
|
+
t.addEvent(window, r, e);
|
|
714
|
+
}, t.addSinglePageEvent = function(e) {
|
|
715
|
+
var r = location.href, a = window.history.pushState, i = window.history.replaceState;
|
|
716
|
+
window.history.pushState = function() {
|
|
717
|
+
a.apply(window.history, arguments), e(r), r = location.href;
|
|
718
|
+
}, window.history.replaceState = function() {
|
|
719
|
+
i.apply(window.history, arguments), e(r), r = location.href;
|
|
720
|
+
};
|
|
721
|
+
var n = a ? "popstate" : "hashchange";
|
|
722
|
+
t.addEvent(window, n, function() {
|
|
723
|
+
e(r), r = location.href;
|
|
724
|
+
});
|
|
725
|
+
}, t.cookie = {
|
|
726
|
+
get: function(e) {
|
|
727
|
+
for (var r = e + "=", a = document.cookie.split(";"), i = 0; i < a.length; i++) {
|
|
728
|
+
for (var n = a[i]; " " == n.charAt(0);) n = n.substring(1, n.length);
|
|
729
|
+
if (0 == n.indexOf(r)) return t.decodeURIComponent(n.substring(r.length, n.length));
|
|
730
|
+
}
|
|
731
|
+
return null;
|
|
732
|
+
},
|
|
733
|
+
set: function(r, a, i, n) {
|
|
734
|
+
var s = "", o = "", c = "";
|
|
735
|
+
if (i = null == i ? 73e3 : i, n = void 0 === n ? e.para.cross_subdomain : n) {
|
|
736
|
+
var l = t.getCurrentDomain(location.href);
|
|
737
|
+
"url解析失败" === l && (l = ""), s = l ? "; domain=" + l : "";
|
|
738
|
+
}
|
|
739
|
+
if (0 !== i) {
|
|
740
|
+
var u = /* @__PURE__ */ new Date();
|
|
741
|
+
"s" === String(i).slice(-1) ? u.setTime(u.getTime() + 1e3 * Number(String(i).slice(0, -1))) : u.setTime(u.getTime() + 24 * i * 60 * 60 * 1e3), o = "; expires=" + u.toGMTString();
|
|
742
|
+
}
|
|
743
|
+
function d(e) {
|
|
744
|
+
return !!e && e.replaceAll(/\r\n/g, "");
|
|
745
|
+
}
|
|
746
|
+
e.para.is_secure_cookie && (c = "; secure");
|
|
747
|
+
var p = "", f = "", _ = "";
|
|
748
|
+
r && (p = d(r)), a && (f = d(a)), s && (_ = d(s)), p && f && (document.cookie = p + "=" + encodeURIComponent(f) + o + "; path=/" + _ + c);
|
|
749
|
+
},
|
|
750
|
+
encrypt: function(e) {
|
|
751
|
+
return "data:enc;" + t.rot13obfs(e);
|
|
752
|
+
},
|
|
753
|
+
decrypt: function(e) {
|
|
754
|
+
return e = e.substring(9), e = t.rot13defs(e);
|
|
755
|
+
},
|
|
756
|
+
resolveValue: function(e) {
|
|
757
|
+
return t.isString(e) && 0 === e.indexOf("data:enc;") && (e = t.cookie.decrypt(e)), e;
|
|
758
|
+
},
|
|
759
|
+
remove: function(r, a) {
|
|
760
|
+
a = void 0 === a ? e.para.cross_subdomain : a, t.cookie.set(r, "", -1, a);
|
|
761
|
+
},
|
|
762
|
+
getCookieName: function(r, a) {
|
|
763
|
+
var i = "";
|
|
764
|
+
if (a = a || location.href, !1 === e.para.cross_subdomain) {
|
|
765
|
+
try {
|
|
766
|
+
i = t.URL(a).hostname;
|
|
767
|
+
} catch (n) {
|
|
768
|
+
e.log(n);
|
|
769
|
+
}
|
|
770
|
+
i = "string" == typeof i && "" !== i ? "sajssdk_2015_" + r + "_" + i.replace(/\./g, "_") : "sajssdk_2015_root_" + r;
|
|
771
|
+
} else i = "sajssdk_2015_cross_" + r;
|
|
772
|
+
return i;
|
|
773
|
+
},
|
|
774
|
+
getNewUser: function() {
|
|
775
|
+
return null !== this.get("sensorsdata_is_new_user") || null !== this.get(this.getCookieName("new_user"));
|
|
776
|
+
}
|
|
777
|
+
}, t.getElementContent = function(r, a) {
|
|
778
|
+
var i = "", n = "";
|
|
779
|
+
return r.textContent ? i = t.trim(r.textContent) : r.innerText && (i = t.trim(r.innerText)), i && (i = i.replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255)), n = i || "", "input" !== a && "INPUT" !== a || ("button" === r.type || "submit" === r.type ? n = r.value || "" : e.para.heatmap && "function" == typeof e.para.heatmap.collect_input && e.para.heatmap.collect_input(r) && (n = r.value || "")), n;
|
|
780
|
+
}, t.getEleInfo = function(r) {
|
|
781
|
+
if (!r.target) return !1;
|
|
782
|
+
var a = r.target, i = a.tagName.toLowerCase(), n = {};
|
|
783
|
+
return n.$element_type = i, n.$element_name = a.getAttribute("name"), n.$element_id = a.getAttribute("id"), n.$element_class_name = "string" == typeof a.className ? a.className : null, n.$element_target_url = a.getAttribute("href"), n.$element_content = t.getElementContent(a, i), (n = t.strip_empty_properties(n)).$url = t.isDecodeURI(e.para.url_is_decode, location.href), n.$url_path = location.pathname, n.$title = document.title, n.$viewport_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0, n;
|
|
784
|
+
}, t.localStorage = {
|
|
785
|
+
get: function(e) {
|
|
786
|
+
return window.localStorage.getItem(e);
|
|
787
|
+
},
|
|
788
|
+
parse: function(r) {
|
|
789
|
+
var a;
|
|
790
|
+
try {
|
|
791
|
+
a = JSON.parse(t.localStorage.get(r)) || null;
|
|
792
|
+
} catch (i) {
|
|
793
|
+
e.log(i);
|
|
794
|
+
}
|
|
795
|
+
return a;
|
|
796
|
+
},
|
|
797
|
+
set: function(e, t) {
|
|
798
|
+
window.localStorage.setItem(e, t);
|
|
799
|
+
},
|
|
800
|
+
remove: function(e) {
|
|
801
|
+
window.localStorage.removeItem(e);
|
|
802
|
+
},
|
|
803
|
+
isSupport: function() {
|
|
804
|
+
var e = !0;
|
|
805
|
+
try {
|
|
806
|
+
var r = "__sensorsdatasupport__", a = "testIsSupportStorage";
|
|
807
|
+
t.localStorage.set(r, a), t.localStorage.get(r) !== a && (e = !1), t.localStorage.remove(r);
|
|
808
|
+
} catch (i) {
|
|
809
|
+
e = !1;
|
|
810
|
+
}
|
|
811
|
+
return e;
|
|
812
|
+
}
|
|
813
|
+
}, t.sessionStorage = { isSupport: function() {
|
|
814
|
+
var e = !0, t = "testIsSupportStorage";
|
|
815
|
+
try {
|
|
816
|
+
sessionStorage && sessionStorage.setItem ? (sessionStorage.setItem("__sensorsdatasupport__", t), sessionStorage.removeItem("__sensorsdatasupport__", t), e = !0) : e = !1;
|
|
817
|
+
} catch (r) {
|
|
818
|
+
e = !1;
|
|
819
|
+
}
|
|
820
|
+
return e;
|
|
821
|
+
} }, t.isSupportCors = function() {
|
|
822
|
+
return "undefined" != typeof window.XMLHttpRequest && ("withCredentials" in new XMLHttpRequest() || "undefined" != typeof XDomainRequest);
|
|
823
|
+
}, t.xhr = function(t) {
|
|
824
|
+
if (t) return "undefined" != typeof window.XMLHttpRequest && "withCredentials" in new XMLHttpRequest() ? new XMLHttpRequest() : "undefined" != typeof XDomainRequest ? new XDomainRequest() : null;
|
|
825
|
+
if ("undefined" != typeof window.XMLHttpRequest) return new XMLHttpRequest();
|
|
826
|
+
if (window.ActiveXObject) try {
|
|
827
|
+
return new ActiveXObject("Msxml2.XMLHTTP");
|
|
828
|
+
} catch (r) {
|
|
829
|
+
try {
|
|
830
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
831
|
+
} catch (r) {
|
|
832
|
+
e.log(r);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}, t.ajax = function(r) {
|
|
836
|
+
function a(e) {
|
|
837
|
+
if (!e) return "";
|
|
838
|
+
try {
|
|
839
|
+
return JSON.parse(e);
|
|
840
|
+
} catch (t) {
|
|
841
|
+
return {};
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
r.timeout = r.timeout || 2e4, r.credentials = "undefined" == typeof r.credentials || r.credentials;
|
|
845
|
+
var i = t.xhr(r.cors);
|
|
846
|
+
if (!i) return !1;
|
|
847
|
+
r.type || (r.type = r.data ? "POST" : "GET"), r = t.extend({
|
|
848
|
+
success: function() {},
|
|
849
|
+
error: function() {}
|
|
850
|
+
}, r), e.debug.protocol.ajax(r.url);
|
|
851
|
+
var n, s = r.success, o = r.error;
|
|
852
|
+
r.success = function(e) {
|
|
853
|
+
s(e), n && (clearTimeout(n), n = null);
|
|
854
|
+
}, r.error = function(e) {
|
|
855
|
+
o(e), n && (clearTimeout(n), n = null);
|
|
856
|
+
}, n = setTimeout(function() {
|
|
857
|
+
(function() {
|
|
858
|
+
try {
|
|
859
|
+
t.isObject(i) && i.abort && i.abort();
|
|
860
|
+
} catch (a) {
|
|
861
|
+
e.log(a);
|
|
862
|
+
}
|
|
863
|
+
n && (clearTimeout(n), n = null, r.error && r.error(), i.onreadystatechange = null, i.onload = null, i.onerror = null);
|
|
864
|
+
})();
|
|
865
|
+
}, r.timeout), "undefined" != typeof XDomainRequest && i instanceof XDomainRequest && (i.onload = function() {
|
|
866
|
+
r.success && r.success(a(i.responseText)), i.onreadystatechange = null, i.onload = null, i.onerror = null;
|
|
867
|
+
}, i.onerror = function() {
|
|
868
|
+
r.error && r.error(a(i.responseText), i.status), i.onreadystatechange = null, i.onerror = null, i.onload = null;
|
|
869
|
+
}), i.onreadystatechange = function() {
|
|
870
|
+
try {
|
|
871
|
+
4 == i.readyState && (i.status >= 200 && i.status < 300 || 304 == i.status ? r.success(a(i.responseText)) : r.error(a(i.responseText), i.status), i.onreadystatechange = null, i.onload = null);
|
|
872
|
+
} catch (e) {
|
|
873
|
+
i.onreadystatechange = null, i.onload = null;
|
|
874
|
+
}
|
|
875
|
+
}, i.open(r.type, r.url, !0);
|
|
876
|
+
try {
|
|
877
|
+
r.credentials && (i.withCredentials = !0), t.isObject(r.header) && t.each(r.header, function(e, t) {
|
|
878
|
+
i.setRequestHeader && i.setRequestHeader(t, e);
|
|
879
|
+
}), r.data && (r.cors || i.setRequestHeader && i.setRequestHeader("X-Requested-With", "XMLHttpRequest"), "application/json" === r.contentType ? i.setRequestHeader && i.setRequestHeader("Content-type", "application/json; charset=UTF-8") : i.setRequestHeader && i.setRequestHeader("Content-type", "application/x-www-form-urlencoded"));
|
|
880
|
+
} catch (c) {
|
|
881
|
+
e.log(c);
|
|
882
|
+
}
|
|
883
|
+
i.send(r.data || null);
|
|
884
|
+
}, t.loadScript = function(e) {
|
|
885
|
+
e = t.extend({
|
|
886
|
+
success: function() {},
|
|
887
|
+
error: function() {},
|
|
888
|
+
appendCall: function(e) {
|
|
889
|
+
document.getElementsByTagName("head")[0].appendChild(e);
|
|
890
|
+
}
|
|
891
|
+
}, e);
|
|
892
|
+
var r = null;
|
|
893
|
+
"css" === e.type && ((r = document.createElement("link")).rel = "stylesheet", r.href = e.url), "js" === e.type && ((r = document.createElement("script")).async = "async", r.setAttribute("charset", "UTF-8"), r.src = e.url, r.type = "text/javascript"), r.onload = r.onreadystatechange = function() {
|
|
894
|
+
this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState || (e.success(), r.onload = r.onreadystatechange = null);
|
|
895
|
+
}, r.onerror = function() {
|
|
896
|
+
e.error(), r.onerror = null;
|
|
897
|
+
}, e.appendCall(r);
|
|
898
|
+
}, t.getHostname = function(r, a) {
|
|
899
|
+
a && "string" == typeof a || (a = "hostname解析异常");
|
|
900
|
+
var i = null;
|
|
901
|
+
try {
|
|
902
|
+
i = t.URL(r).hostname;
|
|
903
|
+
} catch (n) {
|
|
904
|
+
e.log("getHostname传入的url参数不合法!");
|
|
905
|
+
}
|
|
906
|
+
return i || a;
|
|
907
|
+
}, t.getQueryParamsFromUrl = function(e) {
|
|
908
|
+
var r = {}, a = e.split("?")[1] || "";
|
|
909
|
+
return a && (r = t.getURLSearchParams("?" + a)), r;
|
|
910
|
+
}, t.getURLSearchParams = function(e) {
|
|
911
|
+
for (var t = function(e) {
|
|
912
|
+
return decodeURIComponent(e);
|
|
913
|
+
}, r = {}, a = (e = e || "").substring(1).split("&"), i = 0; i < a.length; i++) {
|
|
914
|
+
var n = a[i].indexOf("=");
|
|
915
|
+
if (-1 !== n) {
|
|
916
|
+
var s = a[i].substring(0, n), o = a[i].substring(n + 1);
|
|
917
|
+
s = t(s), o = t(o), r[s] = o;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return r;
|
|
921
|
+
}, t.URL = function(r) {
|
|
922
|
+
var a, i = {};
|
|
923
|
+
if ("function" == typeof window.URL && function() {
|
|
924
|
+
try {
|
|
925
|
+
return "http://modernizr.com/" === new URL("http://modernizr.com/").href;
|
|
926
|
+
} catch (e) {
|
|
927
|
+
return !1;
|
|
928
|
+
}
|
|
929
|
+
}()) (i = new URL(r)).searchParams || (i.searchParams = (a = t.getURLSearchParams(i.search), { get: function(e) {
|
|
930
|
+
return a[e];
|
|
931
|
+
} }));
|
|
932
|
+
else {
|
|
933
|
+
!1 === /^https?:\/\/.+/.test(r) && e.log("Invalid URL");
|
|
934
|
+
var n = t.urlParse(r);
|
|
935
|
+
i.hash = "", i.host = n._values.Host ? n._values.Host + (n._values.Port ? ":" + n._values.Port : "") : "", i.href = n._values.URL, i.password = n._values.Password, i.pathname = n._values.Path, i.port = n._values.Port, i.search = n._values.QueryString ? "?" + n._values.QueryString : "", i.username = n._values.Username, i.hostname = n._values.Hostname, i.protocol = n._values.Protocol ? n._values.Protocol + ":" : "", i.origin = n._values.Origin ? n._values.Origin + (n._values.Port ? ":" + n._values.Port : "") : "", i.searchParams = function() {
|
|
936
|
+
var e = t.getURLSearchParams("?" + n._values.QueryString);
|
|
937
|
+
return { get: function(t) {
|
|
938
|
+
return e[t];
|
|
939
|
+
} };
|
|
940
|
+
}();
|
|
941
|
+
}
|
|
942
|
+
return i;
|
|
943
|
+
}, t.getCurrentDomain = function(r) {
|
|
944
|
+
var a = e.para.current_domain;
|
|
945
|
+
switch (typeof a) {
|
|
946
|
+
case "function":
|
|
947
|
+
var i = a();
|
|
948
|
+
return "" === i || "" === t.trim(i) ? "url解析失败" : -1 !== i.indexOf(".") ? i : "url解析失败";
|
|
949
|
+
case "string": return "" === a || "" === t.trim(a) ? "url解析失败" : -1 !== a.indexOf(".") ? a : "url解析失败";
|
|
950
|
+
default:
|
|
951
|
+
var n = t.getCookieTopLevelDomain();
|
|
952
|
+
return "" === r ? "url解析失败" : "" === n ? "url解析失败" : n;
|
|
953
|
+
}
|
|
954
|
+
}, t.getCookieTopLevelDomain = function(e) {
|
|
955
|
+
var r = (e = e || location.hostname) || !1;
|
|
956
|
+
if (!r) return "";
|
|
957
|
+
var a = r.split(".");
|
|
958
|
+
if (t.isArray(a) && a.length >= 2 && !/^(\d+\.)+\d+$/.test(r)) {
|
|
959
|
+
for (var i = "." + a.splice(a.length - 1, 1); a.length > 0;) if (i = "." + a.splice(a.length - 1, 1) + i, document.cookie = "sensorsdata_domain_test=true; path=/; domain=" + i, -1 !== document.cookie.indexOf("sensorsdata_domain_test=true")) {
|
|
960
|
+
var n = /* @__PURE__ */ new Date();
|
|
961
|
+
return n.setTime(n.getTime() - 1e3), document.cookie = "sensorsdata_domain_test=true; expires=" + n.toGMTString() + "; path=/; domain=" + i, i;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
return "";
|
|
965
|
+
}, t.isReferralTraffic = function(e) {
|
|
966
|
+
return "" === (e = e || document.referrer) || t.getCookieTopLevelDomain(t.getHostname(e)) !== t.getCookieTopLevelDomain();
|
|
967
|
+
}, t.ry = function(e) {
|
|
968
|
+
return new t.ry.init(e);
|
|
969
|
+
}, t.ry.init = function(e) {
|
|
970
|
+
this.ele = e;
|
|
971
|
+
}, t.ry.init.prototype = {
|
|
972
|
+
addClass: function(e) {
|
|
973
|
+
return -1 === (" " + this.ele.className + " ").indexOf(" " + e + " ") && (this.ele.className = this.ele.className + ("" === this.ele.className ? "" : " ") + e), this;
|
|
974
|
+
},
|
|
975
|
+
removeClass: function(e) {
|
|
976
|
+
var t = " " + this.ele.className + " ";
|
|
977
|
+
return -1 !== t.indexOf(" " + e + " ") && (this.ele.className = t.replace(" " + e + " ", " ").slice(1, -1)), this;
|
|
978
|
+
},
|
|
979
|
+
hasClass: function(e) {
|
|
980
|
+
return -1 !== (" " + this.ele.className + " ").indexOf(" " + e + " ");
|
|
981
|
+
},
|
|
982
|
+
attr: function(e, r) {
|
|
983
|
+
return "string" == typeof e && t.isUndefined(r) ? this.ele.getAttribute(e) : ("string" == typeof e && (r = String(r), this.ele.setAttribute(e, r)), this);
|
|
984
|
+
},
|
|
985
|
+
offset: function() {
|
|
986
|
+
var e = this.ele.getBoundingClientRect();
|
|
987
|
+
if (e.width || e.height) {
|
|
988
|
+
var t = this.ele.ownerDocument.documentElement;
|
|
989
|
+
return {
|
|
990
|
+
top: e.top + window.pageYOffset - t.clientTop,
|
|
991
|
+
left: e.left + window.pageXOffset - t.clientLeft
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
return {
|
|
995
|
+
top: 0,
|
|
996
|
+
left: 0
|
|
997
|
+
};
|
|
998
|
+
},
|
|
999
|
+
getSize: function() {
|
|
1000
|
+
if (!window.getComputedStyle) return {
|
|
1001
|
+
width: this.ele.offsetWidth,
|
|
1002
|
+
height: this.ele.offsetHeight
|
|
1003
|
+
};
|
|
1004
|
+
try {
|
|
1005
|
+
var e = this.ele.getBoundingClientRect();
|
|
1006
|
+
return {
|
|
1007
|
+
width: e.width,
|
|
1008
|
+
height: e.height
|
|
1009
|
+
};
|
|
1010
|
+
} catch (t) {
|
|
1011
|
+
return {
|
|
1012
|
+
width: 0,
|
|
1013
|
+
height: 0
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
getStyle: function(e) {
|
|
1018
|
+
return this.ele.currentStyle ? this.ele.currentStyle[e] : this.ele.ownerDocument.defaultView.getComputedStyle(this.ele, null).getPropertyValue(e);
|
|
1019
|
+
},
|
|
1020
|
+
wrap: function(e) {
|
|
1021
|
+
var r = document.createElement(e);
|
|
1022
|
+
return this.ele.parentNode.insertBefore(r, this.ele), r.appendChild(this.ele), t.ry(r);
|
|
1023
|
+
},
|
|
1024
|
+
getCssStyle: function(e) {
|
|
1025
|
+
var r = this.ele.style.getPropertyValue(e);
|
|
1026
|
+
if (r) return r;
|
|
1027
|
+
var a = null;
|
|
1028
|
+
if ("function" == typeof window.getMatchedCSSRules && (a = getMatchedCSSRules(this.ele)), !a || !t.isArray(a)) return null;
|
|
1029
|
+
for (var i = a.length - 1; i >= 0; i--) if (r = a[i].style.getPropertyValue(e)) return r;
|
|
1030
|
+
},
|
|
1031
|
+
sibling: function(e, t) {
|
|
1032
|
+
for (; (e = e[t]) && 1 !== e.nodeType;);
|
|
1033
|
+
return e;
|
|
1034
|
+
},
|
|
1035
|
+
next: function() {
|
|
1036
|
+
return this.sibling(this.ele, "nextSibling");
|
|
1037
|
+
},
|
|
1038
|
+
prev: function(e) {
|
|
1039
|
+
return this.sibling(this.ele, "previousSibling");
|
|
1040
|
+
},
|
|
1041
|
+
siblings: function(e) {
|
|
1042
|
+
return this.siblings((this.ele.parentNode || {}).firstChild, this.ele);
|
|
1043
|
+
},
|
|
1044
|
+
children: function(e) {
|
|
1045
|
+
return this.siblings(this.ele.firstChild);
|
|
1046
|
+
},
|
|
1047
|
+
parent: function() {
|
|
1048
|
+
var e = this.ele.parentNode;
|
|
1049
|
+
return e = e && 11 !== e.nodeType ? e : null, t.ry(e);
|
|
1050
|
+
},
|
|
1051
|
+
previousElementSibling: function() {
|
|
1052
|
+
var e = this.ele;
|
|
1053
|
+
if ("previousElementSibling" in document.documentElement) return t.ry(e.previousElementSibling);
|
|
1054
|
+
for (; e = e.previousSibling;) if (1 === e.nodeType) return t.ry(e);
|
|
1055
|
+
return t.ry(null);
|
|
1056
|
+
},
|
|
1057
|
+
getSameTypeSiblings: function() {
|
|
1058
|
+
for (var e = this.ele, t = e.parentNode, r = e.tagName.toLowerCase(), a = [], i = 0; i < t.children.length; i++) {
|
|
1059
|
+
var n = t.children[i];
|
|
1060
|
+
1 === n.nodeType && n.tagName.toLowerCase() === r && a.push(t.children[i]);
|
|
1061
|
+
}
|
|
1062
|
+
return a;
|
|
1063
|
+
}
|
|
1064
|
+
}, t.strToUnicode = function(t) {
|
|
1065
|
+
if ("string" != typeof t) return e.log("转换unicode错误", t), t;
|
|
1066
|
+
for (var r = "", a = 0; a < t.length; a++) r += "\\" + t.charCodeAt(a).toString(16);
|
|
1067
|
+
return r;
|
|
1068
|
+
}, t.getReferrer = function(t) {
|
|
1069
|
+
return "string" != typeof (t = t || document.referrer) ? "取值异常_referrer异常_" + String(t) : (0 === t.indexOf("https://www.baidu.com/") && (t = t.split("?")[0]), "string" == typeof (t = t.slice(0, e.para.max_referrer_string_length)) ? t : "");
|
|
1070
|
+
}, t.getKeywordFromReferrer = function(r) {
|
|
1071
|
+
r = r || document.referrer;
|
|
1072
|
+
var a = e.para.source_type.keyword;
|
|
1073
|
+
if (document && "string" == typeof r) {
|
|
1074
|
+
if (0 === r.indexOf("http")) {
|
|
1075
|
+
var i = t.getReferSearchEngine(r), n = t.getQueryParamsFromUrl(r);
|
|
1076
|
+
if (t.isEmptyObject(n)) return "未取到值";
|
|
1077
|
+
var s = null;
|
|
1078
|
+
for (var o in a) if (i === o && "object" == typeof n) {
|
|
1079
|
+
if (s = a[o], t.isArray(s)) for (o = 0; o < s.length; o++) {
|
|
1080
|
+
var c = n[s[o]];
|
|
1081
|
+
if (c) return c;
|
|
1082
|
+
}
|
|
1083
|
+
else if (n[s]) return n[s];
|
|
1084
|
+
}
|
|
1085
|
+
return "未取到值";
|
|
1086
|
+
}
|
|
1087
|
+
return "" === r ? "未取到值_直接打开" : "未取到值_非http的url";
|
|
1088
|
+
}
|
|
1089
|
+
return "取值异常_referrer异常_" + String(r);
|
|
1090
|
+
}, t.getWxAdIdFromUrl = function(e) {
|
|
1091
|
+
var r = t.getQueryParam(e, "gdt_vid"), a = t.getQueryParam(e, "hash_key"), i = t.getQueryParam(e, "callbacks"), n = {
|
|
1092
|
+
click_id: "",
|
|
1093
|
+
hash_key: "",
|
|
1094
|
+
callbacks: ""
|
|
1095
|
+
};
|
|
1096
|
+
return t.isString(r) && r.length && (n.click_id = 16 == r.length || 18 == r.length ? r : "参数解析不合法", t.isString(a) && a.length && (n.hash_key = a), t.isString(i) && i.length && (n.callbacks = i)), n;
|
|
1097
|
+
}, t.getReferSearchEngine = function(r) {
|
|
1098
|
+
var a = t.getHostname(r);
|
|
1099
|
+
if (!a || "hostname解析异常" === a) return "";
|
|
1100
|
+
e.para.source_type.keyword;
|
|
1101
|
+
var i = {
|
|
1102
|
+
baidu: [/^.*\.baidu\.com$/],
|
|
1103
|
+
bing: [/^.*\.bing\.com$/],
|
|
1104
|
+
google: [
|
|
1105
|
+
/^www\.google\.com$/,
|
|
1106
|
+
/^www\.google\.com\.[a-z]{2}$/,
|
|
1107
|
+
/^www\.google\.[a-z]{2}$/
|
|
1108
|
+
],
|
|
1109
|
+
sm: [/^m\.sm\.cn$/],
|
|
1110
|
+
so: [/^.+\.so\.com$/],
|
|
1111
|
+
sogou: [/^.*\.sogou\.com$/],
|
|
1112
|
+
yahoo: [/^.*\.yahoo\.com$/]
|
|
1113
|
+
};
|
|
1114
|
+
for (var n in i) for (var s = i[n], o = 0, c = s.length; o < c; o++) if (s[o].test(a)) return n;
|
|
1115
|
+
return "未知搜索引擎";
|
|
1116
|
+
}, t.getSourceFromReferrer = function() {
|
|
1117
|
+
function r(e, t) {
|
|
1118
|
+
for (var r = 0; r < e.length; r++) if (-1 !== t.split("?")[0].indexOf(e[r])) return !0;
|
|
1119
|
+
}
|
|
1120
|
+
var a = "(" + e.para.source_type.utm.join("|") + ")\\=[^&]+", i = e.para.source_type.search, n = e.para.source_type.social, s = document.referrer || "", o = t.info.pageProp.url;
|
|
1121
|
+
if (o) {
|
|
1122
|
+
var c = o.match(new RegExp(a));
|
|
1123
|
+
return c && c[0] ? "付费广告流量" : r(i, s) ? "自然搜索流量" : r(n, s) ? "社交网站流量" : "" === s ? "直接流量" : "引荐流量";
|
|
1124
|
+
}
|
|
1125
|
+
return "获取url异常";
|
|
1126
|
+
}, t.info = {
|
|
1127
|
+
initPage: function() {
|
|
1128
|
+
var r = t.getReferrer(), a = location.href, i = t.getCurrentDomain(a);
|
|
1129
|
+
i || e.debug.jssdkDebug("url_domain异常_" + a + "_" + i), this.pageProp = {
|
|
1130
|
+
referrer: r,
|
|
1131
|
+
referrer_host: r ? t.getHostname(r) : "",
|
|
1132
|
+
url: a,
|
|
1133
|
+
url_host: t.getHostname(a, "url_host取值异常"),
|
|
1134
|
+
url_domain: i
|
|
1135
|
+
};
|
|
1136
|
+
},
|
|
1137
|
+
pageProp: {},
|
|
1138
|
+
campaignParams: function() {
|
|
1139
|
+
var r = e.source_channel_standard.split(" "), a = "", i = {};
|
|
1140
|
+
return t.isArray(e.para.source_channel) && e.para.source_channel.length > 0 && (r = r.concat(e.para.source_channel), r = t.unique(r)), t.each(r, function(e) {
|
|
1141
|
+
(a = t.getQueryParam(location.href, e)).length && (i[e] = a);
|
|
1142
|
+
}), i;
|
|
1143
|
+
},
|
|
1144
|
+
campaignParamsStandard: function(r, a) {
|
|
1145
|
+
r = r || "", a = a || "";
|
|
1146
|
+
var i = t.info.campaignParams(), n = {}, s = {};
|
|
1147
|
+
return t.each(i, function(t, i, o) {
|
|
1148
|
+
-1 !== (" " + e.source_channel_standard + " ").indexOf(" " + i + " ") ? n[r + i] = o[i] : s[a + i] = o[i];
|
|
1149
|
+
}), {
|
|
1150
|
+
$utms: n,
|
|
1151
|
+
otherUtms: s
|
|
1152
|
+
};
|
|
1153
|
+
},
|
|
1154
|
+
properties: function() {
|
|
1155
|
+
return {
|
|
1156
|
+
$timezone_offset: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
1157
|
+
$screen_height: Number(screen.height) || 0,
|
|
1158
|
+
$screen_width: Number(screen.width) || 0,
|
|
1159
|
+
$lib: "js",
|
|
1160
|
+
$lib_version: String(e.lib_version)
|
|
1161
|
+
};
|
|
1162
|
+
},
|
|
1163
|
+
currentProps: {},
|
|
1164
|
+
register: function(e) {
|
|
1165
|
+
t.extend(t.info.currentProps, e);
|
|
1166
|
+
}
|
|
1167
|
+
}, t.autoExeQueue = function() {
|
|
1168
|
+
return {
|
|
1169
|
+
items: [],
|
|
1170
|
+
enqueue: function(e) {
|
|
1171
|
+
this.items.push(e), this.start();
|
|
1172
|
+
},
|
|
1173
|
+
dequeue: function() {
|
|
1174
|
+
return this.items.shift();
|
|
1175
|
+
},
|
|
1176
|
+
getCurrentItem: function() {
|
|
1177
|
+
return this.items[0];
|
|
1178
|
+
},
|
|
1179
|
+
isRun: !1,
|
|
1180
|
+
start: function() {
|
|
1181
|
+
this.items.length > 0 && !this.isRun && (this.isRun = !0, this.getCurrentItem().start());
|
|
1182
|
+
},
|
|
1183
|
+
close: function() {
|
|
1184
|
+
this.dequeue(), this.isRun = !1, this.start();
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
}, t.trackLink = function(r, a, i) {
|
|
1188
|
+
var n = null;
|
|
1189
|
+
if ((r = r || {}).ele && (n = r.ele), r.event && (n = r.target ? r.target : r.event.target), i = i || {}, !n || "object" != typeof n) return !1;
|
|
1190
|
+
if (!n.href || /^javascript/.test(n.href) || n.target || n.download || n.onclick) return e.track(a, i), !1;
|
|
1191
|
+
function s(t) {
|
|
1192
|
+
t.stopPropagation(), t.preventDefault();
|
|
1193
|
+
var r = !1;
|
|
1194
|
+
function s() {
|
|
1195
|
+
r || (r = !0, location.href = n.href);
|
|
1196
|
+
}
|
|
1197
|
+
setTimeout(s, 1e3), e.track(a, i, s);
|
|
1198
|
+
}
|
|
1199
|
+
r.event && s(r.event), r.ele && t.addEvent(r.ele, "click", function(e) {
|
|
1200
|
+
s(e);
|
|
1201
|
+
});
|
|
1202
|
+
}, t.eventEmitter = function() {
|
|
1203
|
+
this._events = [], this.pendingEvents = [];
|
|
1204
|
+
}, t.eventEmitter.prototype = {
|
|
1205
|
+
emit: function(e) {
|
|
1206
|
+
var r = [].slice.call(arguments, 1);
|
|
1207
|
+
t.each(this._events, function(t) {
|
|
1208
|
+
t.type === e && t.callback.apply(t.context, r);
|
|
1209
|
+
});
|
|
1210
|
+
},
|
|
1211
|
+
on: function(e, t, r) {
|
|
1212
|
+
"function" == typeof t && this._events.push({
|
|
1213
|
+
type: e,
|
|
1214
|
+
callback: t,
|
|
1215
|
+
context: r || this
|
|
1216
|
+
});
|
|
1217
|
+
},
|
|
1218
|
+
tempAdd: function(e, t) {
|
|
1219
|
+
t && e && (this.pendingEvents.push({
|
|
1220
|
+
type: e,
|
|
1221
|
+
data: t
|
|
1222
|
+
}), this.pendingEvents.length > 20 && this.pendingEvents.shift());
|
|
1223
|
+
},
|
|
1224
|
+
isReady: function() {
|
|
1225
|
+
var e = this;
|
|
1226
|
+
this.tempAdd = this.emit, 0 !== this.pendingEvents.length && (t.each(this.pendingEvents, function(t) {
|
|
1227
|
+
e.emit(t.type, t.data);
|
|
1228
|
+
}), this.pendingEvents = []);
|
|
1229
|
+
}
|
|
1230
|
+
}, t.rot13obfs = function(e, t) {
|
|
1231
|
+
t = "number" == typeof t ? t : 13;
|
|
1232
|
+
for (var r = (e = String(e)).split(""), a = 0, i = r.length; a < i; a++) r[a].charCodeAt(0) < 126 && (r[a] = String.fromCharCode((r[a].charCodeAt(0) + t) % 126));
|
|
1233
|
+
return r.join("");
|
|
1234
|
+
}, t.rot13defs = function(e) {
|
|
1235
|
+
return e = String(e), t.rot13obfs(e, 113);
|
|
1236
|
+
}, t.urlSafeBase64 = (f = {
|
|
1237
|
+
"+": "-",
|
|
1238
|
+
"/": "_",
|
|
1239
|
+
"=": "."
|
|
1240
|
+
}, _ = {
|
|
1241
|
+
"-": "+",
|
|
1242
|
+
_: "/",
|
|
1243
|
+
".": "="
|
|
1244
|
+
}, {
|
|
1245
|
+
encode: function(e) {
|
|
1246
|
+
return e.replace(/[+\/=]/g, function(e) {
|
|
1247
|
+
return f[e];
|
|
1248
|
+
});
|
|
1249
|
+
},
|
|
1250
|
+
decode: function(e) {
|
|
1251
|
+
return e.replace(/[-_.]/g, function(e) {
|
|
1252
|
+
return _[e];
|
|
1253
|
+
});
|
|
1254
|
+
},
|
|
1255
|
+
trim: function(e) {
|
|
1256
|
+
return e.replace(/[.=]{1,2}$/, "");
|
|
1257
|
+
},
|
|
1258
|
+
isBase64: function(e) {
|
|
1259
|
+
return /^[A-Za-z0-9+\/]*[=]{0,2}$/.test(e);
|
|
1260
|
+
},
|
|
1261
|
+
isUrlSafeBase64: function(e) {
|
|
1262
|
+
return /^[A-Za-z0-9_-]*[.]{0,2}$/.test(e);
|
|
1263
|
+
}
|
|
1264
|
+
}), t.setCssStyle = function(e) {
|
|
1265
|
+
var t = document.createElement("style");
|
|
1266
|
+
t.type = "text/css";
|
|
1267
|
+
try {
|
|
1268
|
+
t.appendChild(document.createTextNode(e));
|
|
1269
|
+
} catch (i) {
|
|
1270
|
+
t.styleSheet.cssText = e;
|
|
1271
|
+
}
|
|
1272
|
+
var r = document.getElementsByTagName("head")[0], a = document.getElementsByTagName("script")[0];
|
|
1273
|
+
r ? r.children.length ? r.insertBefore(t, r.children[0]) : r.appendChild(t) : a.parentNode.insertBefore(t, a);
|
|
1274
|
+
}, t.isIOS = function() {
|
|
1275
|
+
return !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
|
1276
|
+
}, t.getIOSVersion = function() {
|
|
1277
|
+
try {
|
|
1278
|
+
var e = navigator.appVersion.match(/OS (\d+)[._](\d+)[._]?(\d+)?/);
|
|
1279
|
+
return e && e[1] ? Number.parseInt(e[1], 10) : "";
|
|
1280
|
+
} catch (t) {
|
|
1281
|
+
return "";
|
|
1282
|
+
}
|
|
1283
|
+
}, t.getUA = function() {
|
|
1284
|
+
var e, t = {}, r = navigator.userAgent.toLowerCase();
|
|
1285
|
+
return (e = r.match(/opera.([\d.]+)/)) ? t.opera = Number(e[1].split(".")[0]) : (e = r.match(/msie ([\d.]+)/)) ? t.ie = Number(e[1].split(".")[0]) : (e = r.match(/edge.([\d.]+)/)) ? t.edge = Number(e[1].split(".")[0]) : (e = r.match(/firefox\/([\d.]+)/)) ? t.firefox = Number(e[1].split(".")[0]) : (e = r.match(/chrome\/([\d.]+)/)) ? t.chrome = Number(e[1].split(".")[0]) : (e = r.match(/version\/([\d.]+).*safari/)) && (t.safari = Number(e[1].match(/^\d*.\d*/))), t;
|
|
1286
|
+
}, t.jsonp = function(r) {
|
|
1287
|
+
if (!t.isObject(r) || !t.isString(r.callbackName)) return e.log("JSONP 请求缺少 callbackName"), !1;
|
|
1288
|
+
r.success = t.isFunction(r.success) ? r.success : function() {}, r.error = t.isFunction(r.error) ? r.error : function() {}, r.data = r.data || "";
|
|
1289
|
+
var a = document.createElement("script"), i = document.getElementsByTagName("head")[0], n = null;
|
|
1290
|
+
if (i.appendChild(a), t.isNumber(r.timeout) && (n = setTimeout(function() {
|
|
1291
|
+
r.error("timeout"), window[r.callbackName] = function() {
|
|
1292
|
+
e.log("call jsonp error");
|
|
1293
|
+
}, n = null, i.removeChild(a);
|
|
1294
|
+
}, r.timeout)), window[r.callbackName] = function(t) {
|
|
1295
|
+
r.success(t), window[r.callbackName] = function() {
|
|
1296
|
+
e.log("call jsonp error");
|
|
1297
|
+
}, clearTimeout(n), n = null, i.removeChild(a);
|
|
1298
|
+
}, r.url.indexOf("?") > -1 ? r.url += "&callbackName=" + r.callbackName : r.url += "?callbackName=" + r.callbackName, t.isObject(r.data)) {
|
|
1299
|
+
var s = [];
|
|
1300
|
+
t.each(r.data, function(e, t) {
|
|
1301
|
+
s.push(t + "=" + e);
|
|
1302
|
+
}), r.data = s.join("&"), r.url += "&" + r.data;
|
|
1303
|
+
}
|
|
1304
|
+
a.onerror = function(t) {
|
|
1305
|
+
window[r.callbackName] = function() {
|
|
1306
|
+
e.log("call jsonp error");
|
|
1307
|
+
}, clearTimeout(n), n = null, i.removeChild(a), r.error(t);
|
|
1308
|
+
}, a.src = r.url;
|
|
1309
|
+
}, t.isSupportBeaconSend = function() {
|
|
1310
|
+
var e = t.getUA(), r = !1, a = navigator.userAgent.toLowerCase();
|
|
1311
|
+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
|
|
1312
|
+
var i = (a.match(/os [\d._]*/gi) + "").replace(/[^0-9|_.]/gi, "").replace(/_/gi, ".").split(".");
|
|
1313
|
+
"undefined" == typeof e.safari && (e.safari = i[0]), i[0] && i[0] < 13 ? (e.chrome > 41 || e.firefox > 30 || e.opera > 25 || e.safari > 12) && (r = !0) : (e.chrome > 41 || e.firefox > 30 || e.opera > 25 || e.safari > 11.3) && (r = !0);
|
|
1314
|
+
} else (e.chrome > 38 || e.edge > 13 || e.firefox > 30 || e.opera > 25 || e.safari > 11) && (r = !0);
|
|
1315
|
+
return r;
|
|
1316
|
+
}, t.secCheck = {
|
|
1317
|
+
isHttpUrl: function(t) {
|
|
1318
|
+
return "string" == typeof t && (!1 !== /^https?:\/\/.+/.test(t) || (e.log("Invalid URL"), !1));
|
|
1319
|
+
},
|
|
1320
|
+
removeScriptProtocol: function(e) {
|
|
1321
|
+
if ("string" != typeof e) return "";
|
|
1322
|
+
for (var t = /^\s*javascript/i; t.test(e);) e = e.replace(t, "");
|
|
1323
|
+
return e;
|
|
1324
|
+
}
|
|
1325
|
+
}, e.para_default = {
|
|
1326
|
+
preset_properties: {
|
|
1327
|
+
latest_utm: !0,
|
|
1328
|
+
latest_traffic_source_type: !0,
|
|
1329
|
+
latest_search_keyword: !0,
|
|
1330
|
+
latest_referrer: !0,
|
|
1331
|
+
latest_referrer_host: !1,
|
|
1332
|
+
latest_landing_page: !1,
|
|
1333
|
+
latest_wx_ad_click_id: void 0,
|
|
1334
|
+
url: !0,
|
|
1335
|
+
title: !0
|
|
1336
|
+
},
|
|
1337
|
+
encrypt_cookie: !1,
|
|
1338
|
+
img_use_crossorigin: !1,
|
|
1339
|
+
name: "sa",
|
|
1340
|
+
max_referrer_string_length: 200,
|
|
1341
|
+
max_string_length: 500,
|
|
1342
|
+
cross_subdomain: !0,
|
|
1343
|
+
show_log: !0,
|
|
1344
|
+
is_debug: !1,
|
|
1345
|
+
debug_mode: !1,
|
|
1346
|
+
debug_mode_upload: !1,
|
|
1347
|
+
session_time: 0,
|
|
1348
|
+
use_client_time: !1,
|
|
1349
|
+
source_channel: [],
|
|
1350
|
+
send_type: "image",
|
|
1351
|
+
vtrack_ignore: {},
|
|
1352
|
+
auto_init: !0,
|
|
1353
|
+
is_track_single_page: !1,
|
|
1354
|
+
is_single_page: !1,
|
|
1355
|
+
batch_send: !1,
|
|
1356
|
+
source_type: {},
|
|
1357
|
+
callback_timeout: 200,
|
|
1358
|
+
datasend_timeout: 3e3,
|
|
1359
|
+
queue_timeout: 300,
|
|
1360
|
+
is_track_device_id: !1,
|
|
1361
|
+
ignore_oom: !0,
|
|
1362
|
+
app_js_bridge: !1,
|
|
1363
|
+
url_is_decode: !1
|
|
1364
|
+
}, e.addReferrerHost = function(r) {
|
|
1365
|
+
t.isObject(r.properties) && (r.properties.$first_referrer && (r.properties.$first_referrer_host = t.getHostname(r.properties.$first_referrer, "取值异常")), "track" !== r.type && "track_signup" !== r.type || ("$referrer" in r.properties && (r.properties.$referrer_host = "" === r.properties.$referrer ? "" : t.getHostname(r.properties.$referrer, "取值异常")), e.para.preset_properties.latest_referrer && e.para.preset_properties.latest_referrer_host && (r.properties.$latest_referrer_host = "" === r.properties.$latest_referrer ? "" : t.getHostname(r.properties.$latest_referrer, "取值异常"))));
|
|
1366
|
+
}, e.addPropsHook = function(r) {
|
|
1367
|
+
e.para.preset_properties && e.para.preset_properties.url && ("track" === r.type || "track_signup" === r.type) && "undefined" == typeof r.properties.$url && (r.properties.$url = t.isDecodeURI(e.para.url_is_decode, window.location.href)), e.para.preset_properties && e.para.preset_properties.title && ("track" === r.type || "track_signup" === r.type) && "undefined" == typeof r.properties.$title && (r.properties.$title = document.title);
|
|
1368
|
+
}, e.initPara = function(r) {
|
|
1369
|
+
e.para = r || e.para || {};
|
|
1370
|
+
var a, i = {};
|
|
1371
|
+
if (t.isObject(e.para.is_track_latest)) for (var n in e.para.is_track_latest) i["latest_" + n] = e.para.is_track_latest[n];
|
|
1372
|
+
for (a in e.para.preset_properties = t.extend({}, e.para_default.preset_properties, i, e.para.preset_properties || {}), e.para_default) void 0 === e.para[a] && (e.para[a] = e.para_default[a]);
|
|
1373
|
+
"string" == typeof e.para.server_url && (e.para.server_url = t.trim(e.para.server_url), e.para.server_url && ("://" === e.para.server_url.slice(0, 3) ? e.para.server_url = location.protocol.slice(0, -1) + e.para.server_url : "//" === e.para.server_url.slice(0, 2) ? e.para.server_url = location.protocol + e.para.server_url : "http" !== e.para.server_url.slice(0, 4) && (e.para.server_url = ""))), "string" != typeof e.para.web_url || "://" !== e.para.web_url.slice(0, 3) && "//" !== e.para.web_url.slice(0, 2) || ("://" === e.para.web_url.slice(0, 3) ? e.para.web_url = location.protocol.slice(0, -1) + e.para.web_url : e.para.web_url = location.protocol + e.para.web_url), "image" !== e.para.send_type && "ajax" !== e.para.send_type && "beacon" !== e.para.send_type && (e.para.send_type = "image"), e.debug.protocol.serverUrl(), e.bridge.initPara(), e.bridge.initState();
|
|
1374
|
+
var s = {
|
|
1375
|
+
datasend_timeout: 6e3,
|
|
1376
|
+
send_interval: 6e3
|
|
1377
|
+
};
|
|
1378
|
+
t.localStorage.isSupport() && t.isSupportCors() && "object" == typeof localStorage ? !0 === e.para.batch_send ? (e.para.batch_send = t.extend({}, s), e.para.use_client_time = !0) : "object" == typeof e.para.batch_send && (e.para.use_client_time = !0, e.para.batch_send = t.extend({}, s, e.para.batch_send)) : e.para.batch_send = !1;
|
|
1379
|
+
var o = [
|
|
1380
|
+
"utm_source",
|
|
1381
|
+
"utm_medium",
|
|
1382
|
+
"utm_campaign",
|
|
1383
|
+
"utm_content",
|
|
1384
|
+
"utm_term"
|
|
1385
|
+
], c = [
|
|
1386
|
+
"www.baidu.",
|
|
1387
|
+
"m.baidu.",
|
|
1388
|
+
"m.sm.cn",
|
|
1389
|
+
"so.com",
|
|
1390
|
+
"sogou.com",
|
|
1391
|
+
"youdao.com",
|
|
1392
|
+
"google.",
|
|
1393
|
+
"yahoo.com/",
|
|
1394
|
+
"bing.com/",
|
|
1395
|
+
"ask.com/"
|
|
1396
|
+
], l = [
|
|
1397
|
+
"weibo.com",
|
|
1398
|
+
"renren.com",
|
|
1399
|
+
"kaixin001.com",
|
|
1400
|
+
"douban.com",
|
|
1401
|
+
"qzone.qq.com",
|
|
1402
|
+
"zhihu.com",
|
|
1403
|
+
"tieba.baidu.com",
|
|
1404
|
+
"weixin.qq.com"
|
|
1405
|
+
], u = {
|
|
1406
|
+
baidu: [
|
|
1407
|
+
"wd",
|
|
1408
|
+
"word",
|
|
1409
|
+
"kw",
|
|
1410
|
+
"keyword"
|
|
1411
|
+
],
|
|
1412
|
+
google: "q",
|
|
1413
|
+
bing: "q",
|
|
1414
|
+
yahoo: "p",
|
|
1415
|
+
sogou: ["query", "keyword"],
|
|
1416
|
+
so: "q",
|
|
1417
|
+
sm: "q"
|
|
1418
|
+
};
|
|
1419
|
+
"object" == typeof e.para.source_type && (e.para.source_type.utm = t.isArray(e.para.source_type.utm) ? e.para.source_type.utm.concat(o) : o, e.para.source_type.search = t.isArray(e.para.source_type.search) ? e.para.source_type.search.concat(c) : c, e.para.source_type.social = t.isArray(e.para.source_type.social) ? e.para.source_type.social.concat(l) : l, e.para.source_type.keyword = t.isObject(e.para.source_type.keyword) ? t.extend(u, e.para.source_type.keyword) : u);
|
|
1420
|
+
var d = [
|
|
1421
|
+
"mark",
|
|
1422
|
+
"/mark",
|
|
1423
|
+
"strong",
|
|
1424
|
+
"b",
|
|
1425
|
+
"em",
|
|
1426
|
+
"i",
|
|
1427
|
+
"u",
|
|
1428
|
+
"abbr",
|
|
1429
|
+
"ins",
|
|
1430
|
+
"del",
|
|
1431
|
+
"s",
|
|
1432
|
+
"sup"
|
|
1433
|
+
];
|
|
1434
|
+
if (t.isObject(e.para.heatmap)) {
|
|
1435
|
+
e.para.heatmap.clickmap = e.para.heatmap.clickmap || "default", e.para.heatmap.scroll_notice_map = e.para.heatmap.scroll_notice_map || "default", e.para.heatmap.scroll_delay_time = e.para.heatmap.scroll_delay_time || 4e3, e.para.heatmap.scroll_event_duration = e.para.heatmap.scroll_event_duration || 18e3, e.para.heatmap.renderRefreshTime = e.para.heatmap.renderRefreshTime || 1e3, e.para.heatmap.loadTimeout = e.para.heatmap.loadTimeout || 1e3;
|
|
1436
|
+
var p = t.isArray(e.para.heatmap.track_attr) ? t.filter(e.para.heatmap.track_attr, function(e) {
|
|
1437
|
+
return e && "string" == typeof e;
|
|
1438
|
+
}) : [];
|
|
1439
|
+
p.push("data-sensors-click"), e.para.heatmap.track_attr = p, t.isObject(e.para.heatmap.collect_tags) ? !0 === e.para.heatmap.collect_tags.div ? e.para.heatmap.collect_tags.div = { ignore_tags: d } : t.isObject(e.para.heatmap.collect_tags.div) ? e.para.heatmap.collect_tags.div.ignore_tags ? t.isArray(e.para.heatmap.collect_tags.div.ignore_tags) || (e.log("ignore_tags 参数必须是数组格式"), e.para.heatmap.collect_tags.div.ignore_tags = d) : e.para.heatmap.collect_tags.div.ignore_tags = d : e.para.heatmap.collect_tags.div = !1 : e.para.heatmap.collect_tags = { div: !1 };
|
|
1440
|
+
}
|
|
1441
|
+
if (t.isArray(e.para.server_url) && e.para.server_url.length) for (a = 0; a < e.para.server_url.length; a++) /sa\.gif[^\/]*$/.test(e.para.server_url[a]) || (e.para.server_url[a] = e.para.server_url[a].replace(/\/sa$/, "/sa.gif").replace(/(\/sa)(\?[^\/]+)$/, "/sa.gif$2"));
|
|
1442
|
+
else /sa\.gif[^\/]*$/.test(e.para.server_url) || "string" != typeof e.para.server_url || (e.para.server_url = e.para.server_url.replace(/\/sa$/, "/sa.gif").replace(/(\/sa)(\?[^\/]+)$/, "/sa.gif$2"));
|
|
1443
|
+
"string" == typeof e.para.server_url && (e.para.debug_mode_url = e.para.debug_mode_url || e.para.server_url.replace("sa.gif", "debug")), !0 === e.para.noCache ? e.para.noCache = "?" + (/* @__PURE__ */ new Date()).getTime() : e.para.noCache = "", e.para.callback_timeout > e.para.datasend_timeout && (e.para.datasend_timeout = e.para.callback_timeout), e.para.callback_timeout > e.para.queue_timeout && (e.para.queue_timeout = e.para.callback_timeout), e.para.queue_timeout > e.para.datasend_timeout && (e.para.datasend_timeout = e.para.queue_timeout);
|
|
1444
|
+
}, e.readyState = {
|
|
1445
|
+
state: 0,
|
|
1446
|
+
historyState: [],
|
|
1447
|
+
stateType: {
|
|
1448
|
+
1: "1-init未开始",
|
|
1449
|
+
2: "2-init开始",
|
|
1450
|
+
3: "3-store完成"
|
|
1451
|
+
},
|
|
1452
|
+
getState: function() {
|
|
1453
|
+
return this.historyState.join("\n");
|
|
1454
|
+
},
|
|
1455
|
+
setState: function(e) {
|
|
1456
|
+
String(e) in this.stateType && (this.state = e), this.historyState.push(this.stateType[e]);
|
|
1457
|
+
}
|
|
1458
|
+
}, e.setPreConfig = function(t) {
|
|
1459
|
+
e.para = t.para, e._q = t._q;
|
|
1460
|
+
}, e.setInitVar = function() {
|
|
1461
|
+
e._t = e._t || 1 * /* @__PURE__ */ new Date(), e.lib_version = "1.16.16", e.is_first_visitor = !1, e.source_channel_standard = "utm_source utm_medium utm_campaign utm_content utm_term";
|
|
1462
|
+
}, e.log = function() {
|
|
1463
|
+
if ((t.sessionStorage.isSupport() && "true" === sessionStorage.getItem("sensorsdata_jssdk_debug") || e.para.show_log) && (!t.isObject(arguments[0]) || !0 !== e.para.show_log && "string" !== e.para.show_log && !1 !== e.para.show_log || (arguments[0] = t.formatJsonString(arguments[0])), "object" == typeof console && console.log)) try {
|
|
1464
|
+
return console.log.apply(console, arguments);
|
|
1465
|
+
} catch (r) {
|
|
1466
|
+
console.log(arguments[0]);
|
|
1467
|
+
}
|
|
1468
|
+
}, e.enableLocalLog = function() {
|
|
1469
|
+
if (t.sessionStorage.isSupport()) try {
|
|
1470
|
+
sessionStorage.setItem("sensorsdata_jssdk_debug", "true");
|
|
1471
|
+
} catch (r) {
|
|
1472
|
+
e.log("enableLocalLog error: " + r.message);
|
|
1473
|
+
}
|
|
1474
|
+
}, e.disableLocalLog = function() {
|
|
1475
|
+
t.sessionStorage.isSupport() && sessionStorage.removeItem("sensorsdata_jssdk_debug");
|
|
1476
|
+
}, e.debug = {
|
|
1477
|
+
distinct_id: function() {},
|
|
1478
|
+
jssdkDebug: function() {},
|
|
1479
|
+
_sendDebug: function(t) {
|
|
1480
|
+
e.track("_sensorsdata2019_debug", { _jssdk_debug_info: t });
|
|
1481
|
+
},
|
|
1482
|
+
apph5: function(r) {
|
|
1483
|
+
var a = "app_h5打通失败-", i = {
|
|
1484
|
+
1: a + "use_app_track为false",
|
|
1485
|
+
2: a + "Android或者iOS,没有暴露相应方法",
|
|
1486
|
+
3.1: a + "Android校验server_url失败",
|
|
1487
|
+
3.2: a + "iOS校验server_url失败",
|
|
1488
|
+
4.1: a + "H5 校验 iOS server_url 失败",
|
|
1489
|
+
4.2: a + "H5 校验 Android server_url 失败"
|
|
1490
|
+
}, n = r.output, s = r.step, o = r.data || "";
|
|
1491
|
+
"all" !== n && "console" !== n || e.log(i[s]), ("all" === n || "code" === n) && t.isObject(e.para.is_debug) && e.para.is_debug.apph5 && (o.type && "profile" === o.type.slice(0, 7) || (o.properties._jssdk_debug_info = "apph5-" + String(s)));
|
|
1492
|
+
},
|
|
1493
|
+
defineMode: function(e) {
|
|
1494
|
+
var t = {
|
|
1495
|
+
1: {
|
|
1496
|
+
title: "当前页面无法进行可视化全埋点",
|
|
1497
|
+
message: "App SDK 与 Web JS SDK 没有进行打通,请联系贵方技术人员修正 App SDK 的配置,详细信息请查看文档。",
|
|
1498
|
+
link_text: "配置文档",
|
|
1499
|
+
link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
|
|
1500
|
+
},
|
|
1501
|
+
2: {
|
|
1502
|
+
title: "当前页面无法进行可视化全埋点",
|
|
1503
|
+
message: "App SDK 与 Web JS SDK 没有进行打通,请联系贵方技术人员修正 Web JS SDK 的配置,详细信息请查看文档。",
|
|
1504
|
+
link_text: "配置文档",
|
|
1505
|
+
link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
|
|
1506
|
+
},
|
|
1507
|
+
3: {
|
|
1508
|
+
title: "当前页面无法进行可视化全埋点",
|
|
1509
|
+
message: "Web JS SDK 没有开启全埋点配置,请联系贵方工作人员修正 SDK 的配置,详细信息请查看文档。",
|
|
1510
|
+
link_text: "配置文档",
|
|
1511
|
+
link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_web_all-1573964.html"
|
|
1512
|
+
},
|
|
1513
|
+
4: {
|
|
1514
|
+
title: "当前页面无法进行可视化全埋点",
|
|
1515
|
+
message: "Web JS SDK 配置的数据校验地址与 App SDK 配置的数据校验地址不一致,请联系贵方工作人员修正 SDK 的配置,详细信息请查看文档。",
|
|
1516
|
+
link_text: "配置文档",
|
|
1517
|
+
link_url: "https://manual.sensorsdata.cn/sa/latest/tech_sdk_client_link-1573913.html"
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
return !(!e || !t[e]) && t[e];
|
|
1521
|
+
},
|
|
1522
|
+
protocol: {
|
|
1523
|
+
protocolIsSame: function(r, a) {
|
|
1524
|
+
try {
|
|
1525
|
+
if (t.URL(r).protocol !== t.URL(a).protocol) return !1;
|
|
1526
|
+
} catch (i) {
|
|
1527
|
+
return e.log("不支持 _.URL 方法"), !1;
|
|
1528
|
+
}
|
|
1529
|
+
return !0;
|
|
1530
|
+
},
|
|
1531
|
+
serverUrl: function() {
|
|
1532
|
+
t.isString(e.para.server_url) && "" !== e.para.server_url && !this.protocolIsSame(e.para.server_url, location.href) && e.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。\n因为:1、https 下面发送 http 的图片请求会失败。2、http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。");
|
|
1533
|
+
},
|
|
1534
|
+
ajax: function(r) {
|
|
1535
|
+
if (r === e.para.server_url) return !1;
|
|
1536
|
+
t.isString(r) && "" !== r && !this.protocolIsSame(r, location.href) && e.log("SDK 检测到您的数据发送地址和当前页面地址的协议不一致,建议您修改成一致的协议。因为 http 页面使用 https + ajax 方式发数据,在 ie9 及以下会丢失数据。");
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
var r = {
|
|
1541
|
+
setOnlineState: function(r) {
|
|
1542
|
+
if (!0 === r && t.isObject(e.para.jsapp) && "function" == typeof e.para.jsapp.getData) {
|
|
1543
|
+
e.para.jsapp.isOnline = !0;
|
|
1544
|
+
var a = e.para.jsapp.getData();
|
|
1545
|
+
t.isArray(a) && a.length > 0 && t.each(a, function(r) {
|
|
1546
|
+
t.isJSONString(r) && e.sendState.pushSend(JSON.parse(r));
|
|
1547
|
+
});
|
|
1548
|
+
} else e.para.jsapp.isOnline = !1;
|
|
1549
|
+
},
|
|
1550
|
+
autoTrackIsUsed: !1,
|
|
1551
|
+
isReady: function(e) {
|
|
1552
|
+
e();
|
|
1553
|
+
},
|
|
1554
|
+
getUtm: function() {
|
|
1555
|
+
return t.info.campaignParams();
|
|
1556
|
+
},
|
|
1557
|
+
getStayTime: function() {
|
|
1558
|
+
return (/* @__PURE__ */ new Date() - e._t) / 1e3;
|
|
1559
|
+
},
|
|
1560
|
+
setProfileLocal: function(r) {
|
|
1561
|
+
if (!t.localStorage.isSupport()) return e.setProfile(r), !1;
|
|
1562
|
+
if (!t.isObject(r) || t.isEmptyObject(r)) return !1;
|
|
1563
|
+
var a = t.localStorage.parse("sensorsdata_2015_jssdk_profile"), i = !1;
|
|
1564
|
+
if (t.isObject(a) && !t.isEmptyObject(a)) {
|
|
1565
|
+
for (var n in r) !(n in a && a[n] !== r[n]) && n in a || (a[n] = r[n], i = !0);
|
|
1566
|
+
i && (t.localStorage.set("sensorsdata_2015_jssdk_profile", JSON.stringify(a)), e.setProfile(r));
|
|
1567
|
+
} else t.localStorage.set("sensorsdata_2015_jssdk_profile", JSON.stringify(r)), e.setProfile(r);
|
|
1568
|
+
},
|
|
1569
|
+
setInitReferrer: function() {
|
|
1570
|
+
var r = t.getReferrer();
|
|
1571
|
+
e.setOnceProfile({
|
|
1572
|
+
_init_referrer: r,
|
|
1573
|
+
_init_referrer_host: t.info.pageProp.referrer_host
|
|
1574
|
+
});
|
|
1575
|
+
},
|
|
1576
|
+
setSessionReferrer: function() {
|
|
1577
|
+
var e = t.getReferrer();
|
|
1578
|
+
c.setSessionPropsOnce({
|
|
1579
|
+
_session_referrer: e,
|
|
1580
|
+
_session_referrer_host: t.info.pageProp.referrer_host
|
|
1581
|
+
});
|
|
1582
|
+
},
|
|
1583
|
+
setDefaultAttr: function() {
|
|
1584
|
+
t.info.register({
|
|
1585
|
+
_current_url: location.href,
|
|
1586
|
+
_referrer: t.getReferrer(),
|
|
1587
|
+
_referring_host: t.info.pageProp.referrer_host
|
|
1588
|
+
});
|
|
1589
|
+
},
|
|
1590
|
+
trackHeatMap: function(r, a, i) {
|
|
1591
|
+
if ("object" == typeof r && r.tagName) {
|
|
1592
|
+
var n = r.tagName.toLowerCase(), s = r.parentNode.tagName.toLowerCase(), o = e.para.heatmap && e.para.heatmap.track_attr ? e.para.heatmap.track_attr : ["data-sensors-click"];
|
|
1593
|
+
"button" === n || "a" === n || "a" === s || "button" === s || "input" === n || "textarea" === n || t.hasAttributes(r, o) || u.start(null, r, n, a, i);
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
trackAllHeatMap: function(e, t, r) {
|
|
1597
|
+
if ("object" == typeof e && e.tagName) {
|
|
1598
|
+
var a = e.tagName.toLowerCase();
|
|
1599
|
+
u.start(null, e, a, t, r);
|
|
1600
|
+
}
|
|
1601
|
+
},
|
|
1602
|
+
autoTrackSinglePage: function(r, a) {
|
|
1603
|
+
if (this.autoTrackIsUsed) var i = t.info.pageProp.url;
|
|
1604
|
+
else i = t.info.pageProp.referrer;
|
|
1605
|
+
function n() {
|
|
1606
|
+
var r = t.info.campaignParams(), a = {};
|
|
1607
|
+
return t.each(r, function(t, r, i) {
|
|
1608
|
+
-1 !== (" " + e.source_channel_standard + " ").indexOf(" " + r + " ") ? a["$" + r] = i[r] : a[r] = i[r];
|
|
1609
|
+
}), a;
|
|
1610
|
+
}
|
|
1611
|
+
function s(r, a) {
|
|
1612
|
+
e.track("$pageview", t.extend({
|
|
1613
|
+
$referrer: t.isDecodeURI(e.para.url_is_decode, i),
|
|
1614
|
+
$url: t.isDecodeURI(e.para.url_is_decode, location.href),
|
|
1615
|
+
$url_path: location.pathname,
|
|
1616
|
+
$title: document.title
|
|
1617
|
+
}, r, n()), a), i = location.href;
|
|
1618
|
+
}
|
|
1619
|
+
r = t.isObject(r) ? r : {}, r = t.isObject(r) ? r : {}, e.is_first_visitor && !r.not_set_profile && (e.setOnceProfile(t.extend({
|
|
1620
|
+
$first_visit_time: /* @__PURE__ */ new Date(),
|
|
1621
|
+
$first_referrer: t.isDecodeURI(e.para.url_is_decode, t.getReferrer()),
|
|
1622
|
+
$first_browser_language: navigator.language || "取值异常",
|
|
1623
|
+
$first_browser_charset: "string" == typeof document.charset ? document.charset.toUpperCase() : "取值异常",
|
|
1624
|
+
$first_traffic_source_type: t.getSourceFromReferrer(),
|
|
1625
|
+
$first_search_keyword: t.getKeywordFromReferrer()
|
|
1626
|
+
}, n())), e.is_first_visitor = !1), r.not_set_profile && delete r.not_set_profile, s(r, a), this.autoTrackSinglePage = s;
|
|
1627
|
+
},
|
|
1628
|
+
autoTrackWithoutProfile: function(e, r) {
|
|
1629
|
+
e = t.isObject(e) ? e : {}, this.autoTrack(t.extend(e, { not_set_profile: !0 }), r);
|
|
1630
|
+
},
|
|
1631
|
+
autoTrack: function(r, a) {
|
|
1632
|
+
r = t.isObject(r) ? r : {};
|
|
1633
|
+
var i = t.info.campaignParams(), n = {};
|
|
1634
|
+
t.each(i, function(t, r, a) {
|
|
1635
|
+
-1 !== (" " + e.source_channel_standard + " ").indexOf(" " + r + " ") ? n["$" + r] = a[r] : n[r] = a[r];
|
|
1636
|
+
}), e.is_first_visitor && !r.not_set_profile && (e.setOnceProfile(t.extend({
|
|
1637
|
+
$first_visit_time: /* @__PURE__ */ new Date(),
|
|
1638
|
+
$first_referrer: t.isDecodeURI(e.para.url_is_decode, t.getReferrer()),
|
|
1639
|
+
$first_browser_language: navigator.language || "取值异常",
|
|
1640
|
+
$first_browser_charset: "string" == typeof document.charset ? document.charset.toUpperCase() : "取值异常",
|
|
1641
|
+
$first_traffic_source_type: t.getSourceFromReferrer(),
|
|
1642
|
+
$first_search_keyword: t.getKeywordFromReferrer()
|
|
1643
|
+
}, n)), e.is_first_visitor = !1), r.not_set_profile && delete r.not_set_profile;
|
|
1644
|
+
var s = location.href;
|
|
1645
|
+
e.para.is_single_page && t.addHashEvent(function() {
|
|
1646
|
+
var i = t.getReferrer(s);
|
|
1647
|
+
e.track("$pageview", t.extend({
|
|
1648
|
+
$referrer: t.isDecodeURI(e.para.url_is_decode, i),
|
|
1649
|
+
$url: t.isDecodeURI(e.para.url_is_decode, location.href),
|
|
1650
|
+
$url_path: location.pathname,
|
|
1651
|
+
$title: document.title
|
|
1652
|
+
}, n, r), a), s = location.href;
|
|
1653
|
+
}), e.track("$pageview", t.extend({
|
|
1654
|
+
$referrer: t.isDecodeURI(e.para.url_is_decode, t.getReferrer()),
|
|
1655
|
+
$url: t.isDecodeURI(e.para.url_is_decode, location.href),
|
|
1656
|
+
$url_path: location.pathname,
|
|
1657
|
+
$title: document.title
|
|
1658
|
+
}, n, r), a), this.autoTrackIsUsed = !0;
|
|
1659
|
+
},
|
|
1660
|
+
getAnonymousID: function() {
|
|
1661
|
+
return t.isEmptyObject(e.store._state) ? "请先初始化SDK" : e.store._state._first_id || e.store._state.first_id || e.store._state._distinct_id || e.store._state.distinct_id;
|
|
1662
|
+
},
|
|
1663
|
+
setPlugin: function(r) {
|
|
1664
|
+
if (!t.isObject(r)) return !1;
|
|
1665
|
+
t.each(r, function(r, a) {
|
|
1666
|
+
t.isFunction(r) && (t.isObject(window.SensorsDataWebJSSDKPlugin) && window.SensorsDataWebJSSDKPlugin[a] ? r(window.SensorsDataWebJSSDKPlugin[a]) : e.log(a + "没有获取到,请查阅文档,调整" + a + "的引入顺序!"));
|
|
1667
|
+
});
|
|
1668
|
+
},
|
|
1669
|
+
useModulePlugin: function() {
|
|
1670
|
+
e.use.apply(e, arguments);
|
|
1671
|
+
},
|
|
1672
|
+
useAppPlugin: function() {
|
|
1673
|
+
this.setPlugin.apply(this, arguments);
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
function a() {
|
|
1677
|
+
this.sendingData = 0, this.sendingItemKeys = [];
|
|
1678
|
+
}
|
|
1679
|
+
e.quick = function() {
|
|
1680
|
+
var t = Array.prototype.slice.call(arguments), a = t[0], i = t.slice(1);
|
|
1681
|
+
if ("string" == typeof a && r[a]) return r[a].apply(r, i);
|
|
1682
|
+
"function" == typeof a ? a.apply(e, i) : e.log("quick方法中没有这个功能" + t[0]);
|
|
1683
|
+
}, e.use = function(r, a) {
|
|
1684
|
+
return t.isString(r) ? t.isObject(window.SensorsDataWebJSSDKPlugin) && t.isObject(window.SensorsDataWebJSSDKPlugin[r]) && t.isFunction(window.SensorsDataWebJSSDKPlugin[r].init) ? (window.SensorsDataWebJSSDKPlugin[r].init(e, a), window.SensorsDataWebJSSDKPlugin[r]) : t.isObject(e.modules) && t.isObject(e.modules[r]) && t.isFunction(e.modules[r].init) ? (e.modules[r].init(e, a), e.modules[r]) : void e.log(r + "没有获取到,请查阅文档,调整" + r + "的引入顺序!") : (e.log("use插件名称必须是字符串!"), !1);
|
|
1685
|
+
}, e.track = function(e, t, r) {
|
|
1686
|
+
s.check({
|
|
1687
|
+
event: e,
|
|
1688
|
+
properties: t
|
|
1689
|
+
}) && s.send({
|
|
1690
|
+
type: "track",
|
|
1691
|
+
event: e,
|
|
1692
|
+
properties: t
|
|
1693
|
+
}, r);
|
|
1694
|
+
}, e.trackLink = function(e, r, a) {
|
|
1695
|
+
"object" == typeof e && e.tagName ? t.trackLink({ ele: e }, r, a) : "object" == typeof e && e.target && e.event && t.trackLink(e, r, a);
|
|
1696
|
+
}, e.trackLinks = function(r, a, i) {
|
|
1697
|
+
return i = i || {}, !(!r || "object" != typeof r) && !(!r.href || /^javascript/.test(r.href) || r.target) && void t.addEvent(r, "click", function(t) {
|
|
1698
|
+
t.preventDefault();
|
|
1699
|
+
var n = !1;
|
|
1700
|
+
function s() {
|
|
1701
|
+
n || (n = !0, location.href = r.href);
|
|
1702
|
+
}
|
|
1703
|
+
setTimeout(s, 1e3), e.track(a, i, s);
|
|
1704
|
+
});
|
|
1705
|
+
}, e.setProfile = function(e, t) {
|
|
1706
|
+
s.check({ propertiesMust: e }) && s.send({
|
|
1707
|
+
type: "profile_set",
|
|
1708
|
+
properties: e
|
|
1709
|
+
}, t);
|
|
1710
|
+
}, e.setOnceProfile = function(e, t) {
|
|
1711
|
+
s.check({ propertiesMust: e }) && s.send({
|
|
1712
|
+
type: "profile_set_once",
|
|
1713
|
+
properties: e
|
|
1714
|
+
}, t);
|
|
1715
|
+
}, e.appendProfile = function(r, a) {
|
|
1716
|
+
s.check({ propertiesMust: r }) && (t.each(r, function(a, i) {
|
|
1717
|
+
t.isString(a) ? r[i] = [a] : t.isArray(a) ? r[i] = a : (delete r[i], e.log("appendProfile属性的值必须是字符串或者数组"));
|
|
1718
|
+
}), t.isEmptyObject(r) || s.send({
|
|
1719
|
+
type: "profile_append",
|
|
1720
|
+
properties: r
|
|
1721
|
+
}, a));
|
|
1722
|
+
}, e.incrementProfile = function(r, a) {
|
|
1723
|
+
var i = r;
|
|
1724
|
+
t.isString(r) && ((r = {})[i] = 1), s.check({ propertiesMust: r }) && (!function(e) {
|
|
1725
|
+
for (var t in e) if (Object.prototype.hasOwnProperty.call(e, t) && !/-*\d+/.test(String(e[t]))) return !1;
|
|
1726
|
+
return !0;
|
|
1727
|
+
}(r) ? e.log("profile_increment的值只能是数字") : s.send({
|
|
1728
|
+
type: "profile_increment",
|
|
1729
|
+
properties: r
|
|
1730
|
+
}, a));
|
|
1731
|
+
}, e.deleteProfile = function(e) {
|
|
1732
|
+
s.send({ type: "profile_delete" }, e), c.set("distinct_id", t.UUID()), c.set("first_id", "");
|
|
1733
|
+
}, e.unsetProfile = function(r, a) {
|
|
1734
|
+
var i = r, n = {};
|
|
1735
|
+
t.isString(r) && (r = []).push(i), t.isArray(r) ? (t.each(r, function(r) {
|
|
1736
|
+
t.isString(r) ? n[r] = !0 : e.log("profile_unset给的数组里面的值必须时string,已经过滤掉", r);
|
|
1737
|
+
}), s.send({
|
|
1738
|
+
type: "profile_unset",
|
|
1739
|
+
properties: n
|
|
1740
|
+
}, a)) : e.log("profile_unset的参数是数组");
|
|
1741
|
+
}, e.identify = function(r, a) {
|
|
1742
|
+
"number" == typeof r && (r = String(r));
|
|
1743
|
+
var i = c.getFirstId();
|
|
1744
|
+
if (void 0 === r) {
|
|
1745
|
+
var n = t.UUID();
|
|
1746
|
+
i ? c.set("first_id", n) : c.set("distinct_id", n);
|
|
1747
|
+
} else s.check({ distinct_id: r }) ? !0 === a ? i ? c.set("first_id", r) : c.set("distinct_id", r) : i ? c.change("first_id", r) : c.change("distinct_id", r) : e.log("identify的参数必须是字符串");
|
|
1748
|
+
}, e.trackSignup = function(e, t, r, a) {
|
|
1749
|
+
if (s.check({
|
|
1750
|
+
distinct_id: e,
|
|
1751
|
+
event: t,
|
|
1752
|
+
properties: r
|
|
1753
|
+
})) {
|
|
1754
|
+
var i = c.getFirstId() || c.getDistinctId();
|
|
1755
|
+
c.set("distinct_id", e), s.send({
|
|
1756
|
+
original_id: i,
|
|
1757
|
+
distinct_id: e,
|
|
1758
|
+
type: "track_signup",
|
|
1759
|
+
event: t,
|
|
1760
|
+
properties: r
|
|
1761
|
+
}, a);
|
|
1762
|
+
}
|
|
1763
|
+
}, e.registerPage = function(r) {
|
|
1764
|
+
s.check({ properties: r }) ? t.extend(t.info.currentProps, r) : e.log("register输入的参数有误");
|
|
1765
|
+
}, e.clearAllRegister = function(e) {
|
|
1766
|
+
c.clearAllProps(e);
|
|
1767
|
+
}, e.clearPageRegister = function(e) {
|
|
1768
|
+
if (t.isArray(e) && e.length > 0) for (var r = 0; r < e.length; r++) t.isString(e[r]) && e[r] in t.info.currentProps && delete t.info.currentProps[e[r]];
|
|
1769
|
+
else if (!0 === e) for (var r in t.info.currentProps) delete t.info.currentProps[r];
|
|
1770
|
+
}, e.register = function(t) {
|
|
1771
|
+
s.check({ properties: t }) ? c.setProps(t) : e.log("register输入的参数有误");
|
|
1772
|
+
}, e.registerOnce = function(t) {
|
|
1773
|
+
s.check({ properties: t }) ? c.setPropsOnce(t) : e.log("registerOnce输入的参数有误");
|
|
1774
|
+
}, e.registerSession = function(t) {
|
|
1775
|
+
s.check({ properties: t }) ? c.setSessionProps(t) : e.log("registerSession输入的参数有误");
|
|
1776
|
+
}, e.registerSessionOnce = function(t) {
|
|
1777
|
+
s.check({ properties: t }) ? c.setSessionPropsOnce(t) : e.log("registerSessionOnce输入的参数有误");
|
|
1778
|
+
}, e.login = function(t, r) {
|
|
1779
|
+
if ("number" == typeof t && (t = String(t)), s.check({ distinct_id: t })) {
|
|
1780
|
+
var a = c.getFirstId(), i = c.getDistinctId();
|
|
1781
|
+
t !== i ? (a || c.set("first_id", i), e.trackSignup(t, "$SignUp", {}, r)) : r && r();
|
|
1782
|
+
} else e.log("login的参数必须是字符串"), r && r();
|
|
1783
|
+
}, e.logout = function(r) {
|
|
1784
|
+
var a = c.getFirstId();
|
|
1785
|
+
if (a) if (c.set("first_id", ""), !0 === r) {
|
|
1786
|
+
var i = t.UUID();
|
|
1787
|
+
c.set("distinct_id", i);
|
|
1788
|
+
} else c.set("distinct_id", a);
|
|
1789
|
+
else e.log("没有first_id,logout失败");
|
|
1790
|
+
}, e.getPresetProperties = function() {
|
|
1791
|
+
var r, a, i = {
|
|
1792
|
+
$is_first_day: t.cookie.getNewUser(),
|
|
1793
|
+
$referrer: t.isDecodeURI(e.para.url_is_decode, t.info.pageProp.referrer) || "",
|
|
1794
|
+
$referrer_host: t.info.pageProp.referrer ? t.getHostname(t.info.pageProp.referrer) : "",
|
|
1795
|
+
$url: t.isDecodeURI(e.para.url_is_decode, location.href),
|
|
1796
|
+
$url_path: location.pathname,
|
|
1797
|
+
$title: document.title || "",
|
|
1798
|
+
_distinct_id: c.getDistinctId()
|
|
1799
|
+
}, n = t.extend({}, t.info.properties(), e.store.getProps(), (r = t.info.campaignParams(), a = {}, t.each(r, function(t, r, i) {
|
|
1800
|
+
-1 !== (" " + e.source_channel_standard + " ").indexOf(" " + r + " ") ? a["$" + r] = i[r] : a[r] = i[r];
|
|
1801
|
+
}), a), i);
|
|
1802
|
+
return e.para.preset_properties.latest_referrer && e.para.preset_properties.latest_referrer_host && (n.$latest_referrer_host = "" === n.$latest_referrer ? "" : t.getHostname(n.$latest_referrer)), n;
|
|
1803
|
+
}, e.detectMode = function() {
|
|
1804
|
+
var r = {
|
|
1805
|
+
searchKeywordMatch: location.search.match(/sa-request-id=([^&#]+)/),
|
|
1806
|
+
isSeachHasKeyword: function() {
|
|
1807
|
+
var e = this.searchKeywordMatch;
|
|
1808
|
+
return !!(e && e[0] && e[1]) && ("string" == typeof sessionStorage.getItem("sensors-visual-mode") && sessionStorage.removeItem("sensors-visual-mode"), !0);
|
|
1809
|
+
},
|
|
1810
|
+
hasKeywordHandle: function() {
|
|
1811
|
+
var e = this.searchKeywordMatch, r = location.search.match(/sa-request-type=([^&#]+)/), a = location.search.match(/sa-request-url=([^&#]+)/);
|
|
1812
|
+
u.setNotice(a), t.sessionStorage.isSupport() && (a && a[0] && a[1] && sessionStorage.setItem("sensors_heatmap_url", decodeURIComponent(a[1])), sessionStorage.setItem("sensors_heatmap_id", e[1]), r && r[0] && r[1] ? "1" === r[1] || "2" === r[1] || "3" === r[1] ? (r = r[1], sessionStorage.setItem("sensors_heatmap_type", r)) : r = null : r = null !== sessionStorage.getItem("sensors_heatmap_type") ? sessionStorage.getItem("sensors_heatmap_type") : null), this.isReady(e[1], r);
|
|
1813
|
+
},
|
|
1814
|
+
isReady: function(r, a, i) {
|
|
1815
|
+
e.para.heatmap_url ? t.loadScript({
|
|
1816
|
+
success: function() {
|
|
1817
|
+
setTimeout(function() {
|
|
1818
|
+
"undefined" != typeof sa_jssdk_heatmap_render && (sa_jssdk_heatmap_render(e, r, a, i), "object" == typeof console && "function" == typeof console.log && (e.heatmap_version && e.heatmap_version === e.lib_version || console.log("heatmap.js与sensorsdata.js版本号不一致,可能存在风险!")));
|
|
1819
|
+
}, 0);
|
|
1820
|
+
},
|
|
1821
|
+
error: function() {},
|
|
1822
|
+
type: "js",
|
|
1823
|
+
url: e.para.heatmap_url
|
|
1824
|
+
}) : e.log("没有指定heatmap_url的路径");
|
|
1825
|
+
},
|
|
1826
|
+
isStorageHasKeyword: function() {
|
|
1827
|
+
return t.sessionStorage.isSupport() && "string" == typeof sessionStorage.getItem("sensors_heatmap_id");
|
|
1828
|
+
},
|
|
1829
|
+
storageHasKeywordHandle: function() {
|
|
1830
|
+
u.setNotice(), r.isReady(sessionStorage.getItem("sensors_heatmap_id"), sessionStorage.getItem("sensors_heatmap_type"), location.href);
|
|
1831
|
+
}
|
|
1832
|
+
}, a = {
|
|
1833
|
+
isStorageHasKeyword: function() {
|
|
1834
|
+
return t.sessionStorage.isSupport() && "string" == typeof sessionStorage.getItem("sensors-visual-mode");
|
|
1835
|
+
},
|
|
1836
|
+
isSearchHasKeyword: function() {
|
|
1837
|
+
return !!location.search.match(/sa-visual-mode=true/) && ("string" == typeof sessionStorage.getItem("sensors_heatmap_id") && sessionStorage.removeItem("sensors_heatmap_id"), !0);
|
|
1838
|
+
},
|
|
1839
|
+
loadVtrack: function() {
|
|
1840
|
+
t.loadScript({
|
|
1841
|
+
success: function() {},
|
|
1842
|
+
error: function() {},
|
|
1843
|
+
type: "js",
|
|
1844
|
+
url: e.para.vtrack_url ? e.para.vtrack_url : location.protocol + "//static.sensorsdata.cn/sdk/" + e.lib_version + "/vtrack.min.js"
|
|
1845
|
+
});
|
|
1846
|
+
},
|
|
1847
|
+
messageListener: function(r) {
|
|
1848
|
+
if ("sa-fe" !== r.data.source) return !1;
|
|
1849
|
+
if ("v-track-mode" === r.data.type) {
|
|
1850
|
+
if (r.data.data && r.data.data.isVtrack) if (t.sessionStorage.isSupport() && sessionStorage.setItem("sensors-visual-mode", "true"), r.data.data.userURL && location.search.match(/sa-visual-mode=true/)) {
|
|
1851
|
+
var i = (n = r.data.data.userURL, t.secCheck.isHttpUrl(n) ? t.secCheck.removeScriptProtocol(n) : (e.log("可视化模式检测 URL 失败"), !1));
|
|
1852
|
+
i && (window.location.href = i);
|
|
1853
|
+
} else a.loadVtrack();
|
|
1854
|
+
window.removeEventListener("message", a.messageListener, !1);
|
|
1855
|
+
}
|
|
1856
|
+
var n;
|
|
1857
|
+
},
|
|
1858
|
+
removeMessageHandle: function() {
|
|
1859
|
+
window.removeEventListener && window.removeEventListener("message", a.messageListener, !1);
|
|
1860
|
+
},
|
|
1861
|
+
verifyVtrackMode: function() {
|
|
1862
|
+
window.addEventListener && window.addEventListener("message", a.messageListener, !1), a.postMessage();
|
|
1863
|
+
},
|
|
1864
|
+
postMessage: function() {
|
|
1865
|
+
window.parent && window.parent.postMessage && window.parent.postMessage({
|
|
1866
|
+
source: "sa-web-sdk",
|
|
1867
|
+
type: "v-is-vtrack",
|
|
1868
|
+
data: { sdkversion: "1.16.16" }
|
|
1869
|
+
}, "*");
|
|
1870
|
+
},
|
|
1871
|
+
notifyUser: function() {
|
|
1872
|
+
var e = function(t) {
|
|
1873
|
+
if ("sa-fe" !== t.data.source) return !1;
|
|
1874
|
+
"v-track-mode" === t.data.type && (t.data.data && t.data.data.isVtrack && alert("当前版本不支持,请升级部署神策数据治理"), window.removeEventListener("message", e, !1));
|
|
1875
|
+
};
|
|
1876
|
+
window.addEventListener && window.addEventListener("message", e, !1), a.postMessage();
|
|
1877
|
+
}
|
|
1878
|
+
}, i = function(r) {
|
|
1879
|
+
var a = e.bridge.initDefineBridgeInfo();
|
|
1880
|
+
function i() {
|
|
1881
|
+
var r = [];
|
|
1882
|
+
a.touch_app_bridge || r.push(e.debug.defineMode("1")), t.isObject(e.para.app_js_bridge) || (r.push(e.debug.defineMode("2")), a.verify_success = !1), t.isObject(e.para.heatmap) && "default" == e.para.heatmap.clickmap || r.push(e.debug.defineMode("3")), "fail" === a.verify_success && r.push(e.debug.defineMode("4"));
|
|
1883
|
+
var i = {
|
|
1884
|
+
callType: "app_alert",
|
|
1885
|
+
data: r
|
|
1886
|
+
};
|
|
1887
|
+
SensorsData_App_Visual_Bridge && SensorsData_App_Visual_Bridge.sensorsdata_visualized_alert_info ? SensorsData_App_Visual_Bridge.sensorsdata_visualized_alert_info(JSON.stringify(i)) : window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify(i));
|
|
1888
|
+
}
|
|
1889
|
+
if (t.isObject(window.SensorsData_App_Visual_Bridge) && window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode && (!0 === window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode || window.SensorsData_App_Visual_Bridge.sensorsdata_visualized_mode())) if (t.isObject(e.para.heatmap) && "default" == e.para.heatmap.clickmap) if (t.isObject(e.para.app_js_bridge) && "success" === a.verify_success) if (r) sa_jssdk_app_define_mode(e, r);
|
|
1890
|
+
else {
|
|
1891
|
+
var n = location.protocol;
|
|
1892
|
+
n = t.indexOf(["http:", "https:"], n) > -1 ? n : "https:", t.loadScript({
|
|
1893
|
+
success: function() {
|
|
1894
|
+
setTimeout(function() {
|
|
1895
|
+
"undefined" != typeof sa_jssdk_app_define_mode && sa_jssdk_app_define_mode(e, r);
|
|
1896
|
+
}, 0);
|
|
1897
|
+
},
|
|
1898
|
+
error: function() {},
|
|
1899
|
+
type: "js",
|
|
1900
|
+
url: n + "//static.sensorsdata.cn/sdk/" + e.lib_version + "/vapph5define.min.js"
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
else i();
|
|
1904
|
+
else i();
|
|
1905
|
+
};
|
|
1906
|
+
r.isSeachHasKeyword() ? r.hasKeywordHandle() : window.parent !== self && a.isSearchHasKeyword() ? a.verifyVtrackMode() : r.isStorageHasKeyword() ? r.storageHasKeywordHandle() : window.parent !== self && a.isStorageHasKeyword() ? a.verifyVtrackMode() : (e.readyState.setState(3), new e.JSBridge({
|
|
1907
|
+
type: "visualized",
|
|
1908
|
+
app_call_js: function() {
|
|
1909
|
+
"undefined" != typeof sa_jssdk_app_define_mode ? i(!0) : i(!1);
|
|
1910
|
+
}
|
|
1911
|
+
}), i(!1), e.bridge.app_js_bridge_v1(), t.info.initPage(), e.para.is_track_single_page && t.addSinglePageEvent(function(r) {
|
|
1912
|
+
var a = function(a) {
|
|
1913
|
+
a = a || {}, r !== location.href && (t.info.pageProp.referrer = r, r = t.isDecodeURI(e.para.url_is_decode, r), e.quick("autoTrack", t.extend({
|
|
1914
|
+
$url: t.isDecodeURI(e.para.url_is_decode, location.href),
|
|
1915
|
+
$referrer: r
|
|
1916
|
+
}, a)));
|
|
1917
|
+
};
|
|
1918
|
+
if ("boolean" == typeof e.para.is_track_single_page) a();
|
|
1919
|
+
else if ("function" == typeof e.para.is_track_single_page) {
|
|
1920
|
+
var i = e.para.is_track_single_page();
|
|
1921
|
+
t.isObject(i) ? a(i) : !0 === i && a();
|
|
1922
|
+
}
|
|
1923
|
+
}), e.para.batch_send && (t.addEvent(window, "onpagehide" in window ? "pagehide" : "unload", function(t) {
|
|
1924
|
+
e.batchSend.clearPendingStatus();
|
|
1925
|
+
}), e.batchSend.batchInterval()), e.store.init(), e.readyState.setState(4), e._q && t.isArray(e._q) && e._q.length > 0 && t.each(e._q, function(t) {
|
|
1926
|
+
e[t[0]].apply(e, Array.prototype.slice.call(t[1]));
|
|
1927
|
+
}), t.isObject(e.para.heatmap) && (u.initHeatmap(), u.initScrollmap()), a.notifyUser());
|
|
1928
|
+
}, a.prototype = {
|
|
1929
|
+
add: function(e) {
|
|
1930
|
+
t.isObject(e) && (this.writeStore(e), "track_signup" !== e.type && "$pageview" !== e.event || this.sendStrategy());
|
|
1931
|
+
},
|
|
1932
|
+
clearPendingStatus: function() {
|
|
1933
|
+
this.sendingItemKeys.length && this.removePendingItems(this.sendingItemKeys);
|
|
1934
|
+
},
|
|
1935
|
+
remove: function(e) {
|
|
1936
|
+
this.sendingData > 0 && --this.sendingData, t.isArray(e) && e.length > 0 && t.each(e, function(e) {
|
|
1937
|
+
t.localStorage.remove(e);
|
|
1938
|
+
});
|
|
1939
|
+
},
|
|
1940
|
+
send: function(r) {
|
|
1941
|
+
var a, i = this;
|
|
1942
|
+
t.isString(e.para.server_url) && "" !== e.para.server_url || t.isArray(e.para.server_url) && e.para.server_url.length ? (a = t.isArray(e.para.server_url) ? e.para.server_url[0] : e.para.server_url, t.ajax({
|
|
1943
|
+
url: a,
|
|
1944
|
+
type: "POST",
|
|
1945
|
+
data: "data_list=" + encodeURIComponent(t.base64Encode(JSON.stringify(r.vals))),
|
|
1946
|
+
credentials: !1,
|
|
1947
|
+
timeout: e.para.batch_send.datasend_timeout,
|
|
1948
|
+
cors: !0,
|
|
1949
|
+
success: function() {
|
|
1950
|
+
i.remove(r.keys), i.removePendingItems(r.keys);
|
|
1951
|
+
},
|
|
1952
|
+
error: function() {
|
|
1953
|
+
i.sendingData > 0 && --i.sendingData, i.removePendingItems(r.keys);
|
|
1954
|
+
}
|
|
1955
|
+
})) : e.log("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!");
|
|
1956
|
+
},
|
|
1957
|
+
appendPendingItems: function(e) {
|
|
1958
|
+
if (!1 !== t.isArray(e)) {
|
|
1959
|
+
this.sendingItemKeys = t.unique(this.sendingItemKeys.concat(e));
|
|
1960
|
+
try {
|
|
1961
|
+
var r = this.getPendingItems(), a = t.unique(r.concat(e));
|
|
1962
|
+
localStorage.setItem("sawebjssdk-sendingitems", JSON.stringify(a));
|
|
1963
|
+
} catch (i) {}
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
removePendingItems: function(e) {
|
|
1967
|
+
if (!1 !== t.isArray(e)) {
|
|
1968
|
+
this.sendingItemKeys.length && (this.sendingItemKeys = t.filter(this.sendingItemKeys, function(r) {
|
|
1969
|
+
return -1 === t.indexOf(e, r);
|
|
1970
|
+
}));
|
|
1971
|
+
try {
|
|
1972
|
+
var r = this.getPendingItems(), a = t.filter(r, function(r) {
|
|
1973
|
+
return -1 === t.indexOf(e, r);
|
|
1974
|
+
});
|
|
1975
|
+
localStorage.setItem("sawebjssdk-sendingitems", JSON.stringify(a));
|
|
1976
|
+
} catch (i) {}
|
|
1977
|
+
}
|
|
1978
|
+
},
|
|
1979
|
+
getPendingItems: function() {
|
|
1980
|
+
var e = [];
|
|
1981
|
+
try {
|
|
1982
|
+
var t = localStorage.getItem("sawebjssdk-sendingitems");
|
|
1983
|
+
t && (e = JSON.parse(t));
|
|
1984
|
+
} catch (r) {}
|
|
1985
|
+
return e;
|
|
1986
|
+
},
|
|
1987
|
+
sendPrepare: function(e) {
|
|
1988
|
+
this.appendPendingItems(e.keys);
|
|
1989
|
+
var t = e.vals;
|
|
1990
|
+
t.length > 0 && this.send({
|
|
1991
|
+
keys: e.keys,
|
|
1992
|
+
vals: t
|
|
1993
|
+
});
|
|
1994
|
+
},
|
|
1995
|
+
sendStrategy: function() {
|
|
1996
|
+
if (!1 === document.hasFocus()) return !1;
|
|
1997
|
+
var e = this.readStore();
|
|
1998
|
+
e.keys.length > 0 && 0 === this.sendingData && (this.sendingData = 1, this.sendPrepare(e));
|
|
1999
|
+
},
|
|
2000
|
+
batchInterval: function() {
|
|
2001
|
+
var t = this;
|
|
2002
|
+
setInterval(function() {
|
|
2003
|
+
t.sendStrategy();
|
|
2004
|
+
}, e.para.batch_send.send_interval);
|
|
2005
|
+
},
|
|
2006
|
+
readStore: function() {
|
|
2007
|
+
for (var r = [], a = [], i = null, n = (/* @__PURE__ */ new Date()).getTime(), s = localStorage.length, o = this.getPendingItems(), c = 0; c < s; c++) {
|
|
2008
|
+
var l = localStorage.key(c);
|
|
2009
|
+
if (0 === l.indexOf("sawebjssdk-") && /^sawebjssdk\-\d+$/.test(l)) {
|
|
2010
|
+
if (o.length && t.indexOf(o, l) > -1) continue;
|
|
2011
|
+
(i = localStorage.getItem(l)) ? (i = t.safeJSONParse(i)) && t.isObject(i) ? (i._flush_time = n, r.push(l), a.push(i)) : (localStorage.removeItem(l), e.log("localStorage-数据parse异常" + i)) : (localStorage.removeItem(l), e.log("localStorage-数据取值异常" + i));
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
return {
|
|
2015
|
+
keys: r,
|
|
2016
|
+
vals: a
|
|
2017
|
+
};
|
|
2018
|
+
},
|
|
2019
|
+
writeStore: function(e) {
|
|
2020
|
+
var r = String(t.getRandom()).slice(2, 5) + String(t.getRandom()).slice(2, 5) + String((/* @__PURE__ */ new Date()).getTime()).slice(3);
|
|
2021
|
+
localStorage.setItem("sawebjssdk-" + r, JSON.stringify(e));
|
|
2022
|
+
}
|
|
2023
|
+
}, e.batchSend = new a();
|
|
2024
|
+
var i = {
|
|
2025
|
+
getSendUrl: function(e, r) {
|
|
2026
|
+
var a = t.base64Encode(r), i = "crc=" + t.hashCode(a);
|
|
2027
|
+
return -1 !== e.indexOf("?") ? e + "&data=" + encodeURIComponent(a) + "&ext=" + encodeURIComponent(i) : e + "?data=" + encodeURIComponent(a) + "&ext=" + encodeURIComponent(i);
|
|
2028
|
+
},
|
|
2029
|
+
getSendData: function(e) {
|
|
2030
|
+
var r = t.base64Encode(e), a = "crc=" + t.hashCode(r);
|
|
2031
|
+
return "data=" + encodeURIComponent(r) + "&ext=" + encodeURIComponent(a);
|
|
2032
|
+
},
|
|
2033
|
+
getInstance: function(r) {
|
|
2034
|
+
var a = new this[this.getSendType(r)](r), i = a.start;
|
|
2035
|
+
return a.start = function() {
|
|
2036
|
+
t.isObject(e.para.is_debug) && e.para.is_debug.storage && e.store.requests && e.store.requests.push({
|
|
2037
|
+
name: this.server_url,
|
|
2038
|
+
initiatorType: this.img ? "img" : "xmlhttprequest",
|
|
2039
|
+
entryType: "resource",
|
|
2040
|
+
requestData: this.data
|
|
2041
|
+
});
|
|
2042
|
+
var r = this;
|
|
2043
|
+
i.apply(this, arguments), setTimeout(function() {
|
|
2044
|
+
r.isEnd(!0);
|
|
2045
|
+
}, e.para.callback_timeout);
|
|
2046
|
+
}, a.end = function() {
|
|
2047
|
+
this.callback && this.callback();
|
|
2048
|
+
var t = this;
|
|
2049
|
+
setTimeout(function() {
|
|
2050
|
+
t.lastClear && t.lastClear();
|
|
2051
|
+
}, e.para.datasend_timeout - e.para.callback_timeout);
|
|
2052
|
+
}, a.isEnd = function(t) {
|
|
2053
|
+
if (!this.received) {
|
|
2054
|
+
this.received = !0, this.end();
|
|
2055
|
+
var r = this;
|
|
2056
|
+
t ? e.para.queue_timeout - e.para.callback_timeout <= 0 ? r.close() : setTimeout(function() {
|
|
2057
|
+
r.close();
|
|
2058
|
+
}, e.para.queue_timeout - e.para.callback_timeout) : r.close();
|
|
2059
|
+
}
|
|
2060
|
+
}, a;
|
|
2061
|
+
},
|
|
2062
|
+
getRealtimeInstance: function(t) {
|
|
2063
|
+
var r = new this[this.getSendType(t)](t);
|
|
2064
|
+
r.defaultData = t;
|
|
2065
|
+
var a = r.start;
|
|
2066
|
+
return r.start = function() {
|
|
2067
|
+
var t = this;
|
|
2068
|
+
a.apply(this, arguments), setTimeout(function() {
|
|
2069
|
+
t.isEnd(!0);
|
|
2070
|
+
}, e.para.callback_timeout);
|
|
2071
|
+
}, r.end = function() {
|
|
2072
|
+
this.callback && this.callback();
|
|
2073
|
+
var t = this;
|
|
2074
|
+
setTimeout(function() {
|
|
2075
|
+
t.lastClear && t.lastClear();
|
|
2076
|
+
}, e.para.datasend_timeout - e.para.callback_timeout);
|
|
2077
|
+
}, r.isEnd = function(e) {
|
|
2078
|
+
this.received || (this.received = !0, this.end());
|
|
2079
|
+
}, r;
|
|
2080
|
+
},
|
|
2081
|
+
getSendType: function(r) {
|
|
2082
|
+
var a = [
|
|
2083
|
+
"image",
|
|
2084
|
+
"ajax",
|
|
2085
|
+
"beacon"
|
|
2086
|
+
], i = a[0];
|
|
2087
|
+
return "beacon" === (i = r.config && t.indexOf(a, r.config.send_type) > -1 ? r.config.send_type : e.para.send_type) && !1 === t.isSupportBeaconSend() && (i = "image"), "ajax" === i && !1 === t.isSupportCors() && (i = "image"), i;
|
|
2088
|
+
},
|
|
2089
|
+
image: function(t) {
|
|
2090
|
+
this.callback = t.callback, this.img = document.createElement("img"), this.img.width = 1, this.img.height = 1, e.para.img_use_crossorigin && (this.img.crossOrigin = "anonymous"), this.data = t.data, this.server_url = i.getSendUrl(t.server_url, t.data);
|
|
2091
|
+
}
|
|
2092
|
+
};
|
|
2093
|
+
i.image.prototype.start = function() {
|
|
2094
|
+
var t = this;
|
|
2095
|
+
e.para.ignore_oom && (this.img.onload = function() {
|
|
2096
|
+
this.onload = null, this.onerror = null, this.onabort = null, t.isEnd();
|
|
2097
|
+
}, this.img.onerror = function() {
|
|
2098
|
+
this.onload = null, this.onerror = null, this.onabort = null, t.isEnd();
|
|
2099
|
+
}, this.img.onabort = function() {
|
|
2100
|
+
this.onload = null, this.onerror = null, this.onabort = null, t.isEnd();
|
|
2101
|
+
}), this.img.src = this.server_url;
|
|
2102
|
+
}, i.image.prototype.lastClear = function() {
|
|
2103
|
+
this.img.src = "";
|
|
2104
|
+
}, i.ajax = function(e) {
|
|
2105
|
+
this.callback = e.callback, this.server_url = e.server_url, this.data = i.getSendData(e.data);
|
|
2106
|
+
}, i.ajax.prototype.start = function() {
|
|
2107
|
+
var r = this;
|
|
2108
|
+
t.ajax({
|
|
2109
|
+
url: this.server_url,
|
|
2110
|
+
type: "POST",
|
|
2111
|
+
data: this.data,
|
|
2112
|
+
credentials: !1,
|
|
2113
|
+
timeout: e.para.datasend_timeout,
|
|
2114
|
+
cors: !0,
|
|
2115
|
+
success: function() {
|
|
2116
|
+
r.isEnd();
|
|
2117
|
+
},
|
|
2118
|
+
error: function() {
|
|
2119
|
+
r.isEnd();
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
}, i.beacon = function(e) {
|
|
2123
|
+
this.callback = e.callback, this.server_url = e.server_url, this.data = i.getSendData(e.data);
|
|
2124
|
+
}, i.beacon.prototype.start = function() {
|
|
2125
|
+
var e = this;
|
|
2126
|
+
"object" == typeof navigator && "function" == typeof navigator.sendBeacon && (navigator.sendBeacon(this.server_url, this.data) || (this.defaultData.config.send_type = "image", n.realtimeSend(this.defaultData))), setTimeout(function() {
|
|
2127
|
+
e.isEnd();
|
|
2128
|
+
}, 40);
|
|
2129
|
+
};
|
|
2130
|
+
var n = {};
|
|
2131
|
+
e.sendState = n, e.events = new t.eventEmitter(), n.queue = t.autoExeQueue(), n.requestData = null, n.getSendCall = function(r, a, i) {
|
|
2132
|
+
if (e.is_heatmap_render_mode) return !1;
|
|
2133
|
+
if (e.readyState.state < 3) return e.log("初始化没有完成"), !1;
|
|
2134
|
+
r._track_id = Number(String(t.getRandom()).slice(2, 5) + String(t.getRandom()).slice(2, 4) + String((/* @__PURE__ */ new Date()).getTime()).slice(-4)), e.para.use_client_time && (r._flush_time = (/* @__PURE__ */ new Date()).getTime());
|
|
2135
|
+
var n = r;
|
|
2136
|
+
if (r = JSON.stringify(r), this.requestData = {
|
|
2137
|
+
data: n,
|
|
2138
|
+
config: a,
|
|
2139
|
+
callback: i
|
|
2140
|
+
}, e.events.tempAdd("send", n), !e.para.app_js_bridge && e.para.batch_send && localStorage.length < 200) return e.log(n), e.batchSend.add(this.requestData.data), !1;
|
|
2141
|
+
e.bridge.dataSend(n, this, i), e.log(n);
|
|
2142
|
+
}, n.prepareServerUrl = function() {
|
|
2143
|
+
if ("object" == typeof this.requestData.config && this.requestData.config.server_url) this.sendCall(this.requestData.config.server_url, this.requestData.callback);
|
|
2144
|
+
else if (t.isArray(e.para.server_url) && e.para.server_url.length) for (var r = 0; r < e.para.server_url.length; r++) this.sendCall(e.para.server_url[r]);
|
|
2145
|
+
else "string" == typeof e.para.server_url && "" !== e.para.server_url ? this.sendCall(e.para.server_url, this.requestData.callback) : e.log("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!");
|
|
2146
|
+
}, n.sendCall = function(r, a) {
|
|
2147
|
+
var i = {
|
|
2148
|
+
server_url: r,
|
|
2149
|
+
data: JSON.stringify(this.requestData.data),
|
|
2150
|
+
callback: a,
|
|
2151
|
+
config: this.requestData.config
|
|
2152
|
+
};
|
|
2153
|
+
t.isObject(e.para.jsapp) && !e.para.jsapp.isOnline && "function" == typeof e.para.jsapp.setData ? (delete i.callback, i = JSON.stringify(i), e.para.jsapp.setData(i)) : e.para.use_client_time ? this.realtimeSend(i) : this.pushSend(i);
|
|
2154
|
+
}, n.pushSend = function(e) {
|
|
2155
|
+
var t = i.getInstance(e), r = this;
|
|
2156
|
+
t.close = function() {
|
|
2157
|
+
r.queue.close();
|
|
2158
|
+
}, this.queue.enqueue(t);
|
|
2159
|
+
}, n.realtimeSend = function(e) {
|
|
2160
|
+
i.getRealtimeInstance(e).start();
|
|
2161
|
+
};
|
|
2162
|
+
var s = {};
|
|
2163
|
+
e.saEvent = s, s.checkOption = {
|
|
2164
|
+
regChecks: { regName: /^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$)[a-zA-Z_$][a-zA-Z\d_$]{0,99})$/i },
|
|
2165
|
+
checkPropertiesKey: function(e) {
|
|
2166
|
+
var r = this, a = !0;
|
|
2167
|
+
return t.each(e, function(e, t) {
|
|
2168
|
+
r.regChecks.regName.test(t) || (a = !1);
|
|
2169
|
+
}), a;
|
|
2170
|
+
},
|
|
2171
|
+
check: function(e, r) {
|
|
2172
|
+
return "string" == typeof this[e] ? this[this[e]](r) : t.isFunction(this[e]) ? this[e](r) : void 0;
|
|
2173
|
+
},
|
|
2174
|
+
str: function(r) {
|
|
2175
|
+
return !!t.isString(r) || (e.log("请检查参数格式,必须是字符串"), !0);
|
|
2176
|
+
},
|
|
2177
|
+
properties: function(r) {
|
|
2178
|
+
return t.strip_sa_properties(r), !r || (t.isObject(r) ? !!this.checkPropertiesKey(r) || (e.log("properties 里的自定义属性名需要是合法的变量名,不能以数字开头,且只包含:大小写字母、数字、下划线,自定义属性不能以 $ 开头"), !0) : (e.log("properties可以没有,但有的话必须是对象"), !0));
|
|
2179
|
+
},
|
|
2180
|
+
propertiesMust: function(r) {
|
|
2181
|
+
return t.strip_sa_properties(r), r === void 0 || !t.isObject(r) || t.isEmptyObject(r) ? (e.log("properties必须是对象且有值"), !0) : !!this.checkPropertiesKey(r) || (e.log("properties 里的自定义属性名需要是合法的变量名,不能以数字开头,且只包含:大小写字母、数字、下划线,自定义属性不能以 $ 开头"), !0);
|
|
2182
|
+
},
|
|
2183
|
+
event: function(r) {
|
|
2184
|
+
return !(!t.isString(r) || !this.regChecks.regName.test(r)) || (e.log("请检查参数格式,eventName 必须是字符串,且需是合法的变量名,即不能以数字开头,且只包含:大小写字母、数字、下划线和 $,其中以 $ 开头的表明是系统的保留字段,自定义事件名请不要以 $ 开头"), !0);
|
|
2185
|
+
},
|
|
2186
|
+
test_id: "str",
|
|
2187
|
+
group_id: "str",
|
|
2188
|
+
distinct_id: function(r) {
|
|
2189
|
+
return !(!t.isString(r) || !/^.{1,255}$/.test(r)) || (e.log("distinct_id必须是不能为空,且小于255位的字符串"), !1);
|
|
2190
|
+
}
|
|
2191
|
+
}, s.check = function(e) {
|
|
2192
|
+
for (var t in e) if (Object.prototype.hasOwnProperty.call(e, t) && !this.checkOption.check(t, e[t])) return !1;
|
|
2193
|
+
return !0;
|
|
2194
|
+
}, s.send = function(r, a) {
|
|
2195
|
+
var i = {
|
|
2196
|
+
distinct_id: c.getDistinctId(),
|
|
2197
|
+
lib: {
|
|
2198
|
+
$lib: "js",
|
|
2199
|
+
$lib_method: "code",
|
|
2200
|
+
$lib_version: String(e.lib_version)
|
|
2201
|
+
},
|
|
2202
|
+
properties: {}
|
|
2203
|
+
};
|
|
2204
|
+
t.isObject(r) && t.isObject(r.properties) && !t.isEmptyObject(r.properties) && r.properties.$lib_detail && (i.lib.$lib_detail = r.properties.$lib_detail, delete r.properties.$lib_detail), t.extend(i, e.store.getUnionId(), r), t.isObject(r.properties) && !t.isEmptyObject(r.properties) && t.extend(i.properties, r.properties), r.type && "profile" === r.type.slice(0, 7) || (i.properties = t.extend({}, t.info.properties(), c.getProps(), c.getSessionProps(), t.info.currentProps, i.properties), e.para.preset_properties.latest_referrer && !t.isString(i.properties.$latest_referrer) && (i.properties.$latest_referrer = "取值异常"), e.para.preset_properties.latest_search_keyword && !t.isString(i.properties.$latest_search_keyword) && (i.properties.$latest_search_keyword = "取值异常"), e.para.preset_properties.latest_traffic_source_type && !t.isString(i.properties.$latest_traffic_source_type) && (i.properties.$latest_traffic_source_type = "取值异常"), e.para.preset_properties.latest_landing_page && !t.isString(i.properties.$latest_landing_page) && (i.properties.$latest_landing_page = "取值异常"), "not_collect" === e.para.preset_properties.latest_wx_ad_click_id ? (delete i.properties._latest_wx_ad_click_id, delete i.properties._latest_wx_ad_hash_key, delete i.properties._latest_wx_ad_callbacks) : e.para.preset_properties.latest_wx_ad_click_id && !t.isString(i.properties._latest_wx_ad_click_id) && (i.properties._latest_wx_ad_click_id = "取值异常", i.properties._latest_wx_ad_hash_key = "取值异常", i.properties._latest_wx_ad_callbacks = "取值异常"), t.isString(i.properties._latest_wx_ad_click_id) && (i.properties.$url = t.isDecodeURI(e.para.url_is_decode, window.location.href))), i.properties.$time && t.isDate(i.properties.$time) ? (i.time = 1 * i.properties.$time, delete i.properties.$time) : e.para.use_client_time && (i.time = 1 * /* @__PURE__ */ new Date()), t.parseSuperProperties(i), t.filterReservedProperties(i.properties), t.searchObjDate(i), t.searchObjString(i), t.searchZZAppStyle(i);
|
|
2205
|
+
var n = t.searchConfigData(i.properties);
|
|
2206
|
+
l.checkIsAddSign(i), l.checkIsFirstTime(i), e.addReferrerHost(i), e.addPropsHook(i), !0 === e.para.debug_mode ? (e.log(i), this.debugPath(JSON.stringify(i), a)) : e.sendState.getSendCall(i, n, a);
|
|
2207
|
+
}, s.debugPath = function(r, a) {
|
|
2208
|
+
var i = r, n = "";
|
|
2209
|
+
n = -1 !== e.para.debug_mode_url.indexOf("?") ? e.para.debug_mode_url + "&data=" + encodeURIComponent(t.base64Encode(r)) : e.para.debug_mode_url + "?data=" + encodeURIComponent(t.base64Encode(r)), t.ajax({
|
|
2210
|
+
url: n,
|
|
2211
|
+
type: "GET",
|
|
2212
|
+
cors: !0,
|
|
2213
|
+
header: { "Dry-Run": String(e.para.debug_mode_upload) },
|
|
2214
|
+
success: function(e) {
|
|
2215
|
+
!0 === t.isEmptyObject(e) ? alert("debug数据发送成功" + i) : alert("debug失败 错误原因" + JSON.stringify(e));
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
};
|
|
2219
|
+
var c = e.store = {
|
|
2220
|
+
requests: [],
|
|
2221
|
+
_sessionState: {},
|
|
2222
|
+
_state: {
|
|
2223
|
+
distinct_id: "",
|
|
2224
|
+
first_id: "",
|
|
2225
|
+
props: {}
|
|
2226
|
+
},
|
|
2227
|
+
getProps: function() {
|
|
2228
|
+
return this._state.props || {};
|
|
2229
|
+
},
|
|
2230
|
+
getSessionProps: function() {
|
|
2231
|
+
return this._sessionState;
|
|
2232
|
+
},
|
|
2233
|
+
getDistinctId: function() {
|
|
2234
|
+
return this._state._distinct_id || this._state.distinct_id;
|
|
2235
|
+
},
|
|
2236
|
+
getUnionId: function() {
|
|
2237
|
+
var e = {}, t = this._state._first_id || this._state.first_id, r = this._state._distinct_id || this._state.distinct_id;
|
|
2238
|
+
return t && r ? (e.login_id = r, e.anonymous_id = t) : e.anonymous_id = r, e;
|
|
2239
|
+
},
|
|
2240
|
+
getFirstId: function() {
|
|
2241
|
+
return this._state._first_id || this._state.first_id;
|
|
2242
|
+
},
|
|
2243
|
+
toState: function(r) {
|
|
2244
|
+
var a = null;
|
|
2245
|
+
if (null != r && t.isJSONString(r)) if (a = JSON.parse(r), this._state = t.extend(a), a.distinct_id) {
|
|
2246
|
+
if ("object" == typeof a.props) {
|
|
2247
|
+
for (var i in a.props) "string" == typeof a.props[i] && (a.props[i] = a.props[i].slice(0, e.para.max_referrer_string_length));
|
|
2248
|
+
this.save();
|
|
2249
|
+
}
|
|
2250
|
+
} else this.set("distinct_id", t.UUID()), e.debug.distinct_id("1", r);
|
|
2251
|
+
else this.set("distinct_id", t.UUID()), e.debug.distinct_id("2", r);
|
|
2252
|
+
},
|
|
2253
|
+
initSessionState: function() {
|
|
2254
|
+
var e = t.cookie.get("sensorsdata2015session"), r = null;
|
|
2255
|
+
null !== e && "object" == typeof (r = JSON.parse(e)) && (this._sessionState = r || {});
|
|
2256
|
+
},
|
|
2257
|
+
setOnce: function(e, t) {
|
|
2258
|
+
e in this._state || this.set(e, t);
|
|
2259
|
+
},
|
|
2260
|
+
set: function(t, r) {
|
|
2261
|
+
this._state = this._state || {};
|
|
2262
|
+
var a = this._state.distinct_id;
|
|
2263
|
+
this._state[t] = r, "first_id" === t ? delete this._state._first_id : "distinct_id" === t && delete this._state._distinct_id, this.save(), "distinct_id" === t && a && e.events.tempAdd("changeDistinctId", r);
|
|
2264
|
+
},
|
|
2265
|
+
change: function(e, t) {
|
|
2266
|
+
this._state["_" + e] = t;
|
|
2267
|
+
},
|
|
2268
|
+
setSessionProps: function(e) {
|
|
2269
|
+
var r = this._sessionState;
|
|
2270
|
+
t.extend(r, e), this.sessionSave(r);
|
|
2271
|
+
},
|
|
2272
|
+
setSessionPropsOnce: function(e) {
|
|
2273
|
+
var r = this._sessionState;
|
|
2274
|
+
t.coverExtend(r, e), this.sessionSave(r);
|
|
2275
|
+
},
|
|
2276
|
+
setProps: function(r, a) {
|
|
2277
|
+
var i = {};
|
|
2278
|
+
for (var n in i = a ? r : t.extend(this._state.props || {}, r)) "string" == typeof i[n] && (i[n] = i[n].slice(0, e.para.max_referrer_string_length));
|
|
2279
|
+
this.set("props", i);
|
|
2280
|
+
},
|
|
2281
|
+
setPropsOnce: function(e) {
|
|
2282
|
+
var r = this._state.props || {};
|
|
2283
|
+
t.coverExtend(r, e), this.set("props", r);
|
|
2284
|
+
},
|
|
2285
|
+
clearAllProps: function(e) {
|
|
2286
|
+
if (this._sessionState = {}, t.isArray(e) && e.length > 0) for (var r = 0; r < e.length; r++) t.isString(e[r]) && -1 === e[r].indexOf("latest_") && e[r] in this._state.props && delete this._state.props[e[r]];
|
|
2287
|
+
else for (var r in this._state.props) 1 !== r.indexOf("latest_") && delete this._state.props[r];
|
|
2288
|
+
this.sessionSave({}), this.save();
|
|
2289
|
+
},
|
|
2290
|
+
sessionSave: function(e) {
|
|
2291
|
+
this._sessionState = e, t.cookie.set("sensorsdata2015session", JSON.stringify(this._sessionState), 0);
|
|
2292
|
+
},
|
|
2293
|
+
save: function() {
|
|
2294
|
+
var r = JSON.parse(JSON.stringify(this._state));
|
|
2295
|
+
delete r._first_id, delete r._distinct_id;
|
|
2296
|
+
var a = JSON.stringify(r);
|
|
2297
|
+
e.para.encrypt_cookie && (a = t.cookie.encrypt(a)), t.cookie.set(this.getCookieName(), a, 73e3, e.para.cross_subdomain);
|
|
2298
|
+
},
|
|
2299
|
+
getCookieName: function() {
|
|
2300
|
+
var r = "";
|
|
2301
|
+
if (!1 === e.para.cross_subdomain) {
|
|
2302
|
+
try {
|
|
2303
|
+
r = t.URL(location.href).hostname;
|
|
2304
|
+
} catch (a) {
|
|
2305
|
+
e.log(a);
|
|
2306
|
+
}
|
|
2307
|
+
r = "string" == typeof r && "" !== r ? "sa_jssdk_2015_" + r.replace(/\./g, "_") : "sa_jssdk_2015_root";
|
|
2308
|
+
} else r = "sensorsdata2015jssdkcross";
|
|
2309
|
+
return r;
|
|
2310
|
+
},
|
|
2311
|
+
init: function() {
|
|
2312
|
+
this.initSessionState();
|
|
2313
|
+
var r = t.UUID(), a = t.cookie.get(this.getCookieName());
|
|
2314
|
+
null === (a = t.cookie.resolveValue(a)) ? (e.is_first_visitor = !0, this.set("distinct_id", r)) : (t.isJSONString(a) && JSON.parse(a).distinct_id || (e.is_first_visitor = !0), this.toState(a)), l.setDeviceId(r), l.storeInitCheck(), l.checkIsFirstLatest();
|
|
2315
|
+
}
|
|
2316
|
+
}, l = {
|
|
2317
|
+
checkIsAddSign: function(e) {
|
|
2318
|
+
"track" === e.type && (t.cookie.getNewUser() ? e.properties.$is_first_day = !0 : e.properties.$is_first_day = !1);
|
|
2319
|
+
},
|
|
2320
|
+
is_first_visit_time: !1,
|
|
2321
|
+
checkIsFirstTime: function(e) {
|
|
2322
|
+
"track" === e.type && "$pageview" === e.event && (this.is_first_visit_time ? (e.properties.$is_first_time = !0, this.is_first_visit_time = !1) : e.properties.$is_first_time = !1);
|
|
2323
|
+
},
|
|
2324
|
+
setDeviceId: function(r) {
|
|
2325
|
+
var a = null, i = t.cookie.get("sensorsdata2015jssdkcross"), n = {};
|
|
2326
|
+
null != (i = t.cookie.resolveValue(i)) && t.isJSONString(i) && (n = JSON.parse(i)).$device_id && (a = n.$device_id), a = a || r, !0 === e.para.cross_subdomain ? c.set("$device_id", a) : (n.$device_id = a, n = JSON.stringify(n), e.para.encrypt_cookie && (n = t.cookie.encrypt(n)), t.cookie.set("sensorsdata2015jssdkcross", n, null, !0)), e.para.is_track_device_id && (t.info.currentProps.$device_id = a);
|
|
2327
|
+
},
|
|
2328
|
+
storeInitCheck: function() {
|
|
2329
|
+
if (e.is_first_visitor) {
|
|
2330
|
+
var r = /* @__PURE__ */ new Date(), a = {
|
|
2331
|
+
h: 23 - r.getHours(),
|
|
2332
|
+
m: 59 - r.getMinutes(),
|
|
2333
|
+
s: 59 - r.getSeconds()
|
|
2334
|
+
};
|
|
2335
|
+
t.cookie.set(t.cookie.getCookieName("new_user"), "1", 3600 * a.h + 60 * a.m + a.s + "s"), this.is_first_visit_time = !0;
|
|
2336
|
+
} else t.cookie.getNewUser() || (this.checkIsAddSign = function(e) {
|
|
2337
|
+
"track" === e.type && (e.properties.$is_first_day = !1);
|
|
2338
|
+
}), this.checkIsFirstTime = function(e) {
|
|
2339
|
+
"track" === e.type && "$pageview" === e.event && (e.properties.$is_first_time = !1);
|
|
2340
|
+
};
|
|
2341
|
+
},
|
|
2342
|
+
checkIsFirstLatest: function() {
|
|
2343
|
+
for (var r = t.info.pageProp.url_domain, a = [
|
|
2344
|
+
"$utm_source",
|
|
2345
|
+
"$utm_medium",
|
|
2346
|
+
"$utm_campaign",
|
|
2347
|
+
"$utm_content",
|
|
2348
|
+
"$utm_term"
|
|
2349
|
+
], i = c.getProps(), n = 0; n < a.length; n++) a[n] in i && delete i[a[n]];
|
|
2350
|
+
c.setProps(i, !0);
|
|
2351
|
+
var s = {};
|
|
2352
|
+
if ("" === r && (r = "url解析失败"), t.each(e.para.preset_properties, function(a, i) {
|
|
2353
|
+
if (-1 === i.indexOf("latest_")) return !1;
|
|
2354
|
+
if (i = i.slice(7), a) {
|
|
2355
|
+
if ("wx_ad_click_id" === i && "not_collect" === a) return !1;
|
|
2356
|
+
if ("utm" !== i && "url解析失败" === r) "wx_ad_click_id" === i ? (s._latest_wx_ad_click_id = "url的domain解析失败", s._latest_wx_ad_hash_key = "url的domain解析失败", s._latest_wx_ad_callbacks = "url的domain解析失败") : s["$latest_" + i] = "url的domain解析失败";
|
|
2357
|
+
else if (t.isReferralTraffic(document.referrer)) switch (i) {
|
|
2358
|
+
case "traffic_source_type":
|
|
2359
|
+
s.$latest_traffic_source_type = t.getSourceFromReferrer();
|
|
2360
|
+
break;
|
|
2361
|
+
case "referrer":
|
|
2362
|
+
s.$latest_referrer = t.isDecodeURI(e.para.url_is_decode, t.info.pageProp.referrer);
|
|
2363
|
+
break;
|
|
2364
|
+
case "search_keyword":
|
|
2365
|
+
s.$latest_search_keyword = t.getKeywordFromReferrer();
|
|
2366
|
+
break;
|
|
2367
|
+
case "landing_page":
|
|
2368
|
+
s.$latest_landing_page = t.isDecodeURI(e.para.url_is_decode, location.href);
|
|
2369
|
+
break;
|
|
2370
|
+
case "wx_ad_click_id":
|
|
2371
|
+
var n = t.getWxAdIdFromUrl(location.href);
|
|
2372
|
+
s._latest_wx_ad_click_id = n.click_id, s._latest_wx_ad_hash_key = n.hash_key, s._latest_wx_ad_callbacks = n.callbacks;
|
|
2373
|
+
}
|
|
2374
|
+
} else if ("utm" === i && e.store._state.props) for (var o in e.store._state.props) (0 === o.indexOf("$latest_utm") || 0 === o.indexOf("_latest_") && o.indexOf("_latest_wx_ad_") < 0) && delete e.store._state.props[o];
|
|
2375
|
+
else if (e.store._state.props && "$latest_" + i in e.store._state.props) delete e.store._state.props["$latest_" + i];
|
|
2376
|
+
else if ("wx_ad_click_id" == i && e.store._state.props && !1 === a) t.each([
|
|
2377
|
+
"_latest_wx_ad_click_id",
|
|
2378
|
+
"_latest_wx_ad_hash_key",
|
|
2379
|
+
"_latest_wx_ad_callbacks"
|
|
2380
|
+
], function(t) {
|
|
2381
|
+
t in e.store._state.props && delete e.store._state.props[t];
|
|
2382
|
+
});
|
|
2383
|
+
}), e.register(s), e.para.preset_properties.latest_utm) {
|
|
2384
|
+
var o = t.info.campaignParamsStandard("$latest_", "_latest_"), l = o.$utms, u = o.otherUtms;
|
|
2385
|
+
t.isEmptyObject(l) || e.register(l), t.isEmptyObject(u) || e.register(u);
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
e.bridge = {
|
|
2390
|
+
is_verify_success: !1,
|
|
2391
|
+
initPara: function() {
|
|
2392
|
+
var r = {
|
|
2393
|
+
is_send: !0,
|
|
2394
|
+
white_list: [],
|
|
2395
|
+
is_mui: !1
|
|
2396
|
+
};
|
|
2397
|
+
"object" == typeof e.para.app_js_bridge ? e.para.app_js_bridge = t.extend({}, r, e.para.app_js_bridge) : !0 === e.para.use_app_track || !0 === e.para.app_js_bridge || "only" === e.para.use_app_track ? (!1 !== e.para.use_app_track_is_send && "only" !== e.para.use_app_track || (r.is_send = !1), e.para.app_js_bridge = t.extend({}, r)) : "mui" === e.para.use_app_track && (r.is_mui = !0, e.para.app_js_bridge = t.extend({}, r)), !1 === e.para.app_js_bridge.is_send && e.log("设置了 is_send:false,如果打通失败,数据将被丢弃!");
|
|
2398
|
+
},
|
|
2399
|
+
initState: function() {
|
|
2400
|
+
function r(r) {
|
|
2401
|
+
function a(r) {
|
|
2402
|
+
var a = {
|
|
2403
|
+
hostname: "",
|
|
2404
|
+
project: ""
|
|
2405
|
+
};
|
|
2406
|
+
try {
|
|
2407
|
+
a.hostname = t.URL(r).hostname, a.project = t.URL(r).searchParams.get("project") || "default";
|
|
2408
|
+
} catch (i) {
|
|
2409
|
+
e.log(i);
|
|
2410
|
+
}
|
|
2411
|
+
return a;
|
|
2412
|
+
}
|
|
2413
|
+
var i = a(r), n = a(e.para.server_url);
|
|
2414
|
+
if (i.hostname === n.hostname && i.project === n.project) return !0;
|
|
2415
|
+
if (e.para.app_js_bridge.white_list.length > 0) for (var s = 0; s < e.para.app_js_bridge.white_list.length; s++) {
|
|
2416
|
+
var o = a(e.para.app_js_bridge.white_list[s]);
|
|
2417
|
+
if (o.hostname === i.hostname && o.project === i.project) return !0;
|
|
2418
|
+
}
|
|
2419
|
+
return !1;
|
|
2420
|
+
}
|
|
2421
|
+
if (t.isObject(e.para.app_js_bridge) && !e.para.app_js_bridge.is_mui) {
|
|
2422
|
+
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && t.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) r(window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) && (e.bridge.is_verify_success = !0);
|
|
2423
|
+
else if (t.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track) {
|
|
2424
|
+
var a = window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url();
|
|
2425
|
+
a && r(a) && (e.bridge.is_verify_success = !0);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
},
|
|
2429
|
+
initDefineBridgeInfo: function() {
|
|
2430
|
+
var r = {
|
|
2431
|
+
touch_app_bridge: !0,
|
|
2432
|
+
verify_success: !1
|
|
2433
|
+
};
|
|
2434
|
+
return window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && t.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url ? e.bridge.is_verify_success ? r.verify_success = "success" : r.verify_success = "fail" : t.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track ? e.bridge.is_verify_success ? r.verify_success = "success" : r.verify_success = "fail" : "object" == typeof SensorsData_APP_JS_Bridge && (SensorsData_APP_JS_Bridge.sensorsdata_verify && SensorsData_APP_JS_Bridge.sensorsdata_visual_verify || SensorsData_APP_JS_Bridge.sensorsdata_track) ? SensorsData_APP_JS_Bridge.sensorsdata_verify && SensorsData_APP_JS_Bridge.sensorsdata_visual_verify ? SensorsData_APP_JS_Bridge.sensorsdata_visual_verify(JSON.stringify({ server_url: e.para.server_url })) ? r.verify_success = "success" : r.verify_success = "fail" : r.verify_success = "success" : !/sensors-verify/.test(navigator.userAgent) && !/sa-sdk-ios/.test(navigator.userAgent) || window.MSStream ? r.touch_app_bridge = !1 : e.bridge.iOS_UA_bridge() ? r.verify_success = "success" : r.verify_success = "fail", r;
|
|
2435
|
+
},
|
|
2436
|
+
iOS_UA_bridge: function() {
|
|
2437
|
+
if (/sensors-verify/.test(navigator.userAgent)) {
|
|
2438
|
+
var r = navigator.userAgent.match(/sensors-verify\/([^\s]+)/);
|
|
2439
|
+
if (r && r[0] && "string" == typeof r[1] && 2 === r[1].split("?").length) {
|
|
2440
|
+
r = r[1].split("?");
|
|
2441
|
+
var a = null, i = null;
|
|
2442
|
+
try {
|
|
2443
|
+
a = t.URL(e.para.server_url).hostname, i = t.URL(e.para.server_url).searchParams.get("project") || "default";
|
|
2444
|
+
} catch (n) {
|
|
2445
|
+
e.log(n);
|
|
2446
|
+
}
|
|
2447
|
+
return !(!a || a !== r[0] || !i || i !== r[1]);
|
|
2448
|
+
}
|
|
2449
|
+
return !1;
|
|
2450
|
+
}
|
|
2451
|
+
return !!/sa-sdk-ios/.test(navigator.userAgent);
|
|
2452
|
+
},
|
|
2453
|
+
dataSend: function(r, a, i) {
|
|
2454
|
+
if (t.isObject(e.para.app_js_bridge) && !e.para.app_js_bridge.is_mui) if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage && t.isObject(window.SensorsData_iOS_JS_Bridge) && window.SensorsData_iOS_JS_Bridge.sensorsdata_app_server_url) e.bridge.is_verify_success ? (window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify({
|
|
2455
|
+
callType: "app_h5_track",
|
|
2456
|
+
data: t.extend({ server_url: e.para.server_url }, r)
|
|
2457
|
+
})), "function" == typeof i && i()) : e.para.app_js_bridge.is_send ? (e.debug.apph5({
|
|
2458
|
+
data: r,
|
|
2459
|
+
step: "4.1",
|
|
2460
|
+
output: "all"
|
|
2461
|
+
}), a.prepareServerUrl()) : "function" == typeof i && i();
|
|
2462
|
+
else if (t.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_get_server_url && window.SensorsData_APP_New_H5_Bridge.sensorsdata_track) e.bridge.is_verify_success ? (SensorsData_APP_New_H5_Bridge.sensorsdata_track(JSON.stringify(t.extend({ server_url: e.para.server_url }, r))), "function" == typeof i && i()) : e.para.app_js_bridge.is_send ? (e.debug.apph5({
|
|
2463
|
+
data: r,
|
|
2464
|
+
step: "4.2",
|
|
2465
|
+
output: "all"
|
|
2466
|
+
}), a.prepareServerUrl()) : "function" == typeof i && i();
|
|
2467
|
+
else if ("object" == typeof SensorsData_APP_JS_Bridge && (SensorsData_APP_JS_Bridge.sensorsdata_verify || SensorsData_APP_JS_Bridge.sensorsdata_track)) SensorsData_APP_JS_Bridge.sensorsdata_verify ? SensorsData_APP_JS_Bridge.sensorsdata_verify(JSON.stringify(t.extend({ server_url: e.para.server_url }, r))) ? "function" == typeof i && i() : e.para.app_js_bridge.is_send ? (e.debug.apph5({
|
|
2468
|
+
data: r,
|
|
2469
|
+
step: "3.1",
|
|
2470
|
+
output: "all"
|
|
2471
|
+
}), a.prepareServerUrl()) : "function" == typeof i && i() : (SensorsData_APP_JS_Bridge.sensorsdata_track(JSON.stringify(t.extend({ server_url: e.para.server_url }, r))), "function" == typeof i && i());
|
|
2472
|
+
else if (!/sensors-verify/.test(navigator.userAgent) && !/sa-sdk-ios/.test(navigator.userAgent) || window.MSStream) t.isObject(e.para.app_js_bridge) && !0 === e.para.app_js_bridge.is_send ? (e.debug.apph5({
|
|
2473
|
+
data: r,
|
|
2474
|
+
step: "2",
|
|
2475
|
+
output: "all"
|
|
2476
|
+
}), a.prepareServerUrl()) : "function" == typeof i && i();
|
|
2477
|
+
else {
|
|
2478
|
+
var n = null;
|
|
2479
|
+
if (e.bridge.iOS_UA_bridge()) {
|
|
2480
|
+
n = document.createElement("iframe");
|
|
2481
|
+
var s = function(r) {
|
|
2482
|
+
var a = JSON.stringify(t.extend({ server_url: e.para.server_url }, r));
|
|
2483
|
+
return a = a.replaceAll(/\r\n/g, ""), "sensorsanalytics://trackEvent?event=" + (a = encodeURIComponent(a));
|
|
2484
|
+
}(r);
|
|
2485
|
+
n.setAttribute("src", s), document.documentElement.appendChild(n), n.parentNode.removeChild(n), n = null, "function" == typeof i && i();
|
|
2486
|
+
} else e.para.app_js_bridge.is_send ? (e.debug.apph5({
|
|
2487
|
+
data: r,
|
|
2488
|
+
step: "3.2",
|
|
2489
|
+
output: "all"
|
|
2490
|
+
}), a.prepareServerUrl()) : "function" == typeof i && i();
|
|
2491
|
+
}
|
|
2492
|
+
else t.isObject(e.para.app_js_bridge) && e.para.app_js_bridge.is_mui ? t.isObject(window.plus) && window.plus.SDAnalytics && window.plus.SDAnalytics.trackH5Event ? (window.plus.SDAnalytics.trackH5Event(data), "function" == typeof i && i()) : t.isObject(e.para.app_js_bridge) && !0 === e.para.app_js_bridge.is_send ? a.prepareServerUrl() : "function" == typeof i && i() : (e.debug.apph5({
|
|
2493
|
+
data: r,
|
|
2494
|
+
step: "1",
|
|
2495
|
+
output: "code"
|
|
2496
|
+
}), a.prepareServerUrl());
|
|
2497
|
+
},
|
|
2498
|
+
app_js_bridge_v1: function() {
|
|
2499
|
+
var r = null, a = null;
|
|
2500
|
+
window.sensorsdata_app_js_bridge_call_js = function(e) {
|
|
2501
|
+
(function(e) {
|
|
2502
|
+
r = e, t.isJSONString(r) && (r = JSON.parse(r)), a && (a(r), a = null, r = null);
|
|
2503
|
+
})(e);
|
|
2504
|
+
}, e.getAppStatus = function(e) {
|
|
2505
|
+
if (function() {
|
|
2506
|
+
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
2507
|
+
var e = document.createElement("iframe");
|
|
2508
|
+
e.setAttribute("src", "sensorsanalytics://getAppInfo"), document.documentElement.appendChild(e), e.parentNode.removeChild(e), e = null;
|
|
2509
|
+
}
|
|
2510
|
+
}(), "object" == typeof window.SensorsData_APP_JS_Bridge && window.SensorsData_APP_JS_Bridge.sensorsdata_call_app && (r = SensorsData_APP_JS_Bridge.sensorsdata_call_app(), t.isJSONString(r) && (r = JSON.parse(r))), !e) return r;
|
|
2511
|
+
null === r ? a = e : (e(r), r = null);
|
|
2512
|
+
};
|
|
2513
|
+
},
|
|
2514
|
+
supportAppCallJs: function() {
|
|
2515
|
+
window.sensorsdata_app_call_js = function(e, t) {
|
|
2516
|
+
e in window.sensorsdata_app_call_js.modules && window.sensorsdata_app_call_js.modules[e](t);
|
|
2517
|
+
}, window.sensorsdata_app_call_js.modules = {};
|
|
2518
|
+
}
|
|
2519
|
+
}, e.JSBridge = function(e) {
|
|
2520
|
+
this.list = {}, this.type = e.type, this.app_call_js = t.isFunction(e.app_call_js) ? e.app_call_js : function() {}, this.init();
|
|
2521
|
+
}, e.JSBridge.prototype.init = function() {
|
|
2522
|
+
var e = this;
|
|
2523
|
+
window.sensorsdata_app_call_js.modules[this.type] || (window.sensorsdata_app_call_js.modules[this.type] = function(t) {
|
|
2524
|
+
e.app_call_js(t);
|
|
2525
|
+
});
|
|
2526
|
+
}, e.JSBridge.prototype.jsCallApp = function(r) {
|
|
2527
|
+
var a = {
|
|
2528
|
+
callType: this.type,
|
|
2529
|
+
data: r
|
|
2530
|
+
};
|
|
2531
|
+
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage) window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify(a));
|
|
2532
|
+
else {
|
|
2533
|
+
if (!t.isObject(window.SensorsData_APP_New_H5_Bridge) || !window.SensorsData_APP_New_H5_Bridge.sensorsdata_js_call_app) return e.log("数据发往App失败,App没有暴露bridge"), !1;
|
|
2534
|
+
window.SensorsData_APP_New_H5_Bridge.sensorsdata_js_call_app(JSON.stringify(a));
|
|
2535
|
+
}
|
|
2536
|
+
}, e.JSBridge.prototype.hasAppBridge = function() {
|
|
2537
|
+
return window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage ? "ios" : t.isObject(window.SensorsData_APP_New_H5_Bridge) && window.SensorsData_APP_New_H5_Bridge.sensorsdata_js_call_app ? "android" : (e.log("App端bridge未暴露"), !1);
|
|
2538
|
+
}, e.JSBridge.prototype.requestToApp = function(r) {
|
|
2539
|
+
var a = this, i = t.isObject(r.data) ? r.data : {};
|
|
2540
|
+
t.isFunction(r.callback) || (r.callback = function() {}), t.isObject(r.timeout) && t.isNumber(r.timeout.time) && (t.isFunction(r.timeout.callback) || (r.timeout.callback = function() {}), r.timer = setTimeout(function() {
|
|
2541
|
+
r.timeout.callback(), delete a.list[n];
|
|
2542
|
+
}, r.timeout.time));
|
|
2543
|
+
var n = (/* @__PURE__ */ new Date()).getTime().toString(16) + "-" + String(t.getRandom()).replace(".", "").slice(1, 8);
|
|
2544
|
+
this.list[n] = r;
|
|
2545
|
+
var s = {
|
|
2546
|
+
callType: this.type,
|
|
2547
|
+
data: i
|
|
2548
|
+
};
|
|
2549
|
+
if (s.data.message_id = n, window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.sensorsdataNativeTracker && window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage) window.webkit.messageHandlers.sensorsdataNativeTracker.postMessage(JSON.stringify(s));
|
|
2550
|
+
else {
|
|
2551
|
+
if (!t.isObject(window.SensorsData_APP_New_H5_Bridge) || !window.SensorsData_APP_New_H5_Bridge.sensorsdata_js_call_app) return e.log("数据发往App失败,App没有暴露bridge"), !1;
|
|
2552
|
+
window.SensorsData_APP_New_H5_Bridge.sensorsdata_js_call_app(JSON.stringify(s));
|
|
2553
|
+
}
|
|
2554
|
+
}, e.JSBridge.prototype.double = function(e) {
|
|
2555
|
+
if (e.message_id) {
|
|
2556
|
+
var t = this.list[e.message_id];
|
|
2557
|
+
t && (t.timer && clearTimeout(t.timer), t.callback(e), delete this.list[e.message_id]);
|
|
2558
|
+
}
|
|
2559
|
+
};
|
|
2560
|
+
var u = e.heatmap = {
|
|
2561
|
+
getElementPath: function(e, t) {
|
|
2562
|
+
for (var r = []; e.parentNode;) {
|
|
2563
|
+
if (e.id && !t && /^[A-Za-z][-A-Za-z0-9_:.]*$/.test(e.id)) {
|
|
2564
|
+
r.unshift(e.tagName.toLowerCase() + "#" + e.id);
|
|
2565
|
+
break;
|
|
2566
|
+
}
|
|
2567
|
+
if (e === document.body) {
|
|
2568
|
+
r.unshift("body");
|
|
2569
|
+
break;
|
|
2570
|
+
}
|
|
2571
|
+
r.unshift(e.tagName.toLowerCase()), e = e.parentNode;
|
|
2572
|
+
}
|
|
2573
|
+
return r.join(" > ");
|
|
2574
|
+
},
|
|
2575
|
+
getClosestLi: function(e) {
|
|
2576
|
+
return function(e, t) {
|
|
2577
|
+
for (; e && e !== document && 1 === e.nodeType; e = e.parentNode) if (e.tagName.toLowerCase() === t) return e;
|
|
2578
|
+
return null;
|
|
2579
|
+
}(e, "li");
|
|
2580
|
+
},
|
|
2581
|
+
getElementPosition: function(r, a, i) {
|
|
2582
|
+
var n = e.heatmap.getClosestLi(r);
|
|
2583
|
+
if (!n) return null;
|
|
2584
|
+
var s = r.tagName.toLowerCase(), o = n.getElementsByTagName(s), c = o.length, l = [];
|
|
2585
|
+
if (c > 1) {
|
|
2586
|
+
for (var u = 0; u < c; u++) e.heatmap.getElementPath(o[u], i) === a && l.push(o[u]);
|
|
2587
|
+
if (l.length > 1) return t.indexOf(l, r);
|
|
2588
|
+
}
|
|
2589
|
+
return function(e) {
|
|
2590
|
+
if (e.tagName.toLowerCase(), !e.parentNode) return "";
|
|
2591
|
+
if (1 === t.ry(e).getSameTypeSiblings().length) return 0;
|
|
2592
|
+
for (var r = 0, a = e; t.ry(a).previousElementSibling().ele; a = t.ry(a).previousElementSibling().ele, r++);
|
|
2593
|
+
return r;
|
|
2594
|
+
}(n);
|
|
2595
|
+
},
|
|
2596
|
+
setNotice: function(t) {
|
|
2597
|
+
e.is_heatmap_render_mode = !0, e.para.heatmap || (e.errorMsg = "您SDK没有配置开启点击图,可能没有数据!"), t && t[0] && t[1] && "http:" === t[1].slice(0, 5) && "https:" === location.protocol && (e.errorMsg = "您的当前页面是https的地址,神策分析环境也必须是https!"), e.para.heatmap_url || (e.para.heatmap_url = location.protocol + "//static.sensorsdata.cn/sdk/" + e.lib_version + "/heatmap.min.js");
|
|
2598
|
+
},
|
|
2599
|
+
getDomIndex: function(e) {
|
|
2600
|
+
if (!e.parentNode) return -1;
|
|
2601
|
+
for (var t = 0, r = e.tagName, a = e.parentNode.children, i = 0; i < a.length; i++) if (a[i].tagName === r) {
|
|
2602
|
+
if (e === a[i]) return t;
|
|
2603
|
+
t++;
|
|
2604
|
+
}
|
|
2605
|
+
return -1;
|
|
2606
|
+
},
|
|
2607
|
+
selector: function(t) {
|
|
2608
|
+
var r = t.parentNode && 9 == t.parentNode.nodeType ? -1 : this.getDomIndex(t);
|
|
2609
|
+
return t.getAttribute && t.getAttribute("id") && /^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")) && (!e.para.heatmap || e.para.heatmap && "not_use_id" !== e.para.heatmap.element_selector) ? "#" + t.getAttribute("id") : t.tagName.toLowerCase() + (~r ? ":nth-of-type(" + (r + 1) + ")" : "");
|
|
2610
|
+
},
|
|
2611
|
+
getDomSelector: function(t, r) {
|
|
2612
|
+
if (!t || !t.parentNode || !t.parentNode.children) return !1;
|
|
2613
|
+
r = r && r.join ? r : [];
|
|
2614
|
+
var a = t.nodeName.toLowerCase();
|
|
2615
|
+
return t && "body" !== a && 1 == t.nodeType ? (r.unshift(this.selector(t)), t.getAttribute && t.getAttribute("id") && /^[A-Za-z][-A-Za-z0-9_:.]*$/.test(t.getAttribute("id")) && e.para.heatmap && "not_use_id" !== e.para.heatmap.element_selector ? r.join(" > ") : this.getDomSelector(t.parentNode, r)) : (r.unshift("body"), r.join(" > "));
|
|
2616
|
+
},
|
|
2617
|
+
na: function() {
|
|
2618
|
+
var e = document.documentElement.scrollLeft || window.pageXOffset;
|
|
2619
|
+
return parseInt(isNaN(e) ? 0 : e, 10);
|
|
2620
|
+
},
|
|
2621
|
+
i: function() {
|
|
2622
|
+
var e = 0;
|
|
2623
|
+
try {
|
|
2624
|
+
e = o.documentElement && o.documentElement.scrollTop || m.pageYOffset, e = isNaN(e) ? 0 : e;
|
|
2625
|
+
} catch (t) {
|
|
2626
|
+
e = 0;
|
|
2627
|
+
}
|
|
2628
|
+
return parseInt(e, 10);
|
|
2629
|
+
},
|
|
2630
|
+
getBrowserWidth: function() {
|
|
2631
|
+
var e = window.innerWidth || document.body.clientWidth;
|
|
2632
|
+
return isNaN(e) ? 0 : parseInt(e, 10);
|
|
2633
|
+
},
|
|
2634
|
+
getBrowserHeight: function() {
|
|
2635
|
+
var e = window.innerHeight || document.body.clientHeight;
|
|
2636
|
+
return isNaN(e) ? 0 : parseInt(e, 10);
|
|
2637
|
+
},
|
|
2638
|
+
getScrollWidth: function() {
|
|
2639
|
+
var e = parseInt(document.body.scrollWidth, 10);
|
|
2640
|
+
return isNaN(e) ? 0 : e;
|
|
2641
|
+
},
|
|
2642
|
+
W: function(e) {
|
|
2643
|
+
var t = parseInt(+e.clientX + +this.na(), 10);
|
|
2644
|
+
e = parseInt(+e.clientY + +this.i(), 10);
|
|
2645
|
+
return {
|
|
2646
|
+
x: isNaN(t) ? 0 : t,
|
|
2647
|
+
y: isNaN(e) ? 0 : e
|
|
2648
|
+
};
|
|
2649
|
+
},
|
|
2650
|
+
start: function(r, a, i, n, s) {
|
|
2651
|
+
var o = t.isObject(n) ? n : {}, c = t.isFunction(s) ? s : t.isFunction(n) ? n : void 0;
|
|
2652
|
+
if (e.para.heatmap && e.para.heatmap.collect_element && !e.para.heatmap.collect_element(a)) return !1;
|
|
2653
|
+
var l = this.getDomSelector(a), u = t.getEleInfo({ target: a });
|
|
2654
|
+
u.$element_selector = l || "", u.$element_path = e.heatmap.getElementPath(a, e.para.heatmap && "not_use_id" === e.para.heatmap.element_selector);
|
|
2655
|
+
var d = e.heatmap.getElementPosition(a, u.$element_path, e.para.heatmap && "not_use_id" === e.para.heatmap.element_selector);
|
|
2656
|
+
if (t.isNumber(d) && (u.$element_position = d), e.para.heatmap && e.para.heatmap.custom_property) {
|
|
2657
|
+
var p = e.para.heatmap.custom_property(a);
|
|
2658
|
+
t.isObject(p) && (u = t.extend(u, p));
|
|
2659
|
+
}
|
|
2660
|
+
u = t.extend(u, o), "a" === i && e.para.heatmap && !0 === e.para.heatmap.isTrackLink ? t.trackLink({
|
|
2661
|
+
event: r,
|
|
2662
|
+
target: a
|
|
2663
|
+
}, "$WebClick", u) : e.track("$WebClick", u, c);
|
|
2664
|
+
},
|
|
2665
|
+
hasElement: function(e) {
|
|
2666
|
+
var r = e._getPath();
|
|
2667
|
+
if (t.isArray(r) && r.length > 0) {
|
|
2668
|
+
for (var a = 0; a < r.length; a++) if (r[a] && r[a].tagName && "a" === r[a].tagName.toLowerCase()) return r[a];
|
|
2669
|
+
}
|
|
2670
|
+
return !1;
|
|
2671
|
+
},
|
|
2672
|
+
isStyleTag: function(r, a) {
|
|
2673
|
+
return !(t.indexOf([
|
|
2674
|
+
"a",
|
|
2675
|
+
"div",
|
|
2676
|
+
"input",
|
|
2677
|
+
"button",
|
|
2678
|
+
"textarea"
|
|
2679
|
+
], r) > -1) && (!a || e.para.heatmap && e.para.heatmap.collect_tags && e.para.heatmap.collect_tags.div ? !!(t.isObject(e.para.heatmap) && t.isObject(e.para.heatmap.collect_tags) && t.isObject(e.para.heatmap.collect_tags.div) && t.indexOf(e.para.heatmap.collect_tags.div.ignore_tags, r) > -1) : t.indexOf([
|
|
2680
|
+
"mark",
|
|
2681
|
+
"/mark",
|
|
2682
|
+
"strong",
|
|
2683
|
+
"b",
|
|
2684
|
+
"em",
|
|
2685
|
+
"i",
|
|
2686
|
+
"u",
|
|
2687
|
+
"abbr",
|
|
2688
|
+
"ins",
|
|
2689
|
+
"del",
|
|
2690
|
+
"s",
|
|
2691
|
+
"sup"
|
|
2692
|
+
], r) > -1);
|
|
2693
|
+
},
|
|
2694
|
+
isCollectableDiv: function(t, r) {
|
|
2695
|
+
try {
|
|
2696
|
+
if (0 === t.children.length) return !0;
|
|
2697
|
+
for (var a = 0; a < t.children.length; a++) if (1 === t.children[a].nodeType) {
|
|
2698
|
+
var i = t.children[a].tagName.toLowerCase();
|
|
2699
|
+
if (!this.isStyleTag(i, r)) return !1;
|
|
2700
|
+
if (!this.isCollectableDiv(t.children[a], r)) return !1;
|
|
2701
|
+
}
|
|
2702
|
+
return !0;
|
|
2703
|
+
} catch (n) {
|
|
2704
|
+
e.log(n);
|
|
2705
|
+
}
|
|
2706
|
+
return !1;
|
|
2707
|
+
},
|
|
2708
|
+
getCollectableParent: function(t, r) {
|
|
2709
|
+
try {
|
|
2710
|
+
var a = t.parentNode, i = a ? a.tagName.toLowerCase() : "";
|
|
2711
|
+
if ("body" === i) return !1;
|
|
2712
|
+
if (i && "div" === i && this.isCollectableDiv(a, r)) return a;
|
|
2713
|
+
if (a && this.isStyleTag(i, r)) return this.getCollectableParent(a, r);
|
|
2714
|
+
} catch (n) {
|
|
2715
|
+
e.log(n);
|
|
2716
|
+
}
|
|
2717
|
+
return !1;
|
|
2718
|
+
},
|
|
2719
|
+
initScrollmap: function() {
|
|
2720
|
+
if (!t.isObject(e.para.heatmap) || "default" !== e.para.heatmap.scroll_notice_map) return !1;
|
|
2721
|
+
var r = function() {
|
|
2722
|
+
return !(e.para.scrollmap && t.isFunction(e.para.scrollmap.collect_url) && !e.para.scrollmap.collect_url());
|
|
2723
|
+
}, a = function(e) {
|
|
2724
|
+
var t = {};
|
|
2725
|
+
return t.timeout = e.timeout || 1e3, t.func = e.func, t.hasInit = !1, t.inter = null, t.main = function(e, t) {
|
|
2726
|
+
this.func(e, t), this.inter = null;
|
|
2727
|
+
}, t.go = function(e) {
|
|
2728
|
+
var r = {};
|
|
2729
|
+
this.inter || (r.$viewport_position = document.documentElement && document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0, r.$viewport_position = Math.round(r.$viewport_position) || 0, r.$viewport_height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0, r.$viewport_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0, e ? t.main(r, !0) : this.inter = setTimeout(function() {
|
|
2730
|
+
t.main(r);
|
|
2731
|
+
}, this.timeout));
|
|
2732
|
+
}, t;
|
|
2733
|
+
}({
|
|
2734
|
+
timeout: 1e3,
|
|
2735
|
+
func: function(r, a) {
|
|
2736
|
+
var i = document.documentElement && document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0, n = /* @__PURE__ */ new Date(), s = n - this.current_time;
|
|
2737
|
+
(s > e.para.heatmap.scroll_delay_time && i - r.$viewport_position != 0 || a) && (r.$url = t.isDecodeURI(e.para.url_is_decode, location.href), r.$title = document.title, r.$url_path = location.pathname, r.event_duration = Math.min(e.para.heatmap.scroll_event_duration, parseInt(s) / 1e3), e.track("$WebStay", r)), this.current_time = n;
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
a.current_time = /* @__PURE__ */ new Date(), t.addEvent(window, "scroll", function() {
|
|
2741
|
+
if (!r()) return !1;
|
|
2742
|
+
a.go();
|
|
2743
|
+
}), t.addEvent(window, "unload", function() {
|
|
2744
|
+
if (!r()) return !1;
|
|
2745
|
+
a.go("notime");
|
|
2746
|
+
});
|
|
2747
|
+
},
|
|
2748
|
+
initHeatmap: function() {
|
|
2749
|
+
var r = this;
|
|
2750
|
+
return !(!t.isObject(e.para.heatmap) || "default" !== e.para.heatmap.clickmap) && !(t.isFunction(e.para.heatmap.collect_url) && !e.para.heatmap.collect_url()) && ("all" === e.para.heatmap.collect_elements ? e.para.heatmap.collect_elements = "all" : e.para.heatmap.collect_elements = "interact", void ("all" === e.para.heatmap.collect_elements ? t.addEvent(document, "click", function(e) {
|
|
2751
|
+
var t = e || window.event;
|
|
2752
|
+
if (!t) return !1;
|
|
2753
|
+
var a = t.target || t.srcElement;
|
|
2754
|
+
if ("object" != typeof a) return !1;
|
|
2755
|
+
if ("string" != typeof a.tagName) return !1;
|
|
2756
|
+
var i = a.tagName.toLowerCase();
|
|
2757
|
+
if ("body" === i || "html" === i) return !1;
|
|
2758
|
+
if (!a || !a.parentNode || !a.parentNode.children) return !1;
|
|
2759
|
+
var n = a.parentNode.tagName.toLowerCase();
|
|
2760
|
+
"a" === n || "button" === n ? r.start(t, a.parentNode, n) : r.start(t, a, i);
|
|
2761
|
+
}) : t.addEvent(document, "click", function(a) {
|
|
2762
|
+
var i = a || window.event;
|
|
2763
|
+
if (!i) return !1;
|
|
2764
|
+
var n = i.target || i.srcElement;
|
|
2765
|
+
if ("object" != typeof n) return !1;
|
|
2766
|
+
if ("string" != typeof n.tagName) return !1;
|
|
2767
|
+
var s = n.tagName.toLowerCase();
|
|
2768
|
+
if ("body" === s.toLowerCase() || "html" === s.toLowerCase()) return !1;
|
|
2769
|
+
if (!n || !n.parentNode || !n.parentNode.children) return !1;
|
|
2770
|
+
var o = n.parentNode, c = r.hasElement(a), l = e.para.heatmap.track_attr;
|
|
2771
|
+
if ("a" === s || "button" === s || "input" === s || "textarea" === s || t.hasAttributes(n, l)) r.start(i, n, s);
|
|
2772
|
+
else if ("button" === o.tagName.toLowerCase() || "a" === o.tagName.toLowerCase() || t.hasAttributes(o, l)) r.start(i, o, n.parentNode.tagName.toLowerCase());
|
|
2773
|
+
else if ("area" === s && "map" === o.tagName.toLowerCase() && t.ry(o).prev().tagName && "img" === t.ry(o).prev().tagName.toLowerCase()) r.start(i, t.ry(o).prev(), t.ry(o).prev().tagName.toLowerCase());
|
|
2774
|
+
else if (c) r.start(i, c, c.tagName.toLowerCase());
|
|
2775
|
+
else if ("div" === s && e.para.heatmap.collect_tags.div && r.isCollectableDiv(n)) r.start(i, n, s);
|
|
2776
|
+
else if (r.isStyleTag(s) && e.para.heatmap.collect_tags.div) {
|
|
2777
|
+
var u = r.getCollectableParent(n);
|
|
2778
|
+
u && r.start(i, u, "div");
|
|
2779
|
+
}
|
|
2780
|
+
})));
|
|
2781
|
+
}
|
|
2782
|
+
};
|
|
2783
|
+
e.init = function(t) {
|
|
2784
|
+
if (e.readyState && e.readyState.state && e.readyState.state >= 2) return !1;
|
|
2785
|
+
e.setInitVar(), e.readyState.setState(2), e.initPara(t), e.bridge.supportAppCallJs(), e.detectMode(), e._.isIOS() && e._.getIOSVersion() && e._.getIOSVersion() < 13 && (e.para.heatmap && e.para.heatmap.collect_tags && e.para.heatmap.collect_tags.div && e._.setCssStyle("div, [data-sensors-click] { cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0); }"), e.para.heatmap && e.para.heatmap.track_attr && e._.setCssStyle("[" + e.para.heatmap.track_attr.join("], [") + "] { cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0); }"));
|
|
2786
|
+
};
|
|
2787
|
+
if (t.each([
|
|
2788
|
+
"getAppStatus",
|
|
2789
|
+
"track",
|
|
2790
|
+
"quick",
|
|
2791
|
+
"register",
|
|
2792
|
+
"registerPage",
|
|
2793
|
+
"registerOnce",
|
|
2794
|
+
"trackSignup",
|
|
2795
|
+
"setProfile",
|
|
2796
|
+
"setOnceProfile",
|
|
2797
|
+
"appendProfile",
|
|
2798
|
+
"incrementProfile",
|
|
2799
|
+
"deleteProfile",
|
|
2800
|
+
"unsetProfile",
|
|
2801
|
+
"identify",
|
|
2802
|
+
"login",
|
|
2803
|
+
"logout",
|
|
2804
|
+
"trackLink",
|
|
2805
|
+
"clearAllRegister",
|
|
2806
|
+
"clearPageRegister"
|
|
2807
|
+
], function(r) {
|
|
2808
|
+
var a = e[r];
|
|
2809
|
+
e[r] = function() {
|
|
2810
|
+
if (e.readyState.state < 3) return t.isArray(e._q) || (e._q = []), e._q.push([r, arguments]), !1;
|
|
2811
|
+
if (e.readyState.getState()) return a.apply(e, arguments);
|
|
2812
|
+
try {
|
|
2813
|
+
console.error("请先初始化神策JS SDK");
|
|
2814
|
+
} catch (i) {
|
|
2815
|
+
e.log(i);
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
}), e.modules.Amp = function() {
|
|
2819
|
+
"use strict";
|
|
2820
|
+
var e = {
|
|
2821
|
+
sd: null,
|
|
2822
|
+
init: function(e) {
|
|
2823
|
+
if (this.sd) return !1;
|
|
2824
|
+
if (this.sd = e, !this.sd || !this.sd._) return !1;
|
|
2825
|
+
var t = this.sd._.cookie.get("sensors_amp_id"), r = this.sd.store._state.distinct_id;
|
|
2826
|
+
if (t && t.length > 0) {
|
|
2827
|
+
var a = "amp-" === t.slice(0, 4);
|
|
2828
|
+
if (t !== r) {
|
|
2829
|
+
if (!a) return !1;
|
|
2830
|
+
this.sd.store._state.first_id ? (this.sd.identify(t, !0), this.sd.saEvent.send({
|
|
2831
|
+
original_id: t,
|
|
2832
|
+
distinct_id: r,
|
|
2833
|
+
type: "track_signup",
|
|
2834
|
+
event: "$SignUp",
|
|
2835
|
+
properties: {}
|
|
2836
|
+
}, null), this.setAmpId(r)) : this.sd.identify(t, !0);
|
|
2837
|
+
}
|
|
2838
|
+
} else this.setAmpId(r);
|
|
2839
|
+
this.addListener();
|
|
2840
|
+
},
|
|
2841
|
+
addListener: function() {
|
|
2842
|
+
var e = this;
|
|
2843
|
+
this.sd.events.on("changeDistinctId", function(t) {
|
|
2844
|
+
e.setAmpId(t);
|
|
2845
|
+
}), this.sd.events.isReady();
|
|
2846
|
+
},
|
|
2847
|
+
setAmpId: function(e) {
|
|
2848
|
+
this.sd._.cookie.set("sensors_amp_id", e);
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
return window.SensorsDataWebJSSDKPlugin && "[object Object]" === Object.prototype.toString.call(window.SensorsDataWebJSSDKPlugin) ? window.SensorsDataWebJSSDKPlugin.Amp = window.SensorsDataWebJSSDKPlugin.Amp || e : window.SensorsDataWebJSSDKPlugin = { Amp: e }, e;
|
|
2852
|
+
}(), e.modules.Channel = function() {
|
|
2853
|
+
"use strict";
|
|
2854
|
+
var e, t, r = {
|
|
2855
|
+
event_list: [],
|
|
2856
|
+
latest_event_initial_time: null,
|
|
2857
|
+
max_save_time: 2592e6,
|
|
2858
|
+
init: function(r) {
|
|
2859
|
+
return !t && !!(t = r) && !!(e = t._).localStorage.isSupport() && (t.para.max_string_length = 1024, this.eventList.init(), this.addLatestChannelUrl(), void this.addIsChannelCallbackEvent());
|
|
2860
|
+
},
|
|
2861
|
+
addIsChannelCallbackEvent: function() {
|
|
2862
|
+
t.registerPage({ $is_channel_callback_event: function(e) {
|
|
2863
|
+
if (e.event && "$WebClick" !== e.event && "$pageview" !== e.event && "$WebStay" !== e.event && "$SignUp" !== e.event) return !r.eventList.hasEvent(e.event) && (r.eventList.add(e.event), !0);
|
|
2864
|
+
} });
|
|
2865
|
+
},
|
|
2866
|
+
addLatestChannelUrl: function() {
|
|
2867
|
+
var a = this.getUrlDomain(), i = this.cookie.getChannel();
|
|
2868
|
+
if ("url解析失败" === a) this.registerAndSave({
|
|
2869
|
+
_sa_channel_landing_url: "",
|
|
2870
|
+
_sa_channel_landing_url_error: "url的domain解析失败"
|
|
2871
|
+
});
|
|
2872
|
+
else if (e.isReferralTraffic(document.referrer)) {
|
|
2873
|
+
var n = e.getQueryParam(location.href, "sat_cf");
|
|
2874
|
+
e.isString(n) && n.length > 0 ? (this.registerAndSave({ _sa_channel_landing_url: location.href }), r.channelLinkHandler()) : this.registerAndSave({ _sa_channel_landing_url: "" });
|
|
2875
|
+
} else i ? t.registerPage(i) : t.registerPage({
|
|
2876
|
+
_sa_channel_landing_url: "",
|
|
2877
|
+
_sa_channel_landing_url_error: "取值异常"
|
|
2878
|
+
});
|
|
2879
|
+
},
|
|
2880
|
+
registerAndSave: function(e) {
|
|
2881
|
+
t.registerPage(e), this.cookie.saveChannel(e);
|
|
2882
|
+
},
|
|
2883
|
+
cookie: {
|
|
2884
|
+
getChannel: function() {
|
|
2885
|
+
var r;
|
|
2886
|
+
try {
|
|
2887
|
+
r = JSON.parse(e.cookie.get("sensorsdata2015jssdkchannel"));
|
|
2888
|
+
} catch (a) {
|
|
2889
|
+
t.log(a);
|
|
2890
|
+
}
|
|
2891
|
+
return !(!e.isObject(r) || !r.prop) && r.prop;
|
|
2892
|
+
},
|
|
2893
|
+
saveChannel: function(t) {
|
|
2894
|
+
var r = { prop: t };
|
|
2895
|
+
e.cookie.set("sensorsdata2015jssdkchannel", JSON.stringify(r));
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
channelLinkHandler: function() {
|
|
2899
|
+
this.eventList.reset(), t.track("$ChannelLinkReaching");
|
|
2900
|
+
},
|
|
2901
|
+
getUrlDomain: function() {
|
|
2902
|
+
var t = e.info.pageProp.url_domain;
|
|
2903
|
+
return "" === t && (t = "url解析失败"), t;
|
|
2904
|
+
},
|
|
2905
|
+
eventList: {
|
|
2906
|
+
init: function() {
|
|
2907
|
+
var t = this.get(), a = (/* @__PURE__ */ new Date()).getTime();
|
|
2908
|
+
if (t && e.isNumber(t.latest_event_initial_time) && e.isArray(t.eventList)) {
|
|
2909
|
+
var i = a - t.latest_event_initial_time;
|
|
2910
|
+
i > 0 && i < r.max_save_time ? (r.event_list = t.eventList, r.latest_event_initial_time = t.latest_event_initial_time) : this.reset();
|
|
2911
|
+
} else this.reset();
|
|
2912
|
+
},
|
|
2913
|
+
get: function() {
|
|
2914
|
+
var r = {};
|
|
2915
|
+
try {
|
|
2916
|
+
r = JSON.parse(e.localStorage.get("sawebjssdkchannel"));
|
|
2917
|
+
} catch (a) {
|
|
2918
|
+
t.log(a);
|
|
2919
|
+
}
|
|
2920
|
+
return r;
|
|
2921
|
+
},
|
|
2922
|
+
add: function(e) {
|
|
2923
|
+
r.event_list.push(e), this.save();
|
|
2924
|
+
},
|
|
2925
|
+
save: function() {
|
|
2926
|
+
var t = {
|
|
2927
|
+
latest_event_initial_time: r.latest_event_initial_time,
|
|
2928
|
+
eventList: r.event_list
|
|
2929
|
+
};
|
|
2930
|
+
e.localStorage.set("sawebjssdkchannel", JSON.stringify(t));
|
|
2931
|
+
},
|
|
2932
|
+
reset: function() {
|
|
2933
|
+
r.event_list = [], r.latest_event_initial_time = (/* @__PURE__ */ new Date()).getTime(), this.save();
|
|
2934
|
+
},
|
|
2935
|
+
hasEvent: function(t) {
|
|
2936
|
+
var a = !1;
|
|
2937
|
+
return e.each(r.event_list, function(e) {
|
|
2938
|
+
e === t && (a = !0);
|
|
2939
|
+
}), a;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
};
|
|
2943
|
+
return window.SensorsDataWebJSSDKPlugin && "[object Object]" === Object.prototype.toString.call(window.SensorsDataWebJSSDKPlugin) ? window.SensorsDataWebJSSDKPlugin.SensorsChannel = window.SensorsDataWebJSSDKPlugin.SensorsChannel || r : window.SensorsDataWebJSSDKPlugin = { SensorsChannel: r }, r;
|
|
2944
|
+
}(), e.modules.Deeplink = function() {
|
|
2945
|
+
"use strict";
|
|
2946
|
+
/micromessenger\/([\d.]+)/i.test(navigator.userAgent || "");
|
|
2947
|
+
var e, t = function() {
|
|
2948
|
+
var e = {};
|
|
2949
|
+
return "undefined" != typeof document.hidden ? (e.hidden = "hidden", e.visibilityChange = "visibilitychange") : "undefined" != typeof document.msHidden ? (e.hidden = "msHidden", e.visibilityChange = "msvisibilitychange") : "undefined" != typeof document.webkitHidden && (e.hidden = "webkitHidden", e.visibilityChange = "webkitvisibilitychange"), e;
|
|
2950
|
+
};
|
|
2951
|
+
function r() {
|
|
2952
|
+
return void 0 !== e && document[e];
|
|
2953
|
+
}
|
|
2954
|
+
e = t().hidden;
|
|
2955
|
+
var a = {
|
|
2956
|
+
android: /Android/i,
|
|
2957
|
+
iOS: /iPhone|iPad|iPod/i
|
|
2958
|
+
}, i = function() {
|
|
2959
|
+
for (var e in a) if (navigator.userAgent.match(a[e])) return e;
|
|
2960
|
+
return "";
|
|
2961
|
+
}(), n = function(e) {
|
|
2962
|
+
return null != e && "[object Object]" == Object.prototype.toString.call(e);
|
|
2963
|
+
}, s = {
|
|
2964
|
+
key: null,
|
|
2965
|
+
timer: null,
|
|
2966
|
+
sd: null,
|
|
2967
|
+
data: null,
|
|
2968
|
+
timeout: 2500,
|
|
2969
|
+
apiURL: "{origin}/sdk/deeplink/param?key={key}&system_type=JS&project={project}",
|
|
2970
|
+
init: function() {
|
|
2971
|
+
if (this.sd) return this.log("deeplink已经初始化"), !1;
|
|
2972
|
+
if (n(sensorsDataAnalytic201505) && (this.sd = sensorsDataAnalytic201505), this.log("init()"), null === this.sd) return this.log("神策JS SDK未成功引入"), !1;
|
|
2973
|
+
var e = {};
|
|
2974
|
+
if (arguments.length > 0 && (1 === arguments.length && n(arguments[0]) ? e = arguments[0] : arguments.length >= 2 && n(arguments[1]) && (e = arguments[1])), !a.hasOwnProperty(i)) return this.log("不支持当前系统,目前只支持Android和iOS"), !1;
|
|
2975
|
+
if (n(e) && this.sd._.isNumber(e.timeout) && e.timeout >= 2500 && (this.timeout = e.timeout), !this.sd.para.server_url) return this.log("神策JS SDK配置项server_url未正确配置"), !1;
|
|
2976
|
+
var t, r, o = (t = this.sd, {
|
|
2977
|
+
origin: (r = t._.URL(t.para.server_url)).origin,
|
|
2978
|
+
project: r.searchParams.get("project") || "default"
|
|
2979
|
+
});
|
|
2980
|
+
this.apiURL = this.apiURL.replace("{origin}", o.origin).replace("{project}", o.project);
|
|
2981
|
+
var c = this.sd._.URL(window.location.href).searchParams.get("deeplink");
|
|
2982
|
+
if (!c) return this.log("当前页面缺少deeplink参数"), !1;
|
|
2983
|
+
c = window.decodeURIComponent(c);
|
|
2984
|
+
var l = c.match(/\/sd\/(\w+)\/(\w+)$/);
|
|
2985
|
+
if (!l) return this.log("当前页面的deeplink参数无效"), !1;
|
|
2986
|
+
this.key = l[2], this.apiURL = this.apiURL.replace("{key}", window.encodeURIComponent(l[2])), this.sd._.ajax({
|
|
2987
|
+
url: this.apiURL,
|
|
2988
|
+
type: "GET",
|
|
2989
|
+
cors: !0,
|
|
2990
|
+
credentials: !1,
|
|
2991
|
+
success: function(e) {
|
|
2992
|
+
if (e.errorMsg) return s.log("API报错:" + e.errorMsg), !1;
|
|
2993
|
+
s.data = e, s.log("API查询成功,数据:" + JSON.stringify(e, null, " ")), this.data.app_key && (this.data.android_info && this.data.android_info.url_schemes && (this.data.android_info.url_schemes += "://sensorsdata/sd/" + this.data.app_key + "/" + this.key), this.data.ios_info && this.data.ios_info.url_schemes && (this.data.ios_info.url_schemes += "://sensorsdata/sd/" + this.data.app_key + "/" + this.key));
|
|
2994
|
+
}.bind(this),
|
|
2995
|
+
error: function(e) {
|
|
2996
|
+
s.log("API查询出错");
|
|
2997
|
+
}
|
|
2998
|
+
}), this.addListeners();
|
|
2999
|
+
},
|
|
3000
|
+
openDeepLink: function() {
|
|
3001
|
+
if (this.log("openDeeplink()"), !this.data) return this.log("没有Deep link数据!"), !1;
|
|
3002
|
+
if ("iOS" === i) {
|
|
3003
|
+
this.log("当前系统是iOS");
|
|
3004
|
+
var t = this.sd && this.sd._ && this.sd._.getIOSVersion() >= 9 && this.data.ios_info.ios_wake_url ? this.data.ios_info.ios_wake_url : this.data.ios_info.url_schemes;
|
|
3005
|
+
this.log("唤起APP的地址:" + t), a = this, n = t, s = this.data.ios_info.download_url, a.log("尝试唤起 iOS app:" + n), window.location.href = n, a.timer = setTimeout(function() {
|
|
3006
|
+
if (r()) return a.log("The page is hidden, stop navigating to download page"), !1;
|
|
3007
|
+
a.log("App可能未安装,跳转到下载地址"), window.location.href = s;
|
|
3008
|
+
}, a.timeout), a.log("new timer:" + a.timer);
|
|
3009
|
+
} else this.log("当前系统是 android"), function(t, a, i) {
|
|
3010
|
+
t.log("尝试唤起 android app");
|
|
3011
|
+
var n = a;
|
|
3012
|
+
t.log("唤起APP的地址:" + n), window.location = n, t.timer = setTimeout(function() {
|
|
3013
|
+
var a = r();
|
|
3014
|
+
if (t.log("hide:" + e + ":" + document[e]), a) return t.log("The page is hidden, stop navigating to download page"), !1;
|
|
3015
|
+
t.log("App可能未安装,跳转到下载地址"), window.location = i;
|
|
3016
|
+
}, t.timeout);
|
|
3017
|
+
}(this, this.data.android_info.url_schemes, this.data.android_info.download_url);
|
|
3018
|
+
var a, n, s;
|
|
3019
|
+
},
|
|
3020
|
+
log: function(e) {
|
|
3021
|
+
this.sd && this.sd.log(e);
|
|
3022
|
+
},
|
|
3023
|
+
addListeners: function() {
|
|
3024
|
+
var e = t().visibilityChange;
|
|
3025
|
+
e && document.addEventListener(e, function() {
|
|
3026
|
+
clearTimeout(this.timer), this.log("visibilitychange, clear timeout:" + this.timer);
|
|
3027
|
+
}.bind(this), !1), window.addEventListener("pagehide", function() {
|
|
3028
|
+
this.log("page hide, clear timeout:" + this.timer), clearTimeout(this.timer);
|
|
3029
|
+
}.bind(this), !1);
|
|
3030
|
+
}
|
|
3031
|
+
};
|
|
3032
|
+
return n(window.SensorsDataWebJSSDKPlugin) ? (window.SensorsDataWebJSSDKPlugin.Deeplink = window.SensorsDataWebJSSDKPlugin.Deeplink || s, window.SensorsDataWebJSSDKPlugin.deeplink = window.SensorsDataWebJSSDKPlugin.deeplink || s) : window.SensorsDataWebJSSDKPlugin = {
|
|
3033
|
+
Deeplink: s,
|
|
3034
|
+
deeplink: s
|
|
3035
|
+
}, s;
|
|
3036
|
+
}(), e.modules.SiteLinker = function() {
|
|
3037
|
+
"use strict";
|
|
3038
|
+
var e = {
|
|
3039
|
+
getPart: function(e) {
|
|
3040
|
+
var t = this.option.length;
|
|
3041
|
+
if (t) {
|
|
3042
|
+
for (var r = 0; r < t; r++) if (e.indexOf(this.option[r].part_url) > -1) return !0;
|
|
3043
|
+
}
|
|
3044
|
+
return !1;
|
|
3045
|
+
},
|
|
3046
|
+
getPartHash: function(e) {
|
|
3047
|
+
var t = this.option.length;
|
|
3048
|
+
if (t) {
|
|
3049
|
+
for (var r = 0; r < t; r++) if (e.indexOf(this.option[r].part_url) > -1) return this.option[r].after_hash;
|
|
3050
|
+
}
|
|
3051
|
+
return !1;
|
|
3052
|
+
},
|
|
3053
|
+
getCurrenId: function() {
|
|
3054
|
+
var e = this.store.getDistinctId() || "", r = this.store.getFirstId() || "";
|
|
3055
|
+
return this._.urlSafeBase64 && this._.urlSafeBase64.encode ? e = e ? this._.urlSafeBase64.trim(this._.urlSafeBase64.encode(t.base64Encode(e))) : "" : this._.rot13obfs && (e = e ? this._.rot13obfs(e) : ""), encodeURIComponent(r ? "f" + e : "d" + e);
|
|
3056
|
+
},
|
|
3057
|
+
rewireteUrl: function(e, t) {
|
|
3058
|
+
var r = /([^?#]+)(\?[^#]*)?(#.*)?/.exec(e), a = "";
|
|
3059
|
+
if (r) {
|
|
3060
|
+
var i, n = r[1] || "", s = r[2] || "", o = r[3] || "";
|
|
3061
|
+
if (this.getPartHash(e)) i = o.indexOf("_sasdk"), a = o.indexOf("?") > -1 ? i > -1 ? n + s + "#" + o.substring(1, i) + "_sasdk=" + this.getCurrenId() : n + s + "#" + o.substring(1) + "&_sasdk=" + this.getCurrenId() : n + s + "#" + o.substring(1) + "?_sasdk=" + this.getCurrenId();
|
|
3062
|
+
else i = s.indexOf("_sasdk"), a = /^\?(\w)+/.test(s) ? i > -1 ? n + "?" + s.substring(1, i) + "_sasdk=" + this.getCurrenId() + o : n + "?" + s.substring(1) + "&_sasdk=" + this.getCurrenId() + o : n + "?" + s.substring(1) + "_sasdk=" + this.getCurrenId() + o;
|
|
3063
|
+
return t && (t.href = a), a;
|
|
3064
|
+
}
|
|
3065
|
+
},
|
|
3066
|
+
getUrlId: function() {
|
|
3067
|
+
var e = location.href.match(/_sasdk=([aufd][^\?\#\&\=]+)/);
|
|
3068
|
+
if (this._.isArray(e) && e[1]) {
|
|
3069
|
+
var r = decodeURIComponent(e[1]);
|
|
3070
|
+
return !r || "f" !== r.substring(0, 1) && "d" !== r.substring(0, 1) || (this._.urlSafeBase64 && this._.urlSafeBase64.isUrlSafeBase64 && this._.urlSafeBase64.isUrlSafeBase64(r) ? r = r.substring(0, 1) + t.base64Decode(this._.urlSafeBase64.decode(r.substring(1))) : this._.rot13defs && (r = r.substring(0, 1) + this._.rot13defs(r.substring(1)))), r;
|
|
3071
|
+
}
|
|
3072
|
+
return "";
|
|
3073
|
+
},
|
|
3074
|
+
setRefferId: function() {
|
|
3075
|
+
var e = this.store.getDistinctId(), t = this.getUrlId();
|
|
3076
|
+
if ("" === t) return !1;
|
|
3077
|
+
var r = "a" === t.substring(0, 1) || "d" === t.substring(0, 1);
|
|
3078
|
+
if ((t = t.substring(1)) === e) return !1;
|
|
3079
|
+
t && r && this.store.getFirstId() && (this.sd.identify(t, !0), this.sd.saEvent.send({
|
|
3080
|
+
original_id: t,
|
|
3081
|
+
distinct_id: e,
|
|
3082
|
+
type: "track_signup",
|
|
3083
|
+
event: "$SignUp",
|
|
3084
|
+
properties: {}
|
|
3085
|
+
}, null)), t && r && !this.store.getFirstId() && this.sd.identify(t, !0), !t || r || this.store.getFirstId() || this.sd.login(t);
|
|
3086
|
+
},
|
|
3087
|
+
addListen: function() {
|
|
3088
|
+
var e = this, t = function(t) {
|
|
3089
|
+
var r, a, i = t.target, n = i.tagName.toLowerCase(), s = i.parentNode;
|
|
3090
|
+
if ("a" === n && i.href || s && s.tagName && "a" === s.tagName.toLowerCase() && s.href) {
|
|
3091
|
+
"a" === n && i.href ? (r = i.href, a = i) : (r = s.href, a = s);
|
|
3092
|
+
var o = e._.URL(r).protocol;
|
|
3093
|
+
"http:" !== o && "https:" !== o || e.getPart(r) && e.rewireteUrl(r, a);
|
|
3094
|
+
}
|
|
3095
|
+
};
|
|
3096
|
+
e._.addEvent(document, "mousedown", t), window.PointerEvent && "maxTouchPoints" in window.navigator && window.navigator.maxTouchPoints >= 0 && e._.addEvent(document, "pointerdown", t);
|
|
3097
|
+
},
|
|
3098
|
+
init: function(e, t) {
|
|
3099
|
+
this.sd = e, this._ = e._, this.store = e.store, this.para = e.para, this._.isObject(t) && this._.isArray(t.linker) && t.linker.length > 0 ? (this.setRefferId(), this.addListen(), this.option = t.linker, this.option = function(t) {
|
|
3100
|
+
for (var r = t.length, a = [], i = 0; i < r; i++) /[A-Za-z0-9]+\./.test(t[i].part_url) && "[object Boolean]" == Object.prototype.toString.call(t[i].after_hash) ? a.push(t[i]) : e.log("linker 配置的第 " + (i + 1) + " 项格式不正确,请检查参数格式!");
|
|
3101
|
+
return a;
|
|
3102
|
+
}(this.option)) : e.log("请配置打通域名参数!");
|
|
3103
|
+
}
|
|
3104
|
+
};
|
|
3105
|
+
return t.isObject(window.SensorsDataWebJSSDKPlugin) ? window.SensorsDataWebJSSDKPlugin.SiteLinker = window.SensorsDataWebJSSDKPlugin.SiteLinker || e : window.SensorsDataWebJSSDKPlugin = { SiteLinker: e }, e;
|
|
3106
|
+
}(), "string" != typeof window.sensorsDataAnalytic201505) return "undefined" == typeof window.sensorsDataAnalytic201505 ? (window.sensorsDataAnalytic201505 = e, e) : window.sensorsDataAnalytic201505;
|
|
3107
|
+
e.setPreConfig(window[sensorsDataAnalytic201505]), window[sensorsDataAnalytic201505] = e, window.sensorsDataAnalytic201505 = e, e.init();
|
|
3108
|
+
} catch (O) {
|
|
3109
|
+
if ("object" == typeof console && console.log) try {
|
|
3110
|
+
console.log(O);
|
|
3111
|
+
} catch (D) {
|
|
3112
|
+
e.log(D);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
var d, p, f, _, g, h, v, y, S, w, b, k, j, P;
|
|
3116
|
+
});
|
|
3117
|
+
})))(), 1);
|
|
3118
|
+
const SENSORS_SERVER_URL = "https://sensorsapi.hqchip.com/sa?project=eda";
|
|
3119
|
+
function trackLogin(analytics, uid) {
|
|
3120
|
+
analytics.login(uid);
|
|
3121
|
+
analytics.track("login", { uid });
|
|
3122
|
+
}
|
|
3123
|
+
function resolveReqSource(hostMode, targetHost) {
|
|
3124
|
+
if (!hostMode) return "website";
|
|
3125
|
+
return targetHost === "hq-eda" ? "huaqiu_eda_desktop" : "kicad";
|
|
3126
|
+
}
|
|
3127
|
+
function createAnalytics(sensors, host) {
|
|
3128
|
+
sensors.init({
|
|
3129
|
+
server_url: SENSORS_SERVER_URL,
|
|
3130
|
+
heatmap: { scroll_notice_map: "not_collect" },
|
|
3131
|
+
use_client_time: true,
|
|
3132
|
+
send_type: "beacon",
|
|
3133
|
+
show_log: true
|
|
3134
|
+
});
|
|
3135
|
+
sensors.register({
|
|
3136
|
+
env: "prod",
|
|
3137
|
+
project: "dsh_copilot",
|
|
3138
|
+
req_source: resolveReqSource(host.hostMode, host.targetHost)
|
|
3139
|
+
});
|
|
3140
|
+
sensors.quick("autoTrack");
|
|
3141
|
+
return {
|
|
3142
|
+
track: (event, properties) => {
|
|
3143
|
+
sensors.track(event, properties);
|
|
3144
|
+
},
|
|
3145
|
+
login: (userId) => {
|
|
3146
|
+
sensors.login(userId);
|
|
3147
|
+
}
|
|
3148
|
+
};
|
|
3149
|
+
}
|
|
3150
|
+
//#endregion
|
|
3151
|
+
//#region src/client/index.ts
|
|
3152
|
+
const inject = [];
|
|
3153
|
+
const POLL_INTERVAL_MS = 1e3;
|
|
3154
|
+
async function resolveHostMode() {
|
|
3155
|
+
try {
|
|
3156
|
+
const response = await fetch("/api/v1/huaqiu/auth/config", { headers: { accept: "application/json" } });
|
|
3157
|
+
if (!response.ok) return false;
|
|
3158
|
+
return (await response.json()).hostMode === true;
|
|
3159
|
+
} catch {
|
|
3160
|
+
return false;
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
async function drainNodeEvents(analytics) {
|
|
3164
|
+
try {
|
|
3165
|
+
const response = await fetch("/api/v1/huaqiu/analytics/events", { headers: { accept: "application/json" } });
|
|
3166
|
+
if (!response.ok) return;
|
|
3167
|
+
const body = await response.json();
|
|
3168
|
+
for (const item of body.events ?? []) if (typeof item?.event === "string" && item.event.length > 0) analytics.track(item.event, item.properties);
|
|
3169
|
+
} catch {}
|
|
3170
|
+
}
|
|
3171
|
+
function apply(ctx) {
|
|
3172
|
+
const disposers = [];
|
|
3173
|
+
let disposed = false;
|
|
3174
|
+
resolveHostMode().then((hostMode) => {
|
|
3175
|
+
if (disposed) return;
|
|
3176
|
+
const targetHost = ctx.get?.("hqEdge")?.context?.getTargetHost?.() ?? "";
|
|
3177
|
+
const analytics = createAnalytics(import_sensorsdata_min.default, {
|
|
3178
|
+
hostMode,
|
|
3179
|
+
targetHost
|
|
3180
|
+
});
|
|
3181
|
+
const disposeProvide = ctx.provide?.("huaqiuAnalytics", analytics);
|
|
3182
|
+
if (disposeProvide) disposers.push(disposeProvide);
|
|
3183
|
+
const auth = ctx.get?.("huaqiuAuth")?.auth;
|
|
3184
|
+
if (auth) {
|
|
3185
|
+
let wasAuthenticated = auth.isAuthenticated();
|
|
3186
|
+
auth.getUserInfo().then((info) => {
|
|
3187
|
+
const userId = info?.id ?? info?.userId;
|
|
3188
|
+
if (userId) analytics.login(userId);
|
|
3189
|
+
}).catch(() => void 0);
|
|
3190
|
+
disposers.push(auth.onAuthStateChanged((info) => {
|
|
3191
|
+
const authenticated = info !== null;
|
|
3192
|
+
const userId = info?.id ?? info?.userId;
|
|
3193
|
+
if (userId && !wasAuthenticated && authenticated) trackLogin(analytics, userId);
|
|
3194
|
+
else if (userId) analytics.login(userId);
|
|
3195
|
+
wasAuthenticated = authenticated;
|
|
3196
|
+
}));
|
|
3197
|
+
}
|
|
3198
|
+
drainNodeEvents(analytics);
|
|
3199
|
+
const timer = window.setInterval(() => {
|
|
3200
|
+
drainNodeEvents(analytics);
|
|
3201
|
+
}, POLL_INTERVAL_MS);
|
|
3202
|
+
disposers.push(() => {
|
|
3203
|
+
window.clearInterval(timer);
|
|
3204
|
+
});
|
|
3205
|
+
});
|
|
3206
|
+
return () => {
|
|
3207
|
+
disposed = true;
|
|
3208
|
+
for (const dispose of disposers.reverse()) dispose();
|
|
3209
|
+
};
|
|
3210
|
+
}
|
|
3211
|
+
//#endregion
|
|
3212
|
+
exports.apply = apply;
|
|
3213
|
+
exports.createAnalytics = createAnalytics;
|
|
3214
|
+
exports.inject = inject;
|
|
3215
|
+
exports.resolveReqSource = resolveReqSource;
|
|
3216
|
+
exports.trackLogin = trackLogin;
|
|
3217
|
+
return module.exports;
|
|
3218
|
+
}
|
|
3219
|
+
});
|
|
3220
|
+
|
|
3221
|
+
//# sourceMappingURL=client.js.map
|