@fle-sdk/event-tracking-web 1.2.6 → 1.2.8

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/lib/index.esm.js CHANGED
@@ -624,10 +624,16 @@ function () {
624
624
  g.setRequestHeader && g.setRequestHeader("X-Requested-With", "XMLHttpRequest");
625
625
  }
626
626
 
627
- if (para.contentType === "application/json") {
628
- g.setRequestHeader && g.setRequestHeader("Content-type", "application/json; charset=UTF-8");
629
- } else {
630
- g.setRequestHeader && g.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
627
+ var hasContentType = _this.isObject(para.header) && Object.keys(para.header).some(function (key) {
628
+ return key.toLowerCase() === 'content-type' || key.toLowerCase() === 'content-type';
629
+ });
630
+
631
+ if (!hasContentType) {
632
+ if (para.contentType === "application/json") {
633
+ g.setRequestHeader && g.setRequestHeader("Content-type", "application/json; charset=UTF-8");
634
+ } else {
635
+ g.setRequestHeader && g.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
636
+ }
631
637
  }
632
638
  }
633
639
  } catch (e) {
@@ -865,11 +871,7 @@ function () {
865
871
 
866
872
  fingerprint.canvas = _this.getCanvasFingerprint(); // 8. 音频上下文指纹
867
873
 
868
- fingerprint.audio = _this.getAudioFingerprint(); // 9. 字体检测
869
-
870
- fingerprint.fonts = _this.getFontFingerprint(); // 10. 插件信息
871
-
872
- fingerprint.plugins = _this.getPluginsFingerprint(); // 11. 存储检测
874
+ fingerprint.audio = _this.getAudioFingerprint(); // 11. 存储检测
873
875
 
874
876
  fingerprint.localStorage = _this.hasLocalStorage();
875
877
  fingerprint.sessionStorage = _this.hasSessionStorage();
@@ -877,9 +879,7 @@ function () {
877
879
 
878
880
  fingerprint.hardwareConcurrency = navigator.hardwareConcurrency;
879
881
  fingerprint.deviceMemory = navigator.deviceMemory;
880
- fingerprint.maxTouchPoints = navigator.maxTouchPoints; // 13. 连接信息
881
-
882
- fingerprint.connection = _this.getConnectionFingerprint();
882
+ fingerprint.maxTouchPoints = navigator.maxTouchPoints;
883
883
  return fingerprint;
884
884
  };
885
885
  /**
@@ -951,75 +951,6 @@ function () {
951
951
  return "error";
952
952
  }
953
953
  };
954
- /**
955
- * 获取字体指纹
956
- * @returns 字体指纹字符串
957
- */
958
-
959
-
960
- this.getFontFingerprint = function () {
961
- try {
962
- var baseFonts_1 = ["monospace", "sans-serif", "serif"];
963
- var testString_1 = "mmmmmmmmmmlli";
964
- var testSize_1 = "72px";
965
- var canvas = document.createElement("canvas");
966
- var ctx_1 = canvas.getContext("2d");
967
- if (!ctx_1) return "not-supported";
968
- var detectedFonts_1 = []; // 测试字体列表
969
-
970
- var fonts = ["Arial", "Arial Black", "Comic Sans MS", "Courier New", "Georgia", "Helvetica", "Impact", "Times New Roman", "Trebuchet MS", "Verdana"]; // 获取基准宽度
971
-
972
- var baseWidths_1 = {};
973
- baseFonts_1.forEach(function (font) {
974
- ctx_1.font = testSize_1 + " " + font;
975
- baseWidths_1[font] = ctx_1.measureText(testString_1).width;
976
- }); // 测试每个字体
977
-
978
- fonts.forEach(function (font) {
979
- var detected = false;
980
- baseFonts_1.forEach(function (baseFont) {
981
- ctx_1.font = testSize_1 + " '" + font + "', " + baseFont;
982
- var width = ctx_1.measureText(testString_1).width;
983
-
984
- if (width !== baseWidths_1[baseFont]) {
985
- detected = true;
986
- }
987
- });
988
-
989
- if (detected) {
990
- detectedFonts_1.push(font);
991
- }
992
- });
993
- return detectedFonts_1.join(",");
994
- } catch (e) {
995
- return "error";
996
- }
997
- };
998
- /**
999
- * 获取插件指纹
1000
- * @returns 插件指纹字符串
1001
- */
1002
-
1003
-
1004
- this.getPluginsFingerprint = function () {
1005
- try {
1006
- var plugins = [];
1007
-
1008
- if (navigator.plugins) {
1009
- for (var i = 0; i < navigator.plugins.length; i++) {
1010
- var plugin = navigator.plugins[i];
1011
-
1012
- if (plugin) {
1013
- plugins.push(plugin.name + "|" + plugin.description + "|" + plugin.filename);
1014
- }
1015
- }
1016
- }
1017
-
1018
- return plugins.join(";");
1019
- } catch (e) {
1020
- return "error";
1021
- }
1022
- };
1023
954
  /**
1024
955
  * 检测localStorage支持
1025
956
  * @returns 是否支持localStorage
@@ -1061,22 +992,6 @@ function () {
1061
992
  this.hasIndexedDB = function () {
1062
993
  return "indexedDB" in window && indexedDB !== null;
1063
994
  };
1064
- /**
1065
- * 获取网络连接指纹
1066
- * @returns 网络连接指纹字符串
1067
- */
1068
-
1069
-
1070
- this.getConnectionFingerprint = function () {
1071
- try {
1072
- var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
1073
- if (!connection) return "not-supported"; // 只使用稳定的 effectiveType,不使用 downlink 和 rtt(会随网络状态变化导致指纹不一致)
1074
-
1075
- return connection.effectiveType || "unknown";
1076
- } catch (e) {
1077
- return "error";
1078
- }
1079
- };
1080
995
  /**
1081
996
  * 将指纹信息哈希为唯一ID
1082
997
  * @param fingerprint 指纹信息
@@ -1356,6 +1271,19 @@ function () {
1356
1271
  if (this.config.showLog && elements.length > 0) {
1357
1272
  this.callbacks.printLog("\u5DF2\u76D1\u542C " + elements.length + " \u4E2A\u66DD\u5149\u5143\u7D20");
1358
1273
  }
1274
+
1275
+ if (!document.body) {
1276
+ document.addEventListener("DOMContentLoaded", function () {
1277
+ var deferredElements = document.querySelectorAll('[data-exposure="true"]');
1278
+ deferredElements.forEach(function (element) {
1279
+ _this.addExposureElement(element);
1280
+ });
1281
+
1282
+ if (_this.config.showLog && deferredElements.length > 0) {
1283
+ _this.callbacks.printLog("DOMContentLoaded \u540E\u76D1\u542C " + deferredElements.length + " \u4E2A\u66DD\u5149\u5143\u7D20");
1284
+ }
1285
+ });
1286
+ }
1359
1287
  };
1360
1288
 
1361
1289
  ExposureTracker.prototype.initMutationObserver = function () {
@@ -1387,13 +1315,29 @@ function () {
1387
1315
  });
1388
1316
  });
1389
1317
  });
1390
- this.mutationObserver.observe(document.body, {
1391
- childList: true,
1392
- subtree: true
1393
- });
1394
1318
 
1395
- if (this.config.showLog) {
1396
- this.callbacks.printLog("MutationObserver 已启动,监听动态添加的曝光元素");
1319
+ if (document.body) {
1320
+ this.mutationObserver.observe(document.body, {
1321
+ childList: true,
1322
+ subtree: true
1323
+ });
1324
+
1325
+ if (this.config.showLog) {
1326
+ this.callbacks.printLog("MutationObserver 已启动,监听动态添加的曝光元素");
1327
+ }
1328
+ } else {
1329
+ document.addEventListener("DOMContentLoaded", function () {
1330
+ if (_this.mutationObserver && document.body) {
1331
+ _this.mutationObserver.observe(document.body, {
1332
+ childList: true,
1333
+ subtree: true
1334
+ });
1335
+
1336
+ if (_this.config.showLog) {
1337
+ _this.callbacks.printLog("MutationObserver 已启动,监听动态添加的曝光元素");
1338
+ }
1339
+ }
1340
+ });
1397
1341
  }
1398
1342
  };
1399
1343
 
@@ -1444,7 +1388,13 @@ function () {
1444
1388
  }
1445
1389
 
1446
1390
  PageDurationTracker.prototype.updateConfig = function (config) {
1391
+ var oldInterval = this.config.pageDurationInterval;
1447
1392
  this.config = __assign(__assign({}, this.config), config);
1393
+
1394
+ if (config.pageDurationInterval !== undefined && config.pageDurationInterval !== oldInterval && this.timer !== null) {
1395
+ this.stop();
1396
+ this.start();
1397
+ }
1448
1398
  };
1449
1399
 
1450
1400
  PageDurationTracker.prototype.start = function () {
@@ -1511,17 +1461,31 @@ var BatchSender =
1511
1461
  function () {
1512
1462
  function BatchSender(config, callbacks) {
1513
1463
  this.timer = null;
1464
+ this.isFlushingQueue = false;
1514
1465
  this.config = config;
1515
1466
  this.callbacks = callbacks;
1516
1467
  }
1517
1468
 
1469
+ BatchSender.prototype.start = function () {
1470
+ var _this = this;
1471
+
1472
+ if (!this.config.batchSend) {
1473
+ return;
1474
+ }
1475
+
1476
+ this.clearTimer();
1477
+ this.timer = window.setInterval(function () {
1478
+ _this.flushQueue();
1479
+ }, this.config.batchInterval);
1480
+ };
1481
+
1518
1482
  BatchSender.prototype.updateConfig = function (config) {
1519
1483
  this.config = __assign(__assign({}, this.config), config);
1484
+ this.clearTimer();
1485
+ this.start();
1520
1486
  };
1521
1487
 
1522
1488
  BatchSender.prototype.addToQueue = function (params) {
1523
- var _this = this;
1524
-
1525
1489
  if (!this.config.batchSend) {
1526
1490
  return;
1527
1491
  }
@@ -1542,19 +1506,11 @@ function () {
1542
1506
  this.flushQueue();
1543
1507
  return;
1544
1508
  }
1545
-
1546
- if (!this.timer) {
1547
- this.timer = window.setTimeout(function () {
1548
- _this.flushQueue();
1549
-
1550
- _this.timer = null;
1551
- }, this.config.batchInterval);
1552
- }
1553
1509
  };
1554
1510
 
1555
1511
  BatchSender.prototype.clearTimer = function () {
1556
1512
  if (this.timer !== null) {
1557
- clearTimeout(this.timer);
1513
+ clearInterval(this.timer);
1558
1514
  this.timer = null;
1559
1515
  }
1560
1516
  };
@@ -1612,6 +1568,12 @@ function () {
1612
1568
  };
1613
1569
 
1614
1570
  BatchSender.prototype.flushQueue = function () {
1571
+ var _this = this;
1572
+
1573
+ if (this.isFlushingQueue) {
1574
+ return;
1575
+ }
1576
+
1615
1577
  var batchQueue = this.getQueueFromStorage();
1616
1578
  if (batchQueue.length === 0) return;
1617
1579
  var currentTime = this.callbacks.getTimeStamp();
@@ -1639,10 +1601,13 @@ function () {
1639
1601
  return item._nextRetryTime > currentTime;
1640
1602
  });
1641
1603
  this.saveQueueToStorage(remainingQueue);
1642
- this.sendBatchData(readyToSend);
1604
+ this.isFlushingQueue = true;
1605
+ this.sendBatchData(readyToSend, function () {
1606
+ _this.isFlushingQueue = false;
1607
+ });
1643
1608
  };
1644
1609
 
1645
- BatchSender.prototype.sendBatchData = function (data) {
1610
+ BatchSender.prototype.sendBatchData = function (data, onComplete) {
1646
1611
  var _this = this;
1647
1612
 
1648
1613
  var _a = this.config,
@@ -1661,6 +1626,12 @@ function () {
1661
1626
 
1662
1627
  var shouldUseBeacon = this.callbacks.shouldUseBeacon(sendMethod, undefined, initHeader);
1663
1628
 
1629
+ var complete = function complete() {
1630
+ if (onComplete) {
1631
+ onComplete();
1632
+ }
1633
+ };
1634
+
1664
1635
  if (shouldUseBeacon) {
1665
1636
  try {
1666
1637
  var blob = new Blob([JSON.stringify(data)], {
@@ -1669,18 +1640,20 @@ function () {
1669
1640
  var sent = navigator.sendBeacon(serverUrl, blob);
1670
1641
 
1671
1642
  if (sent) {
1672
- this.saveQueueToStorage([]);
1673
-
1674
1643
  if (showLog) {
1675
1644
  this.callbacks.printLog("\u6279\u91CF\u53D1\u9001\u6210\u529F: " + data.length + " \u6761\u6570\u636E");
1676
1645
  }
1646
+
1647
+ complete();
1677
1648
  } else {
1678
1649
  this.callbacks.printLog("\u6279\u91CF\u53D1\u9001\u5931\u8D25: sendBeacon \u8FD4\u56DE false\uFF0C\u6570\u636E\u5DF2\u91CD\u65B0\u52A0\u5165\u961F\u5217");
1679
1650
  this.retryBatchData(data);
1651
+ complete();
1680
1652
  }
1681
1653
  } catch (e) {
1682
1654
  this.callbacks.printLog("\u6279\u91CF\u53D1\u9001\u5931\u8D25: " + e + "\uFF0C\u6570\u636E\u5DF2\u91CD\u65B0\u52A0\u5165\u961F\u5217");
1683
1655
  this.retryBatchData(data);
1656
+ complete();
1684
1657
  }
1685
1658
  } else {
1686
1659
  this.callbacks.ajax({
@@ -1694,16 +1667,18 @@ function () {
1694
1667
  timeout: this.config.sendTimeout,
1695
1668
  cors: true,
1696
1669
  success: function success() {
1697
- _this.saveQueueToStorage([]);
1698
-
1699
1670
  if (_this.config.showLog) {
1700
1671
  _this.callbacks.printLog("\u6279\u91CF\u53D1\u9001\u6210\u529F: " + data.length + " \u6761\u6570\u636E");
1701
1672
  }
1673
+
1674
+ complete();
1702
1675
  },
1703
1676
  error: function error(err) {
1704
1677
  _this.callbacks.printLog("\u6279\u91CF\u53D1\u9001\u5931\u8D25: " + err + "\uFF0C\u6570\u636E\u5DF2\u91CD\u65B0\u52A0\u5165\u961F\u5217");
1705
1678
 
1706
1679
  _this.retryBatchData(data);
1680
+
1681
+ complete();
1707
1682
  }
1708
1683
  });
1709
1684
  }
@@ -2052,11 +2027,15 @@ function (_super) {
2052
2027
 
2053
2028
  _this.pendingRequestsManager.setupUnloadListener();
2054
2029
 
2055
- if (_this.initConfig.autoTrackPageDurationInterval) {
2030
+ var autoTrackConfig = _this.getAutoTrackConfig();
2031
+
2032
+ _this.currentAutoTrackConfig = autoTrackConfig;
2033
+
2034
+ if (autoTrackConfig.retained) {
2056
2035
  _this.pageDurationTracker.start();
2057
2036
  }
2058
2037
 
2059
- if (_this.initConfig.autoTrackExposure) {
2038
+ if (autoTrackConfig.exposure) {
2060
2039
  _this.exposureTracker.init();
2061
2040
  }
2062
2041
  };
@@ -2077,22 +2056,27 @@ function (_super) {
2077
2056
  _this.each(presetParams, function (val, key) {
2078
2057
  if (key === "pageKey") return;
2079
2058
 
2059
+ if (key === "autoTrack" && _typeof(val) === "object" && val !== null) {
2060
+ var newAutoTrackConfig = val;
2061
+ _this.initConfig.autoTrack = __assign(__assign({}, _this.currentAutoTrackConfig), newAutoTrackConfig);
2062
+ _this.currentAutoTrackConfig = _this.getAutoTrackConfig();
2063
+ return;
2064
+ }
2065
+
2080
2066
  if (_this.initConfig.hasOwnProperty(key)) {
2081
2067
  var validationResult = _this.validateConfigParam(String(key), val);
2082
2068
 
2083
2069
  if (validationResult.valid) {
2084
2070
  _this.initConfig[key] = val;
2085
2071
  } else {
2086
- _this.printLog("\u914D\u7F6E\u53C2\u6570\u9A8C\u8BC1\u5931\u8D25: " + String(key) + " = " + val + ", \u539F\u56E0: " + validationResult.message);
2072
+ console.warn("\u914D\u7F6E\u53C2\u6570\u9A8C\u8BC1\u5931\u8D25: " + String(key) + " = " + val + ", \u539F\u56E0: " + validationResult.message);
2087
2073
  }
2088
2074
  }
2089
2075
  });
2090
2076
  }
2091
2077
 
2092
- if (!/^(((ht|f)tps?):\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-\(\)]*[\w@?^=%&/~+#-\(\)])?$/.test(_this.initConfig["serverUrl"])) {
2093
- _this.printLog("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!");
2094
-
2095
- _this.initConfig["showLog"] = true;
2078
+ if (!/^(((ht|f)tps?):\/\/)?[\w\-]+(\.[\w\-]+)+([\w\-\.,@?^=%&:/~+#\(\)]*[\w\-\.,@?^=%&/~+#\(\)])?$/.test(_this.initConfig["serverUrl"])) {
2079
+ console.warn("当前 server_url 为空或不正确,只在控制台打印日志,network 中不会发数据,请配置正确的 server_url!");
2096
2080
  }
2097
2081
 
2098
2082
  if (!!_this.initConfig["autoTrack"] || !!_this.initConfig["trackPartKeyClick"]) {
@@ -2122,7 +2106,9 @@ function (_super) {
2122
2106
  header: _this.initConfig.header
2123
2107
  });
2124
2108
 
2125
- if (_this.initConfig.autoTrackPageDurationInterval) {
2109
+ var autoTrackConfig = _this.getAutoTrackConfig();
2110
+
2111
+ if (autoTrackConfig.retained) {
2126
2112
  _this.pageDurationTracker.updateConfig({
2127
2113
  pageDurationInterval: _this.initConfig.pageDurationInterval,
2128
2114
  showLog: _this.initConfig.showLog
@@ -2133,9 +2119,9 @@ function (_super) {
2133
2119
  _this.pageDurationTracker.stop();
2134
2120
  }
2135
2121
 
2136
- if (_this.initConfig.autoTrackExposure) {
2122
+ if (autoTrackConfig.exposure) {
2137
2123
  _this.exposureTracker.updateConfig({
2138
- autoTrackExposure: _this.initConfig.autoTrackExposure,
2124
+ autoTrackExposure: true,
2139
2125
  exposureThreshold: _this.initConfig.exposureThreshold,
2140
2126
  exposureTime: _this.initConfig.exposureTime,
2141
2127
  exposureNum: _this.initConfig.exposureNum,
@@ -2251,12 +2237,8 @@ function (_super) {
2251
2237
  break;
2252
2238
 
2253
2239
  case "showLog":
2254
- case "autoTrack":
2255
2240
  case "isTrackSinglePage":
2256
2241
  case "batchSend":
2257
- case "trackPartKeyClick":
2258
- case "autoTrackPageDurationInterval":
2259
- case "autoTrackExposure":
2260
2242
  if (typeof value !== "boolean") {
2261
2243
  return {
2262
2244
  valid: false,
@@ -2266,6 +2248,37 @@ function (_super) {
2266
2248
 
2267
2249
  break;
2268
2250
 
2251
+ case "autoTrack":
2252
+ if (typeof value !== "boolean" && _typeof(value) !== "object") {
2253
+ return {
2254
+ valid: false,
2255
+ message: "autoTrack 必须是布尔值或对象"
2256
+ };
2257
+ }
2258
+
2259
+ if (_typeof(value) === "object" && value !== null) {
2260
+ var autoTrackConfig = value;
2261
+ var validKeys = ["view", "click", "exposure", "retained"];
2262
+
2263
+ for (var k in autoTrackConfig) {
2264
+ if (!validKeys.includes(k)) {
2265
+ return {
2266
+ valid: false,
2267
+ message: "autoTrack \u5BF9\u8C61\u4E2D\u5305\u542B\u65E0\u6548\u7684\u5C5E\u6027: " + k
2268
+ };
2269
+ }
2270
+
2271
+ if (typeof autoTrackConfig[k] !== "boolean") {
2272
+ return {
2273
+ valid: false,
2274
+ message: "autoTrack." + k + " \u5FC5\u987B\u662F\u5E03\u5C14\u503C"
2275
+ };
2276
+ }
2277
+ }
2278
+ }
2279
+
2280
+ break;
2281
+
2269
2282
  case "business":
2270
2283
  case "header":
2271
2284
  if (value !== null && _typeof(value) !== "object") {
@@ -2303,6 +2316,37 @@ function (_super) {
2303
2316
  };
2304
2317
  };
2305
2318
 
2319
+ _this.getAutoTrackConfig = function () {
2320
+ var _a, _b, _c, _d;
2321
+
2322
+ var autoTrack = _this.initConfig.autoTrack;
2323
+
2324
+ if (typeof autoTrack === "boolean") {
2325
+ return {
2326
+ view: autoTrack,
2327
+ click: autoTrack,
2328
+ exposure: autoTrack,
2329
+ retained: autoTrack
2330
+ };
2331
+ }
2332
+
2333
+ if (_typeof(autoTrack) === "object" && autoTrack !== null) {
2334
+ return {
2335
+ view: (_a = autoTrack.view) !== null && _a !== void 0 ? _a : false,
2336
+ click: (_b = autoTrack.click) !== null && _b !== void 0 ? _b : false,
2337
+ exposure: (_c = autoTrack.exposure) !== null && _c !== void 0 ? _c : false,
2338
+ retained: (_d = autoTrack.retained) !== null && _d !== void 0 ? _d : false
2339
+ };
2340
+ }
2341
+
2342
+ return {
2343
+ view: false,
2344
+ click: false,
2345
+ exposure: false,
2346
+ retained: false
2347
+ };
2348
+ };
2349
+
2306
2350
  _this.login = function (userInfo) {
2307
2351
  if (_this.isObject(userInfo)) _this.userInfo = userInfo;
2308
2352
  };
@@ -2337,7 +2381,9 @@ function (_super) {
2337
2381
  _this.listener = function () {
2338
2382
  _this.unlistener();
2339
2383
 
2340
- if (!!_this.initConfig.autoTrack) {
2384
+ var autoTrackConfig = _this.getAutoTrackConfig();
2385
+
2386
+ if (autoTrackConfig.view) {
2341
2387
  if (!!_this.initConfig.isTrackSinglePage) {
2342
2388
  _this.rewriteHistory();
2343
2389
 
@@ -2349,7 +2395,7 @@ function (_super) {
2349
2395
  });
2350
2396
  }
2351
2397
 
2352
- if (!!_this.initConfig.autoTrack || !!_this.initConfig.trackPartKeyClick) {
2398
+ if (autoTrackConfig.click) {
2353
2399
  _this.addEventListener(window, "click", _this.onClickCallback);
2354
2400
  }
2355
2401
  };
@@ -2464,40 +2510,17 @@ function (_super) {
2464
2510
  _this.pageKey = window.location.pathname.replace(/\//g, "_").substring(1);
2465
2511
  }
2466
2512
 
2467
- if (_this.initConfig.autoTrackPageDurationInterval) {
2513
+ var autoTrackConfig = _this.getAutoTrackConfig();
2514
+
2515
+ if (autoTrackConfig.retained) {
2468
2516
  _this.pageDurationTracker.stop();
2469
2517
 
2470
2518
  _this.pageDurationTracker.start();
2471
2519
  }
2472
2520
 
2473
- _this.sendRetained(e.type);
2474
-
2475
2521
  _this.sendData(params);
2476
2522
  };
2477
2523
 
2478
- _this.sendRetained = function (type) {
2479
- var params = _this.getParams({
2480
- event: "PageRetained",
2481
- desc: _this.eventDescMap["PageRetained"]
2482
- });
2483
-
2484
- if (["beforeunload", "pushState", "replaceState", "hashchange", "popstate"].indexOf(type) >= 0) {
2485
- var __time = _this.getCookie("retainedStartTime");
2486
-
2487
- var retainedStartTime = __time ? +__time : _this.getTimeStamp();
2488
-
2489
- var retainedData = __assign(__assign({}, params), {
2490
- privateParamMap: __assign(__assign({}, params.privateParamMap), {
2491
- retainedDuration: Math.max(params.requestTime - retainedStartTime, 0)
2492
- })
2493
- });
2494
-
2495
- _this.sendData(retainedData);
2496
-
2497
- _this.setCookie("retainedStartTime", _this.getTimeStamp());
2498
- }
2499
- };
2500
-
2501
2524
  _this.getParams = function (_a) {
2502
2525
  var event = _a.event,
2503
2526
  desc = _a.desc,
@@ -2798,7 +2821,7 @@ function (_super) {
2798
2821
  });
2799
2822
  };
2800
2823
 
2801
- _this.sdkVersion = "1.2.4";
2824
+ _this.sdkVersion = "1.2.8";
2802
2825
  _this.initConfig = {
2803
2826
  appKey: "",
2804
2827
  platform: undefined,
@@ -2814,12 +2837,9 @@ function (_super) {
2814
2837
  batchSend: false,
2815
2838
  batchInterval: 5000,
2816
2839
  batchMaxSize: 10,
2817
- trackPartKeyClick: false,
2818
2840
  pendingRequestsMaxSize: 50,
2819
- autoTrackPageDurationInterval: false,
2820
2841
  pageDurationInterval: 30000,
2821
2842
  sendMethod: "auto",
2822
- autoTrackExposure: false,
2823
2843
  exposureThreshold: 0.5,
2824
2844
  exposureTime: 500,
2825
2845
  exposureNum: undefined
@@ -2891,6 +2911,20 @@ function (_super) {
2891
2911
  return _this;
2892
2912
  }
2893
2913
 
2914
+ WebTracking.prototype.printLog = function () {
2915
+ var rest = [];
2916
+
2917
+ for (var _i = 0; _i < arguments.length; _i++) {
2918
+ rest[_i] = arguments[_i];
2919
+ }
2920
+
2921
+ if (!this.initConfig.showLog) {
2922
+ return;
2923
+ }
2924
+
2925
+ _super.prototype.printLog.apply(this, rest);
2926
+ };
2927
+
2894
2928
  WebTracking.prototype.addSinglePageEvent = function (callback) {
2895
2929
  var _this = this;
2896
2930