clarity-js 0.7.49 → 0.7.50
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/build/clarity.extended.js +1 -1
- package/build/clarity.insight.js +1 -1
- package/build/clarity.js +75 -54
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +75 -54
- package/build/clarity.performance.js +1 -1
- package/package.json +1 -1
- package/src/core/version.ts +1 -1
- package/src/data/consent.ts +21 -0
- package/src/data/metadata.ts +11 -1
- package/src/data/upgrade.ts +1 -0
- package/src/data/upload.ts +4 -1
- package/types/data.d.ts +13 -2
package/build/clarity.js
CHANGED
|
@@ -40,6 +40,7 @@ var dimension = /*#__PURE__*/Object.freeze({
|
|
|
40
40
|
});
|
|
41
41
|
var metadata$1 = /*#__PURE__*/Object.freeze({
|
|
42
42
|
__proto__: null,
|
|
43
|
+
get callback () { return callback; },
|
|
43
44
|
get callbacks () { return callbacks; },
|
|
44
45
|
get clear () { return clear; },
|
|
45
46
|
get consent () { return consent; },
|
|
@@ -114,7 +115,7 @@ function process$7() {
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
var config$
|
|
118
|
+
var config$2 = {
|
|
118
119
|
projectId: null,
|
|
119
120
|
delay: 1 * 1000 /* Time.Second */,
|
|
120
121
|
lean: false,
|
|
@@ -164,7 +165,7 @@ function stop$F() {
|
|
|
164
165
|
startTime = 0;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
var version$1 = "0.7.
|
|
168
|
+
var version$1 = "0.7.50";
|
|
168
169
|
|
|
169
170
|
// tslint:disable: no-bitwise
|
|
170
171
|
function hash (input, precision) {
|
|
@@ -275,7 +276,7 @@ function url$1(input, electron) {
|
|
|
275
276
|
if (electron) {
|
|
276
277
|
return "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
|
|
277
278
|
}
|
|
278
|
-
var drop = config$
|
|
279
|
+
var drop = config$2.drop;
|
|
279
280
|
if (drop && drop.length > 0 && input && input.indexOf("?") > 0) {
|
|
280
281
|
var _a = input.split("?"), path = _a[0], query = _a[1];
|
|
281
282
|
var swap_1 = "*na*" /* Data.Constant.Dropped */;
|
|
@@ -621,8 +622,8 @@ var summary = /*#__PURE__*/Object.freeze({
|
|
|
621
622
|
|
|
622
623
|
var data$f = null;
|
|
623
624
|
function start$D() {
|
|
624
|
-
if (!config$
|
|
625
|
-
config$
|
|
625
|
+
if (!config$2.lean && config$2.upgrade) {
|
|
626
|
+
config$2.upgrade("Config" /* Constant.Config */);
|
|
626
627
|
}
|
|
627
628
|
data$f = null;
|
|
628
629
|
}
|
|
@@ -632,14 +633,15 @@ function start$D() {
|
|
|
632
633
|
// and send all backed up layout events to the server.
|
|
633
634
|
function upgrade(key) {
|
|
634
635
|
// Upgrade only if Clarity was successfully activated on the page
|
|
635
|
-
if (active() && config$
|
|
636
|
-
config$
|
|
636
|
+
if (active() && config$2.lean) {
|
|
637
|
+
config$2.lean = false;
|
|
637
638
|
data$f = { key: key };
|
|
638
639
|
// Update metadata to track we have upgraded this session
|
|
640
|
+
callback();
|
|
639
641
|
save();
|
|
640
642
|
// Callback upgrade handler, if configured
|
|
641
|
-
if (config$
|
|
642
|
-
config$
|
|
643
|
+
if (config$2.upgrade) {
|
|
644
|
+
config$2.upgrade(key);
|
|
643
645
|
}
|
|
644
646
|
encode$1(3 /* Event.Upgrade */);
|
|
645
647
|
}
|
|
@@ -941,7 +943,7 @@ function start$A() {
|
|
|
941
943
|
}
|
|
942
944
|
function check$4(id, target, input) {
|
|
943
945
|
// Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
|
|
944
|
-
if (config$
|
|
946
|
+
if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
|
|
945
947
|
data$d = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
|
|
946
948
|
// Only encode this event if we haven't already reported this hash
|
|
947
949
|
if (history$5.indexOf(data$d.checksum) < 0) {
|
|
@@ -1095,14 +1097,14 @@ function parse$1(root, init) {
|
|
|
1095
1097
|
try {
|
|
1096
1098
|
// Parse unmask configuration into separate query selectors and override tokens as part of initialization
|
|
1097
1099
|
if (init) {
|
|
1098
|
-
config$
|
|
1100
|
+
config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
|
|
1099
1101
|
}
|
|
1100
1102
|
// Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
|
|
1101
1103
|
// We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
|
|
1102
1104
|
if ("querySelectorAll" in root) {
|
|
1103
|
-
config$
|
|
1104
|
-
config$
|
|
1105
|
-
config$
|
|
1105
|
+
config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
|
|
1106
|
+
config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
|
|
1107
|
+
config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
|
|
1106
1108
|
unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
|
|
1107
1109
|
}
|
|
1108
1110
|
}
|
|
@@ -1129,7 +1131,7 @@ function add(node, parent, data, source) {
|
|
|
1129
1131
|
var parentValue = null;
|
|
1130
1132
|
var regionId = exists(node) ? id : null;
|
|
1131
1133
|
var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
|
|
1132
|
-
var privacyId = config$
|
|
1134
|
+
var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
|
|
1133
1135
|
if (parentId >= 0 && values[parentId]) {
|
|
1134
1136
|
parentValue = values[parentId];
|
|
1135
1137
|
parentValue.children.push(id);
|
|
@@ -1528,7 +1530,7 @@ function state$a(timer) {
|
|
|
1528
1530
|
return 2 /* Task.Stop */;
|
|
1529
1531
|
}
|
|
1530
1532
|
function start$y(timer) {
|
|
1531
|
-
tracker[key(timer)] = { start: performance.now(), calls: 0, yield: config$
|
|
1533
|
+
tracker[key(timer)] = { start: performance.now(), calls: 0, yield: config$2.longTask };
|
|
1532
1534
|
}
|
|
1533
1535
|
function restart$2(timer) {
|
|
1534
1536
|
var id = key(timer);
|
|
@@ -1614,14 +1616,14 @@ function requestIdleCallbackPolyfill(callback, options) {
|
|
|
1614
1616
|
var currentTime = performance.now();
|
|
1615
1617
|
var elapsed = currentTime - startTime;
|
|
1616
1618
|
var duration = currentTime - event.data;
|
|
1617
|
-
if (duration > config$
|
|
1619
|
+
if (duration > config$2.longTask && elapsed < options.timeout) {
|
|
1618
1620
|
requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
|
|
1619
1621
|
}
|
|
1620
1622
|
else {
|
|
1621
1623
|
var didTimeout_1 = elapsed > options.timeout;
|
|
1622
1624
|
callback({
|
|
1623
1625
|
didTimeout: didTimeout_1,
|
|
1624
|
-
timeRemaining: function () { return didTimeout_1 ? config$
|
|
1626
|
+
timeRemaining: function () { return didTimeout_1 ? config$2.longTask : Math.max(0, config$2.longTask - duration); }
|
|
1625
1627
|
});
|
|
1626
1628
|
}
|
|
1627
1629
|
};
|
|
@@ -1718,7 +1720,7 @@ function recompute$8(evt) {
|
|
|
1718
1720
|
var element = target(evt);
|
|
1719
1721
|
if (element) {
|
|
1720
1722
|
var value = element.value;
|
|
1721
|
-
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$
|
|
1723
|
+
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
|
|
1722
1724
|
state$9.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
|
|
1723
1725
|
schedule$1(encode$3.bind(this, 42 /* Event.Change */));
|
|
1724
1726
|
}
|
|
@@ -2505,7 +2507,7 @@ function process$2() {
|
|
|
2505
2507
|
return [3 /*break*/, 6];
|
|
2506
2508
|
}
|
|
2507
2509
|
target = mutation.target;
|
|
2508
|
-
type = config$
|
|
2510
|
+
type = config$2.throttleDom ? track$5(mutation, timer, instance, record.time) : mutation.type;
|
|
2509
2511
|
if (type && target && target.ownerDocument) {
|
|
2510
2512
|
parse$1(target.ownerDocument);
|
|
2511
2513
|
}
|
|
@@ -3365,7 +3367,7 @@ function encode$4 (type, timer, ts) {
|
|
|
3365
3367
|
if (type === 6 /* Event.Mutation */) {
|
|
3366
3368
|
activity(eventTime);
|
|
3367
3369
|
}
|
|
3368
|
-
queue(tokenize(tokens), !config$
|
|
3370
|
+
queue(tokenize(tokens), !config$2.lean);
|
|
3369
3371
|
_l.label = 11;
|
|
3370
3372
|
case 11: return [3 /*break*/, 12];
|
|
3371
3373
|
case 12: return [2 /*return*/];
|
|
@@ -3885,7 +3887,7 @@ function upload(final) {
|
|
|
3885
3887
|
switch (_b.label) {
|
|
3886
3888
|
case 0:
|
|
3887
3889
|
timeout = null;
|
|
3888
|
-
sendPlaybackBytes = config$
|
|
3890
|
+
sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
|
|
3889
3891
|
if (sendPlaybackBytes) {
|
|
3890
3892
|
max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
|
|
3891
3893
|
}
|
|
@@ -3930,8 +3932,8 @@ function stringify(encoded) {
|
|
|
3930
3932
|
function send(payload, zipped, sequence, beacon) {
|
|
3931
3933
|
if (beacon === void 0) { beacon = false; }
|
|
3932
3934
|
// Upload data if a valid URL is defined in the config
|
|
3933
|
-
if (typeof config$
|
|
3934
|
-
var url_1 = config$
|
|
3935
|
+
if (typeof config$2.upload === "string" /* Constant.String */) {
|
|
3936
|
+
var url_1 = config$2.upload;
|
|
3935
3937
|
var dispatched = false;
|
|
3936
3938
|
// If it's the last payload, attempt to upload using sendBeacon first.
|
|
3937
3939
|
// The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
|
|
@@ -3980,8 +3982,8 @@ function send(payload, zipped, sequence, beacon) {
|
|
|
3980
3982
|
}
|
|
3981
3983
|
}
|
|
3982
3984
|
}
|
|
3983
|
-
else if (config$
|
|
3984
|
-
var callback = config$
|
|
3985
|
+
else if (config$2.upload) {
|
|
3986
|
+
var callback = config$2.upload;
|
|
3985
3987
|
callback(payload);
|
|
3986
3988
|
done(sequence);
|
|
3987
3989
|
}
|
|
@@ -4003,7 +4005,7 @@ function check$3(xhr, sequence) {
|
|
|
4003
4005
|
// 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
|
|
4004
4006
|
// In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
|
|
4005
4007
|
if (xhr.status === 0) {
|
|
4006
|
-
config$
|
|
4008
|
+
config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
|
|
4007
4009
|
}
|
|
4008
4010
|
// In all other cases, re-attempt sending the same data
|
|
4009
4011
|
// For retry we always fallback to string payload, even though we may have attempted
|
|
@@ -4041,13 +4043,14 @@ function done(sequence) {
|
|
|
4041
4043
|
// If we everything went successfully, and it is the first sequence, save this session for future reference
|
|
4042
4044
|
if (sequence === 1) {
|
|
4043
4045
|
save();
|
|
4046
|
+
callback();
|
|
4044
4047
|
}
|
|
4045
4048
|
}
|
|
4046
4049
|
function delay() {
|
|
4047
4050
|
// Progressively increase delay as we continue to send more payloads from the client to the server
|
|
4048
4051
|
// If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
|
|
4049
|
-
var gap = config$
|
|
4050
|
-
return typeof config$
|
|
4052
|
+
var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
|
|
4053
|
+
return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
|
|
4051
4054
|
}
|
|
4052
4055
|
function response(payload) {
|
|
4053
4056
|
var lines = payload && payload.length > 0 ? payload.split("\n") : [];
|
|
@@ -4065,8 +4068,8 @@ function response(payload) {
|
|
|
4065
4068
|
break;
|
|
4066
4069
|
case "ACTION" /* Constant.Action */:
|
|
4067
4070
|
// Invoke action callback, if configured and has a valid value
|
|
4068
|
-
if (config$
|
|
4069
|
-
config$
|
|
4071
|
+
if (config$2.action && parts.length > 1) {
|
|
4072
|
+
config$2.action(parts[1]);
|
|
4070
4073
|
}
|
|
4071
4074
|
break;
|
|
4072
4075
|
case "EXTRACT" /* Constant.Extract */:
|
|
@@ -4549,6 +4552,17 @@ function reset$3() {
|
|
|
4549
4552
|
updates = {};
|
|
4550
4553
|
}
|
|
4551
4554
|
|
|
4555
|
+
function config$1(track) {
|
|
4556
|
+
trackConsent(track ? 1 /* ConsentType.Implicit */ : 0 /* ConsentType.None */);
|
|
4557
|
+
}
|
|
4558
|
+
// When we get consent signal as false, we restart the service and track config as false.
|
|
4559
|
+
function consent$1() {
|
|
4560
|
+
trackConsent(2 /* ConsentType.General */);
|
|
4561
|
+
}
|
|
4562
|
+
function trackConsent(consent) {
|
|
4563
|
+
log(36 /* Dimension.Consent */, consent.toString());
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4552
4566
|
var data$2 = null;
|
|
4553
4567
|
var callbacks = [];
|
|
4554
4568
|
var electron = 0 /* BooleanFlag.False */;
|
|
@@ -4565,11 +4579,11 @@ function start$9() {
|
|
|
4565
4579
|
// Populate ids for this page
|
|
4566
4580
|
var s = session();
|
|
4567
4581
|
var u = user();
|
|
4568
|
-
var projectId = config$
|
|
4582
|
+
var projectId = config$2.projectId || hash(location.host);
|
|
4569
4583
|
data$2 = { projectId: projectId, userId: u.id, sessionId: s.session, pageNum: s.count };
|
|
4570
4584
|
// Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
|
|
4571
|
-
config$
|
|
4572
|
-
config$
|
|
4585
|
+
config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
|
|
4586
|
+
config$2.upload = config$2.track && typeof config$2.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$2.upload;
|
|
4573
4587
|
// Log page metadata as dimensions
|
|
4574
4588
|
log(0 /* Dimension.UserAgent */, ua);
|
|
4575
4589
|
log(3 /* Dimension.PageTitle */, title);
|
|
@@ -4602,13 +4616,15 @@ function start$9() {
|
|
|
4602
4616
|
max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
|
|
4603
4617
|
}
|
|
4604
4618
|
// Read cookies specified in configuration
|
|
4605
|
-
for (var _i = 0, _d = config$
|
|
4619
|
+
for (var _i = 0, _d = config$2.cookies; _i < _d.length; _i++) {
|
|
4606
4620
|
var key = _d[_i];
|
|
4607
4621
|
var value = getCookie(key);
|
|
4608
4622
|
if (value) {
|
|
4609
4623
|
set(key, value);
|
|
4610
4624
|
}
|
|
4611
4625
|
}
|
|
4626
|
+
// Track consent config
|
|
4627
|
+
config$1(config$2.track);
|
|
4612
4628
|
// Track ids using a cookie if configuration allows it
|
|
4613
4629
|
track(u);
|
|
4614
4630
|
}
|
|
@@ -4636,14 +4652,14 @@ function stop$8() {
|
|
|
4636
4652
|
function metadata(cb, wait, recall) {
|
|
4637
4653
|
if (wait === void 0) { wait = true; }
|
|
4638
4654
|
if (recall === void 0) { recall = false; }
|
|
4639
|
-
var upgraded = config$
|
|
4655
|
+
var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
|
|
4640
4656
|
var called = false;
|
|
4641
4657
|
// if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
|
|
4642
4658
|
// directly execute the callback in addition to adding to our list as we only process callbacks at the moment
|
|
4643
4659
|
// we go through the upgrading flow.
|
|
4644
4660
|
if (data$2 && (upgraded || wait === false)) {
|
|
4645
4661
|
// Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
|
|
4646
|
-
cb(data$2, !config$
|
|
4662
|
+
cb(data$2, !config$2.lean);
|
|
4647
4663
|
called = true;
|
|
4648
4664
|
}
|
|
4649
4665
|
if (recall || !called) {
|
|
@@ -4656,7 +4672,7 @@ function id() {
|
|
|
4656
4672
|
function consent(status) {
|
|
4657
4673
|
if (status === void 0) { status = true; }
|
|
4658
4674
|
if (!status) {
|
|
4659
|
-
config$
|
|
4675
|
+
config$2.track = false;
|
|
4660
4676
|
setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, -Number.MAX_VALUE);
|
|
4661
4677
|
setCookie("_clck" /* Constant.CookieKey */, "" /* Constant.Empty */, -Number.MAX_VALUE);
|
|
4662
4678
|
stop();
|
|
@@ -4664,8 +4680,10 @@ function consent(status) {
|
|
|
4664
4680
|
return;
|
|
4665
4681
|
}
|
|
4666
4682
|
if (active()) {
|
|
4667
|
-
config$
|
|
4683
|
+
config$2.track = true;
|
|
4668
4684
|
track(user(), 1 /* BooleanFlag.True */);
|
|
4685
|
+
save();
|
|
4686
|
+
consent$1();
|
|
4669
4687
|
}
|
|
4670
4688
|
}
|
|
4671
4689
|
function clear() {
|
|
@@ -4674,20 +4692,23 @@ function clear() {
|
|
|
4674
4692
|
}
|
|
4675
4693
|
function tab() {
|
|
4676
4694
|
var id = shortid();
|
|
4677
|
-
if (config$
|
|
4695
|
+
if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
|
|
4678
4696
|
var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
|
|
4679
4697
|
id = value ? value : id;
|
|
4680
4698
|
sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
|
|
4681
4699
|
}
|
|
4682
4700
|
return id;
|
|
4683
4701
|
}
|
|
4702
|
+
function callback() {
|
|
4703
|
+
var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
|
|
4704
|
+
processCallback(upgrade);
|
|
4705
|
+
}
|
|
4684
4706
|
function save() {
|
|
4685
4707
|
if (!data$2)
|
|
4686
4708
|
return;
|
|
4687
4709
|
var ts = Math.round(Date.now());
|
|
4688
|
-
var upload = config$
|
|
4689
|
-
var upgrade = config$
|
|
4690
|
-
processCallback(upgrade);
|
|
4710
|
+
var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
|
|
4711
|
+
var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
|
|
4691
4712
|
setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
|
|
4692
4713
|
}
|
|
4693
4714
|
function processCallback(upgrade) {
|
|
@@ -4695,7 +4716,7 @@ function processCallback(upgrade) {
|
|
|
4695
4716
|
for (var i = 0; i < callbacks.length; i++) {
|
|
4696
4717
|
var cb = callbacks[i];
|
|
4697
4718
|
if (cb.callback && !cb.called && (!cb.wait || upgrade)) {
|
|
4698
|
-
cb.callback(data$2, !config$
|
|
4719
|
+
cb.callback(data$2, !config$2.lean);
|
|
4699
4720
|
cb.called = true;
|
|
4700
4721
|
if (!cb.recall) {
|
|
4701
4722
|
callbacks.splice(i, 1);
|
|
@@ -4721,7 +4742,7 @@ function track(u, consent) {
|
|
|
4721
4742
|
// E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
|
|
4722
4743
|
var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
|
|
4723
4744
|
// If DOB is not set in the user object, use the date set in the config as a DOB
|
|
4724
|
-
var dob = u.dob === 0 ? (config$
|
|
4745
|
+
var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
|
|
4725
4746
|
// To avoid cookie churn, write user id cookie only once every day
|
|
4726
4747
|
if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
|
|
4727
4748
|
var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
|
|
@@ -4793,9 +4814,9 @@ function user() {
|
|
|
4793
4814
|
output.dob = num(parts[4]);
|
|
4794
4815
|
}
|
|
4795
4816
|
// Set track configuration to true for this user if we have explicit consent, regardless of project setting
|
|
4796
|
-
config$
|
|
4817
|
+
config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
|
|
4797
4818
|
// Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
|
|
4798
|
-
output.id = config$
|
|
4819
|
+
output.id = config$2.track ? parts[0] : output.id;
|
|
4799
4820
|
}
|
|
4800
4821
|
return output;
|
|
4801
4822
|
}
|
|
@@ -4839,7 +4860,7 @@ function encodeCookieValue(value) {
|
|
|
4839
4860
|
function setCookie(key, value, time) {
|
|
4840
4861
|
// only write cookies if we are currently in a cookie writing mode (and they are supported)
|
|
4841
4862
|
// OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
|
|
4842
|
-
if ((config$
|
|
4863
|
+
if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
|
|
4843
4864
|
// Some browsers automatically url encode cookie values if they are not url encoded.
|
|
4844
4865
|
// We therefore encode and decode cookie values ourselves.
|
|
4845
4866
|
var encodedValue = encodeCookieValue(value);
|
|
@@ -4926,7 +4947,7 @@ function reset$2() {
|
|
|
4926
4947
|
function report(e) {
|
|
4927
4948
|
// Do not report the same message twice for the same page
|
|
4928
4949
|
if (history$1 && history$1.indexOf(e.message) === -1) {
|
|
4929
|
-
var url = config$
|
|
4950
|
+
var url = config$2.report;
|
|
4930
4951
|
if (url && url.length > 0) {
|
|
4931
4952
|
var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
|
|
4932
4953
|
if (e.message) {
|
|
@@ -4958,7 +4979,7 @@ function measure (method) {
|
|
|
4958
4979
|
}
|
|
4959
4980
|
var duration = performance.now() - start;
|
|
4960
4981
|
sum(4 /* Metric.TotalCost */, duration);
|
|
4961
|
-
if (duration > config$
|
|
4982
|
+
if (duration > config$2.longTask) {
|
|
4962
4983
|
count$1(7 /* Metric.LongTaskCount */);
|
|
4963
4984
|
max(6 /* Metric.ThreadBlockedTime */, duration);
|
|
4964
4985
|
}
|
|
@@ -5088,8 +5109,8 @@ function config(override) {
|
|
|
5088
5109
|
return false;
|
|
5089
5110
|
}
|
|
5090
5111
|
for (var key in override) {
|
|
5091
|
-
if (key in config$
|
|
5092
|
-
config$
|
|
5112
|
+
if (key in config$2) {
|
|
5113
|
+
config$2[key] = override[key];
|
|
5093
5114
|
}
|
|
5094
5115
|
}
|
|
5095
5116
|
return true;
|
|
@@ -5166,7 +5187,7 @@ function start$3() {
|
|
|
5166
5187
|
start$x();
|
|
5167
5188
|
start$h();
|
|
5168
5189
|
start$z();
|
|
5169
|
-
if (config$
|
|
5190
|
+
if (config$2.delayDom) {
|
|
5170
5191
|
// Lazy load layout module as part of page load time performance improvements experiment
|
|
5171
5192
|
bind(window, 'load', function () {
|
|
5172
5193
|
start$k();
|
|
@@ -5319,7 +5340,7 @@ function process(entries) {
|
|
|
5319
5340
|
case "resource" /* Constant.Resource */:
|
|
5320
5341
|
var name_1 = entry.name;
|
|
5321
5342
|
log(4 /* Dimension.NetworkHosts */, host(name_1));
|
|
5322
|
-
if (name_1 === config$
|
|
5343
|
+
if (name_1 === config$2.upload || name_1 === config$2.fallback) {
|
|
5323
5344
|
max(28 /* Metric.UploadTime */, entry.duration);
|
|
5324
5345
|
}
|
|
5325
5346
|
break;
|