mixpanel-browser 2.55.0 → 2.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +31 -1
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/mixpanel-core.cjs.js +52 -15
- package/dist/mixpanel-recorder.js +211 -87
- package/dist/mixpanel-recorder.min.js +10 -9
- package/dist/mixpanel-recorder.min.js.map +1 -0
- package/dist/mixpanel-with-async-recorder.cjs.js +52 -15
- package/dist/mixpanel.amd.js +238 -93
- package/dist/mixpanel.cjs.js +238 -93
- package/dist/mixpanel.globals.js +52 -15
- package/dist/mixpanel.min.js +109 -107
- package/dist/mixpanel.min.js.map +8 -0
- package/dist/mixpanel.module.js +238 -93
- package/dist/mixpanel.umd.js +238 -93
- package/package.json +1 -1
- package/src/config.js +1 -1
- package/src/mixpanel-core.js +27 -6
- package/src/recorder/index.js +39 -232
- package/src/recorder/rollup.config.js +2 -1
- package/src/recorder/session-recording.js +305 -0
- package/src/request-batcher.js +7 -2
- package/src/request-queue.js +5 -3
- package/src/utils.js +26 -13
package/dist/mixpanel.globals.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var Config = {
|
|
5
5
|
DEBUG: false,
|
|
6
|
-
LIB_VERSION: '2.
|
|
6
|
+
LIB_VERSION: '2.56.0'
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
hostname: ''
|
|
16
16
|
};
|
|
17
17
|
win = {
|
|
18
|
-
navigator: { userAgent: '' },
|
|
18
|
+
navigator: { userAgent: '', onLine: true },
|
|
19
19
|
document: {
|
|
20
20
|
location: loc,
|
|
21
21
|
referrer: ''
|
|
@@ -969,7 +969,7 @@
|
|
|
969
969
|
_.getQueryParam = function(url, param) {
|
|
970
970
|
// Expects a raw URL
|
|
971
971
|
|
|
972
|
-
param = param.replace(/[[]
|
|
972
|
+
param = param.replace(/[[]/g, '\\[').replace(/[\]]/g, '\\]');
|
|
973
973
|
var regexS = '[\\?&]' + param + '=([^&#]*)',
|
|
974
974
|
regex = new RegExp(regexS),
|
|
975
975
|
results = regex.exec(url);
|
|
@@ -1426,8 +1426,8 @@
|
|
|
1426
1426
|
};
|
|
1427
1427
|
})();
|
|
1428
1428
|
|
|
1429
|
-
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
|
|
1430
|
-
var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];
|
|
1429
|
+
var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'utm_id', 'utm_source_platform','utm_campaign_id', 'utm_creative_format', 'utm_marketing_tactic'];
|
|
1430
|
+
var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'sccid', 'ttclid', 'twclid', 'wbraid'];
|
|
1431
1431
|
|
|
1432
1432
|
_.info = {
|
|
1433
1433
|
campaignParams: function(default_value) {
|
|
@@ -1709,6 +1709,15 @@
|
|
|
1709
1709
|
return matches ? matches[0] : '';
|
|
1710
1710
|
};
|
|
1711
1711
|
|
|
1712
|
+
/**
|
|
1713
|
+
* Check whether we have network connection. default to true for browsers that don't support navigator.onLine (IE)
|
|
1714
|
+
* @returns {boolean}
|
|
1715
|
+
*/
|
|
1716
|
+
var isOnline = function() {
|
|
1717
|
+
var onLine = win.navigator['onLine'];
|
|
1718
|
+
return _.isUndefined(onLine) || onLine;
|
|
1719
|
+
};
|
|
1720
|
+
|
|
1712
1721
|
var JSONStringify = null, JSONParse = null;
|
|
1713
1722
|
if (typeof JSON !== 'undefined') {
|
|
1714
1723
|
JSONStringify = JSON.stringify;
|
|
@@ -2048,11 +2057,13 @@
|
|
|
2048
2057
|
var RequestQueue = function(storageKey, options) {
|
|
2049
2058
|
options = options || {};
|
|
2050
2059
|
this.storageKey = storageKey;
|
|
2051
|
-
this.
|
|
2060
|
+
this.usePersistence = options.usePersistence;
|
|
2061
|
+
if (this.usePersistence) {
|
|
2062
|
+
this.storage = options.storage || window.localStorage;
|
|
2063
|
+
this.lock = new SharedLock(storageKey, {storage: this.storage});
|
|
2064
|
+
}
|
|
2052
2065
|
this.reportError = options.errorReporter || _.bind(logger$1.error, logger$1);
|
|
2053
|
-
this.lock = new SharedLock(storageKey, {storage: this.storage});
|
|
2054
2066
|
|
|
2055
|
-
this.usePersistence = options.usePersistence;
|
|
2056
2067
|
this.pid = options.pid || null; // pass pid to test out storage lock contention scenarios
|
|
2057
2068
|
|
|
2058
2069
|
this.memQueue = [];
|
|
@@ -2524,7 +2535,12 @@
|
|
|
2524
2535
|
this.flush();
|
|
2525
2536
|
} else if (
|
|
2526
2537
|
_.isObject(res) &&
|
|
2527
|
-
(
|
|
2538
|
+
(
|
|
2539
|
+
res.httpStatusCode >= 500
|
|
2540
|
+
|| res.httpStatusCode === 429
|
|
2541
|
+
|| (res.httpStatusCode <= 0 && !isOnline())
|
|
2542
|
+
|| res.error === 'timeout'
|
|
2543
|
+
)
|
|
2528
2544
|
) {
|
|
2529
2545
|
// network or API error, or 429 Too Many Requests, retry
|
|
2530
2546
|
var retryMS = this.flushInterval * 2;
|
|
@@ -4244,10 +4260,10 @@
|
|
|
4244
4260
|
'record_block_selector': 'img, video',
|
|
4245
4261
|
'record_collect_fonts': false,
|
|
4246
4262
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
4247
|
-
'record_inline_images': false,
|
|
4248
4263
|
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|
|
4249
4264
|
'record_mask_text_selector': '*',
|
|
4250
4265
|
'record_max_ms': MAX_RECORDING_MS,
|
|
4266
|
+
'record_min_ms': 0,
|
|
4251
4267
|
'record_sessions_percent': 0,
|
|
4252
4268
|
'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
|
|
4253
4269
|
};
|
|
@@ -4496,15 +4512,35 @@
|
|
|
4496
4512
|
|
|
4497
4513
|
MixpanelLib.prototype.get_session_recording_properties = function () {
|
|
4498
4514
|
var props = {};
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
props['$mp_replay_id'] = replay_id;
|
|
4503
|
-
}
|
|
4515
|
+
var replay_id = this._get_session_replay_id();
|
|
4516
|
+
if (replay_id) {
|
|
4517
|
+
props['$mp_replay_id'] = replay_id;
|
|
4504
4518
|
}
|
|
4505
4519
|
return props;
|
|
4506
4520
|
};
|
|
4507
4521
|
|
|
4522
|
+
MixpanelLib.prototype.get_session_replay_url = function () {
|
|
4523
|
+
var replay_url = null;
|
|
4524
|
+
var replay_id = this._get_session_replay_id();
|
|
4525
|
+
if (replay_id) {
|
|
4526
|
+
var query_params = _.HTTPBuildQuery({
|
|
4527
|
+
'replay_id': replay_id,
|
|
4528
|
+
'distinct_id': this.get_distinct_id(),
|
|
4529
|
+
'token': this.get_config('token')
|
|
4530
|
+
});
|
|
4531
|
+
replay_url = 'https://mixpanel.com/projects/replay-redirect?' + query_params;
|
|
4532
|
+
}
|
|
4533
|
+
return replay_url;
|
|
4534
|
+
};
|
|
4535
|
+
|
|
4536
|
+
MixpanelLib.prototype._get_session_replay_id = function () {
|
|
4537
|
+
var replay_id = null;
|
|
4538
|
+
if (this._recorder) {
|
|
4539
|
+
replay_id = this._recorder['replayId'];
|
|
4540
|
+
}
|
|
4541
|
+
return replay_id || null;
|
|
4542
|
+
};
|
|
4543
|
+
|
|
4508
4544
|
// Private methods
|
|
4509
4545
|
|
|
4510
4546
|
MixpanelLib.prototype._loaded = function() {
|
|
@@ -6231,6 +6267,7 @@
|
|
|
6231
6267
|
MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
|
|
6232
6268
|
MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
|
|
6233
6269
|
MixpanelLib.prototype['get_session_recording_properties'] = MixpanelLib.prototype.get_session_recording_properties;
|
|
6270
|
+
MixpanelLib.prototype['get_session_replay_url'] = MixpanelLib.prototype.get_session_replay_url;
|
|
6234
6271
|
MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
|
|
6235
6272
|
|
|
6236
6273
|
// MixpanelPersistence Exports
|