mixpanel-browser 2.50.0 → 2.52.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/.github/workflows/tests.yml +9 -10
- package/dist/mixpanel-js-wrapper.js +1 -1
- package/dist/mixpanel-js-wrapper.min.js +1 -1
- package/dist/mixpanel-jslib-snippet.min.js +1 -1
- package/dist/mixpanel-jslib-snippet.min.test.js +1 -1
- package/dist/mixpanel-recorder.js +1371 -812
- package/dist/mixpanel-recorder.min.js +24 -10
- package/dist/mixpanel.amd.js +70 -90
- package/dist/mixpanel.cjs.js +70 -90
- package/dist/mixpanel.globals.js +70 -90
- package/dist/mixpanel.min.js +89 -89
- package/dist/mixpanel.umd.js +70 -90
- package/package.json +2 -2
- package/src/config.js +1 -1
- package/src/loaders/mixpanel-jslib-snippet.js +1 -1
- package/src/mixpanel-core.js +55 -46
- package/src/mixpanel-persistence.js +14 -43
- package/src/recorder/index.js +4 -1
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.52.0'
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -3713,7 +3713,7 @@
|
|
|
3713
3713
|
|
|
3714
3714
|
this.load();
|
|
3715
3715
|
this.update_config(config);
|
|
3716
|
-
this.upgrade(
|
|
3716
|
+
this.upgrade();
|
|
3717
3717
|
this.save();
|
|
3718
3718
|
};
|
|
3719
3719
|
|
|
@@ -3741,49 +3741,12 @@
|
|
|
3741
3741
|
}
|
|
3742
3742
|
};
|
|
3743
3743
|
|
|
3744
|
-
MixpanelPersistence.prototype.upgrade = function(
|
|
3745
|
-
var
|
|
3746
|
-
|
|
3747
|
-
old_cookie;
|
|
3748
|
-
|
|
3749
|
-
if (upgrade_from_old_lib) {
|
|
3750
|
-
old_cookie_name = 'mp_super_properties';
|
|
3751
|
-
// Case where they had a custom cookie name before.
|
|
3752
|
-
if (typeof(upgrade_from_old_lib) === 'string') {
|
|
3753
|
-
old_cookie_name = upgrade_from_old_lib;
|
|
3754
|
-
}
|
|
3755
|
-
|
|
3756
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
3757
|
-
|
|
3758
|
-
// remove the cookie
|
|
3759
|
-
this.storage.remove(old_cookie_name);
|
|
3760
|
-
this.storage.remove(old_cookie_name, true);
|
|
3761
|
-
|
|
3762
|
-
if (old_cookie) {
|
|
3763
|
-
this['props'] = _.extend(
|
|
3764
|
-
this['props'],
|
|
3765
|
-
old_cookie['all'],
|
|
3766
|
-
old_cookie['events']
|
|
3767
|
-
);
|
|
3768
|
-
}
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3771
|
-
if (!config['cookie_name'] && config['name'] !== 'mixpanel') {
|
|
3772
|
-
// special case to handle people with cookies of the form
|
|
3773
|
-
// mp_TOKEN_INSTANCENAME from the first release of this library
|
|
3774
|
-
old_cookie_name = 'mp_' + config['token'] + '_' + config['name'];
|
|
3775
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
3776
|
-
|
|
3777
|
-
if (old_cookie) {
|
|
3778
|
-
this.storage.remove(old_cookie_name);
|
|
3779
|
-
this.storage.remove(old_cookie_name, true);
|
|
3780
|
-
|
|
3781
|
-
// Save the prop values that were in the cookie from before -
|
|
3782
|
-
// this should only happen once as we delete the old one.
|
|
3783
|
-
this.register_once(old_cookie);
|
|
3784
|
-
}
|
|
3785
|
-
}
|
|
3744
|
+
MixpanelPersistence.prototype.upgrade = function() {
|
|
3745
|
+
var old_cookie,
|
|
3746
|
+
old_localstorage;
|
|
3786
3747
|
|
|
3748
|
+
// if transferring from cookie to localStorage or vice-versa, copy existing
|
|
3749
|
+
// super properties over to new storage mode
|
|
3787
3750
|
if (this.storage === _.localStorage) {
|
|
3788
3751
|
old_cookie = _.cookie.parse(this.name);
|
|
3789
3752
|
|
|
@@ -3793,6 +3756,14 @@
|
|
|
3793
3756
|
if (old_cookie) {
|
|
3794
3757
|
this.register_once(old_cookie);
|
|
3795
3758
|
}
|
|
3759
|
+
} else if (this.storage === _.cookie) {
|
|
3760
|
+
old_localstorage = _.localStorage.parse(this.name);
|
|
3761
|
+
|
|
3762
|
+
_.localStorage.remove(this.name);
|
|
3763
|
+
|
|
3764
|
+
if (old_localstorage) {
|
|
3765
|
+
this.register_once(old_localstorage);
|
|
3766
|
+
}
|
|
3796
3767
|
}
|
|
3797
3768
|
};
|
|
3798
3769
|
|
|
@@ -4228,10 +4199,13 @@
|
|
|
4228
4199
|
'batch_request_timeout_ms': 90000,
|
|
4229
4200
|
'batch_autostart': true,
|
|
4230
4201
|
'hooks': {},
|
|
4231
|
-
'
|
|
4202
|
+
'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
|
|
4203
|
+
'record_block_selector': 'img, video',
|
|
4232
4204
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
4233
|
-
'
|
|
4205
|
+
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|
|
4234
4206
|
'record_mask_text_selector': '*',
|
|
4207
|
+
'record_max_ms': MAX_RECORDING_MS,
|
|
4208
|
+
'record_sessions_percent': 0,
|
|
4235
4209
|
'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
|
|
4236
4210
|
};
|
|
4237
4211
|
|
|
@@ -4482,6 +4456,17 @@
|
|
|
4482
4456
|
}
|
|
4483
4457
|
};
|
|
4484
4458
|
|
|
4459
|
+
MixpanelLib.prototype.get_session_recording_properties = function () {
|
|
4460
|
+
var props = {};
|
|
4461
|
+
if (this._recorder) {
|
|
4462
|
+
var replay_id = this._recorder['replayId'];
|
|
4463
|
+
if (replay_id) {
|
|
4464
|
+
props['$mp_replay_id'] = replay_id;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
return props;
|
|
4468
|
+
};
|
|
4469
|
+
|
|
4485
4470
|
// Private methods
|
|
4486
4471
|
|
|
4487
4472
|
MixpanelLib.prototype._loaded = function() {
|
|
@@ -4489,9 +4474,8 @@
|
|
|
4489
4474
|
this._set_default_superprops();
|
|
4490
4475
|
this['people'].set_once(this['persistence'].get_referrer_info());
|
|
4491
4476
|
|
|
4492
|
-
//
|
|
4493
|
-
//
|
|
4494
|
-
// stop_utm_persistence is `false` by default now but will be default `true` in the future.
|
|
4477
|
+
// `store_google` is now deprecated and previously stored UTM parameters are cleared
|
|
4478
|
+
// from persistence by default.
|
|
4495
4479
|
if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
|
|
4496
4480
|
var utm_params = _.info.campaignParams(null);
|
|
4497
4481
|
_.each(utm_params, function(_utm_value, utm_key) {
|
|
@@ -4505,6 +4489,7 @@
|
|
|
4505
4489
|
// update persistence with info on referrer, UTM params, etc
|
|
4506
4490
|
MixpanelLib.prototype._set_default_superprops = function() {
|
|
4507
4491
|
this['persistence'].update_search_keyword(document$1.referrer);
|
|
4492
|
+
// Registering super properties for UTM persistence by 'store_google' is deprecated.
|
|
4508
4493
|
if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
|
|
4509
4494
|
this.register(_.info.campaignParams());
|
|
4510
4495
|
}
|
|
@@ -5053,13 +5038,6 @@
|
|
|
5053
5038
|
? _.info.marketingParams()
|
|
5054
5039
|
: {};
|
|
5055
5040
|
|
|
5056
|
-
if (this._recorder) {
|
|
5057
|
-
var replay_id = this._recorder['replayId'];
|
|
5058
|
-
if (replay_id) {
|
|
5059
|
-
properties['$mp_replay_id'] = replay_id;
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
|
|
5063
5041
|
// note: extend writes to the first object, so lets make sure we
|
|
5064
5042
|
// don't write to the persistence properties object and info
|
|
5065
5043
|
// properties object by passing in a new object
|
|
@@ -5071,6 +5049,7 @@
|
|
|
5071
5049
|
marketing_properties,
|
|
5072
5050
|
this['persistence'].properties(),
|
|
5073
5051
|
this.unpersisted_superprops,
|
|
5052
|
+
this.get_session_recording_properties(),
|
|
5074
5053
|
properties
|
|
5075
5054
|
);
|
|
5076
5055
|
|
|
@@ -6178,40 +6157,41 @@
|
|
|
6178
6157
|
// EXPORTS (for closure compiler)
|
|
6179
6158
|
|
|
6180
6159
|
// MixpanelLib Exports
|
|
6181
|
-
MixpanelLib.prototype['init']
|
|
6182
|
-
MixpanelLib.prototype['reset']
|
|
6183
|
-
MixpanelLib.prototype['disable']
|
|
6184
|
-
MixpanelLib.prototype['time_event']
|
|
6185
|
-
MixpanelLib.prototype['track']
|
|
6186
|
-
MixpanelLib.prototype['track_links']
|
|
6187
|
-
MixpanelLib.prototype['track_forms']
|
|
6188
|
-
MixpanelLib.prototype['track_pageview']
|
|
6189
|
-
MixpanelLib.prototype['register']
|
|
6190
|
-
MixpanelLib.prototype['register_once']
|
|
6191
|
-
MixpanelLib.prototype['unregister']
|
|
6192
|
-
MixpanelLib.prototype['identify']
|
|
6193
|
-
MixpanelLib.prototype['alias']
|
|
6194
|
-
MixpanelLib.prototype['name_tag']
|
|
6195
|
-
MixpanelLib.prototype['set_config']
|
|
6196
|
-
MixpanelLib.prototype['get_config']
|
|
6197
|
-
MixpanelLib.prototype['get_property']
|
|
6198
|
-
MixpanelLib.prototype['get_distinct_id']
|
|
6199
|
-
MixpanelLib.prototype['toString']
|
|
6200
|
-
MixpanelLib.prototype['opt_out_tracking']
|
|
6201
|
-
MixpanelLib.prototype['opt_in_tracking']
|
|
6202
|
-
MixpanelLib.prototype['has_opted_out_tracking']
|
|
6203
|
-
MixpanelLib.prototype['has_opted_in_tracking']
|
|
6204
|
-
MixpanelLib.prototype['clear_opt_in_out_tracking']
|
|
6205
|
-
MixpanelLib.prototype['get_group']
|
|
6206
|
-
MixpanelLib.prototype['set_group']
|
|
6207
|
-
MixpanelLib.prototype['add_group']
|
|
6208
|
-
MixpanelLib.prototype['remove_group']
|
|
6209
|
-
MixpanelLib.prototype['track_with_groups']
|
|
6210
|
-
MixpanelLib.prototype['start_batch_senders']
|
|
6211
|
-
MixpanelLib.prototype['stop_batch_senders']
|
|
6212
|
-
MixpanelLib.prototype['start_session_recording']
|
|
6213
|
-
MixpanelLib.prototype['stop_session_recording']
|
|
6214
|
-
MixpanelLib.prototype['
|
|
6160
|
+
MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
|
|
6161
|
+
MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
|
|
6162
|
+
MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
|
|
6163
|
+
MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
|
|
6164
|
+
MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
|
|
6165
|
+
MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
|
|
6166
|
+
MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
|
|
6167
|
+
MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
|
|
6168
|
+
MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
|
|
6169
|
+
MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
|
|
6170
|
+
MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
|
|
6171
|
+
MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
|
|
6172
|
+
MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
|
|
6173
|
+
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
6174
|
+
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
6175
|
+
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
6176
|
+
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
6177
|
+
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
6178
|
+
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
|
6179
|
+
MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
|
|
6180
|
+
MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
|
|
6181
|
+
MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
|
|
6182
|
+
MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
|
|
6183
|
+
MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
|
|
6184
|
+
MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
|
|
6185
|
+
MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
|
|
6186
|
+
MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
|
|
6187
|
+
MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
|
|
6188
|
+
MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
|
|
6189
|
+
MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
|
|
6190
|
+
MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
|
|
6191
|
+
MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
|
|
6192
|
+
MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
|
|
6193
|
+
MixpanelLib.prototype['get_session_recording_properties'] = MixpanelLib.prototype.get_session_recording_properties;
|
|
6194
|
+
MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
|
|
6215
6195
|
|
|
6216
6196
|
// MixpanelPersistence Exports
|
|
6217
6197
|
MixpanelPersistence.prototype['properties'] = MixpanelPersistence.prototype.properties;
|