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.umd.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
var Config = {
|
|
8
8
|
DEBUG: false,
|
|
9
|
-
LIB_VERSION: '2.
|
|
9
|
+
LIB_VERSION: '2.52.0'
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -3716,7 +3716,7 @@
|
|
|
3716
3716
|
|
|
3717
3717
|
this.load();
|
|
3718
3718
|
this.update_config(config);
|
|
3719
|
-
this.upgrade(
|
|
3719
|
+
this.upgrade();
|
|
3720
3720
|
this.save();
|
|
3721
3721
|
};
|
|
3722
3722
|
|
|
@@ -3744,49 +3744,12 @@
|
|
|
3744
3744
|
}
|
|
3745
3745
|
};
|
|
3746
3746
|
|
|
3747
|
-
MixpanelPersistence.prototype.upgrade = function(
|
|
3748
|
-
var
|
|
3749
|
-
|
|
3750
|
-
old_cookie;
|
|
3751
|
-
|
|
3752
|
-
if (upgrade_from_old_lib) {
|
|
3753
|
-
old_cookie_name = 'mp_super_properties';
|
|
3754
|
-
// Case where they had a custom cookie name before.
|
|
3755
|
-
if (typeof(upgrade_from_old_lib) === 'string') {
|
|
3756
|
-
old_cookie_name = upgrade_from_old_lib;
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
3760
|
-
|
|
3761
|
-
// remove the cookie
|
|
3762
|
-
this.storage.remove(old_cookie_name);
|
|
3763
|
-
this.storage.remove(old_cookie_name, true);
|
|
3764
|
-
|
|
3765
|
-
if (old_cookie) {
|
|
3766
|
-
this['props'] = _.extend(
|
|
3767
|
-
this['props'],
|
|
3768
|
-
old_cookie['all'],
|
|
3769
|
-
old_cookie['events']
|
|
3770
|
-
);
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3774
|
-
if (!config['cookie_name'] && config['name'] !== 'mixpanel') {
|
|
3775
|
-
// special case to handle people with cookies of the form
|
|
3776
|
-
// mp_TOKEN_INSTANCENAME from the first release of this library
|
|
3777
|
-
old_cookie_name = 'mp_' + config['token'] + '_' + config['name'];
|
|
3778
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
3779
|
-
|
|
3780
|
-
if (old_cookie) {
|
|
3781
|
-
this.storage.remove(old_cookie_name);
|
|
3782
|
-
this.storage.remove(old_cookie_name, true);
|
|
3783
|
-
|
|
3784
|
-
// Save the prop values that were in the cookie from before -
|
|
3785
|
-
// this should only happen once as we delete the old one.
|
|
3786
|
-
this.register_once(old_cookie);
|
|
3787
|
-
}
|
|
3788
|
-
}
|
|
3747
|
+
MixpanelPersistence.prototype.upgrade = function() {
|
|
3748
|
+
var old_cookie,
|
|
3749
|
+
old_localstorage;
|
|
3789
3750
|
|
|
3751
|
+
// if transferring from cookie to localStorage or vice-versa, copy existing
|
|
3752
|
+
// super properties over to new storage mode
|
|
3790
3753
|
if (this.storage === _.localStorage) {
|
|
3791
3754
|
old_cookie = _.cookie.parse(this.name);
|
|
3792
3755
|
|
|
@@ -3796,6 +3759,14 @@
|
|
|
3796
3759
|
if (old_cookie) {
|
|
3797
3760
|
this.register_once(old_cookie);
|
|
3798
3761
|
}
|
|
3762
|
+
} else if (this.storage === _.cookie) {
|
|
3763
|
+
old_localstorage = _.localStorage.parse(this.name);
|
|
3764
|
+
|
|
3765
|
+
_.localStorage.remove(this.name);
|
|
3766
|
+
|
|
3767
|
+
if (old_localstorage) {
|
|
3768
|
+
this.register_once(old_localstorage);
|
|
3769
|
+
}
|
|
3799
3770
|
}
|
|
3800
3771
|
};
|
|
3801
3772
|
|
|
@@ -4231,10 +4202,13 @@
|
|
|
4231
4202
|
'batch_request_timeout_ms': 90000,
|
|
4232
4203
|
'batch_autostart': true,
|
|
4233
4204
|
'hooks': {},
|
|
4234
|
-
'
|
|
4205
|
+
'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
|
|
4206
|
+
'record_block_selector': 'img, video',
|
|
4235
4207
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
4236
|
-
'
|
|
4208
|
+
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|
|
4237
4209
|
'record_mask_text_selector': '*',
|
|
4210
|
+
'record_max_ms': MAX_RECORDING_MS,
|
|
4211
|
+
'record_sessions_percent': 0,
|
|
4238
4212
|
'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
|
|
4239
4213
|
};
|
|
4240
4214
|
|
|
@@ -4485,6 +4459,17 @@
|
|
|
4485
4459
|
}
|
|
4486
4460
|
};
|
|
4487
4461
|
|
|
4462
|
+
MixpanelLib.prototype.get_session_recording_properties = function () {
|
|
4463
|
+
var props = {};
|
|
4464
|
+
if (this._recorder) {
|
|
4465
|
+
var replay_id = this._recorder['replayId'];
|
|
4466
|
+
if (replay_id) {
|
|
4467
|
+
props['$mp_replay_id'] = replay_id;
|
|
4468
|
+
}
|
|
4469
|
+
}
|
|
4470
|
+
return props;
|
|
4471
|
+
};
|
|
4472
|
+
|
|
4488
4473
|
// Private methods
|
|
4489
4474
|
|
|
4490
4475
|
MixpanelLib.prototype._loaded = function() {
|
|
@@ -4492,9 +4477,8 @@
|
|
|
4492
4477
|
this._set_default_superprops();
|
|
4493
4478
|
this['people'].set_once(this['persistence'].get_referrer_info());
|
|
4494
4479
|
|
|
4495
|
-
//
|
|
4496
|
-
//
|
|
4497
|
-
// stop_utm_persistence is `false` by default now but will be default `true` in the future.
|
|
4480
|
+
// `store_google` is now deprecated and previously stored UTM parameters are cleared
|
|
4481
|
+
// from persistence by default.
|
|
4498
4482
|
if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
|
|
4499
4483
|
var utm_params = _.info.campaignParams(null);
|
|
4500
4484
|
_.each(utm_params, function(_utm_value, utm_key) {
|
|
@@ -4508,6 +4492,7 @@
|
|
|
4508
4492
|
// update persistence with info on referrer, UTM params, etc
|
|
4509
4493
|
MixpanelLib.prototype._set_default_superprops = function() {
|
|
4510
4494
|
this['persistence'].update_search_keyword(document$1.referrer);
|
|
4495
|
+
// Registering super properties for UTM persistence by 'store_google' is deprecated.
|
|
4511
4496
|
if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
|
|
4512
4497
|
this.register(_.info.campaignParams());
|
|
4513
4498
|
}
|
|
@@ -5056,13 +5041,6 @@
|
|
|
5056
5041
|
? _.info.marketingParams()
|
|
5057
5042
|
: {};
|
|
5058
5043
|
|
|
5059
|
-
if (this._recorder) {
|
|
5060
|
-
var replay_id = this._recorder['replayId'];
|
|
5061
|
-
if (replay_id) {
|
|
5062
|
-
properties['$mp_replay_id'] = replay_id;
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
|
-
|
|
5066
5044
|
// note: extend writes to the first object, so lets make sure we
|
|
5067
5045
|
// don't write to the persistence properties object and info
|
|
5068
5046
|
// properties object by passing in a new object
|
|
@@ -5074,6 +5052,7 @@
|
|
|
5074
5052
|
marketing_properties,
|
|
5075
5053
|
this['persistence'].properties(),
|
|
5076
5054
|
this.unpersisted_superprops,
|
|
5055
|
+
this.get_session_recording_properties(),
|
|
5077
5056
|
properties
|
|
5078
5057
|
);
|
|
5079
5058
|
|
|
@@ -6181,40 +6160,41 @@
|
|
|
6181
6160
|
// EXPORTS (for closure compiler)
|
|
6182
6161
|
|
|
6183
6162
|
// MixpanelLib Exports
|
|
6184
|
-
MixpanelLib.prototype['init']
|
|
6185
|
-
MixpanelLib.prototype['reset']
|
|
6186
|
-
MixpanelLib.prototype['disable']
|
|
6187
|
-
MixpanelLib.prototype['time_event']
|
|
6188
|
-
MixpanelLib.prototype['track']
|
|
6189
|
-
MixpanelLib.prototype['track_links']
|
|
6190
|
-
MixpanelLib.prototype['track_forms']
|
|
6191
|
-
MixpanelLib.prototype['track_pageview']
|
|
6192
|
-
MixpanelLib.prototype['register']
|
|
6193
|
-
MixpanelLib.prototype['register_once']
|
|
6194
|
-
MixpanelLib.prototype['unregister']
|
|
6195
|
-
MixpanelLib.prototype['identify']
|
|
6196
|
-
MixpanelLib.prototype['alias']
|
|
6197
|
-
MixpanelLib.prototype['name_tag']
|
|
6198
|
-
MixpanelLib.prototype['set_config']
|
|
6199
|
-
MixpanelLib.prototype['get_config']
|
|
6200
|
-
MixpanelLib.prototype['get_property']
|
|
6201
|
-
MixpanelLib.prototype['get_distinct_id']
|
|
6202
|
-
MixpanelLib.prototype['toString']
|
|
6203
|
-
MixpanelLib.prototype['opt_out_tracking']
|
|
6204
|
-
MixpanelLib.prototype['opt_in_tracking']
|
|
6205
|
-
MixpanelLib.prototype['has_opted_out_tracking']
|
|
6206
|
-
MixpanelLib.prototype['has_opted_in_tracking']
|
|
6207
|
-
MixpanelLib.prototype['clear_opt_in_out_tracking']
|
|
6208
|
-
MixpanelLib.prototype['get_group']
|
|
6209
|
-
MixpanelLib.prototype['set_group']
|
|
6210
|
-
MixpanelLib.prototype['add_group']
|
|
6211
|
-
MixpanelLib.prototype['remove_group']
|
|
6212
|
-
MixpanelLib.prototype['track_with_groups']
|
|
6213
|
-
MixpanelLib.prototype['start_batch_senders']
|
|
6214
|
-
MixpanelLib.prototype['stop_batch_senders']
|
|
6215
|
-
MixpanelLib.prototype['start_session_recording']
|
|
6216
|
-
MixpanelLib.prototype['stop_session_recording']
|
|
6217
|
-
MixpanelLib.prototype['
|
|
6163
|
+
MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
|
|
6164
|
+
MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
|
|
6165
|
+
MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
|
|
6166
|
+
MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
|
|
6167
|
+
MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
|
|
6168
|
+
MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
|
|
6169
|
+
MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
|
|
6170
|
+
MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
|
|
6171
|
+
MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
|
|
6172
|
+
MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
|
|
6173
|
+
MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
|
|
6174
|
+
MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
|
|
6175
|
+
MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
|
|
6176
|
+
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
6177
|
+
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
6178
|
+
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
6179
|
+
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
6180
|
+
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
6181
|
+
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
|
6182
|
+
MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
|
|
6183
|
+
MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
|
|
6184
|
+
MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
|
|
6185
|
+
MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
|
|
6186
|
+
MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
|
|
6187
|
+
MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
|
|
6188
|
+
MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
|
|
6189
|
+
MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
|
|
6190
|
+
MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
|
|
6191
|
+
MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
|
|
6192
|
+
MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
|
|
6193
|
+
MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
|
|
6194
|
+
MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
|
|
6195
|
+
MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
|
|
6196
|
+
MixpanelLib.prototype['get_session_recording_properties'] = MixpanelLib.prototype.get_session_recording_properties;
|
|
6197
|
+
MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
|
|
6218
6198
|
|
|
6219
6199
|
// MixpanelPersistence Exports
|
|
6220
6200
|
MixpanelPersistence.prototype['properties'] = MixpanelPersistence.prototype.properties;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mixpanel-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.0",
|
|
4
4
|
"description": "The official Mixpanel JavaScript browser client library",
|
|
5
5
|
"main": "dist/mixpanel.cjs.js",
|
|
6
6
|
"directories": {
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"webpack": "1.12.2"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"rrweb": "2.0.0-alpha.
|
|
63
|
+
"rrweb": "2.0.0-alpha.13"
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/config.js
CHANGED
|
@@ -53,7 +53,7 @@ var MIXPANEL_LIB_URL = '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
|
|
|
53
53
|
|
|
54
54
|
// create shallow clone of the public mixpanel interface
|
|
55
55
|
// Note: only supports 1 additional level atm, e.g. mixpanel.people.set, not mixpanel.people.set.do_something_else.
|
|
56
|
-
functions = "disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(' ');
|
|
56
|
+
functions = "disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders start_session_recording stop_session_recording people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(' ');
|
|
57
57
|
for (i = 0; i < functions.length; i++) {
|
|
58
58
|
_set_and_defer(target, functions[i]);
|
|
59
59
|
}
|
package/src/mixpanel-core.js
CHANGED
|
@@ -138,10 +138,13 @@ var DEFAULT_CONFIG = {
|
|
|
138
138
|
'batch_request_timeout_ms': 90000,
|
|
139
139
|
'batch_autostart': true,
|
|
140
140
|
'hooks': {},
|
|
141
|
-
'
|
|
141
|
+
'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
|
|
142
|
+
'record_block_selector': 'img, video',
|
|
142
143
|
'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
|
|
143
|
-
'
|
|
144
|
+
'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
|
|
144
145
|
'record_mask_text_selector': '*',
|
|
146
|
+
'record_max_ms': MAX_RECORDING_MS,
|
|
147
|
+
'record_sessions_percent': 0,
|
|
145
148
|
'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
|
|
146
149
|
};
|
|
147
150
|
|
|
@@ -392,6 +395,17 @@ MixpanelLib.prototype.stop_session_recording = function () {
|
|
|
392
395
|
}
|
|
393
396
|
};
|
|
394
397
|
|
|
398
|
+
MixpanelLib.prototype.get_session_recording_properties = function () {
|
|
399
|
+
var props = {};
|
|
400
|
+
if (this._recorder) {
|
|
401
|
+
var replay_id = this._recorder['replayId'];
|
|
402
|
+
if (replay_id) {
|
|
403
|
+
props['$mp_replay_id'] = replay_id;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return props;
|
|
407
|
+
};
|
|
408
|
+
|
|
395
409
|
// Private methods
|
|
396
410
|
|
|
397
411
|
MixpanelLib.prototype._loaded = function() {
|
|
@@ -399,9 +413,8 @@ MixpanelLib.prototype._loaded = function() {
|
|
|
399
413
|
this._set_default_superprops();
|
|
400
414
|
this['people'].set_once(this['persistence'].get_referrer_info());
|
|
401
415
|
|
|
402
|
-
//
|
|
403
|
-
//
|
|
404
|
-
// stop_utm_persistence is `false` by default now but will be default `true` in the future.
|
|
416
|
+
// `store_google` is now deprecated and previously stored UTM parameters are cleared
|
|
417
|
+
// from persistence by default.
|
|
405
418
|
if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
|
|
406
419
|
var utm_params = _.info.campaignParams(null);
|
|
407
420
|
_.each(utm_params, function(_utm_value, utm_key) {
|
|
@@ -415,6 +428,7 @@ MixpanelLib.prototype._loaded = function() {
|
|
|
415
428
|
// update persistence with info on referrer, UTM params, etc
|
|
416
429
|
MixpanelLib.prototype._set_default_superprops = function() {
|
|
417
430
|
this['persistence'].update_search_keyword(document.referrer);
|
|
431
|
+
// Registering super properties for UTM persistence by 'store_google' is deprecated.
|
|
418
432
|
if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
|
|
419
433
|
this.register(_.info.campaignParams());
|
|
420
434
|
}
|
|
@@ -963,13 +977,6 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
963
977
|
? _.info.marketingParams()
|
|
964
978
|
: {};
|
|
965
979
|
|
|
966
|
-
if (this._recorder) {
|
|
967
|
-
var replay_id = this._recorder['replayId'];
|
|
968
|
-
if (replay_id) {
|
|
969
|
-
properties['$mp_replay_id'] = replay_id;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
973
980
|
// note: extend writes to the first object, so lets make sure we
|
|
974
981
|
// don't write to the persistence properties object and info
|
|
975
982
|
// properties object by passing in a new object
|
|
@@ -981,6 +988,7 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro
|
|
|
981
988
|
marketing_properties,
|
|
982
989
|
this['persistence'].properties(),
|
|
983
990
|
this.unpersisted_superprops,
|
|
991
|
+
this.get_session_recording_properties(),
|
|
984
992
|
properties
|
|
985
993
|
);
|
|
986
994
|
|
|
@@ -2088,40 +2096,41 @@ MixpanelLib.prototype.report_error = function(msg, err) {
|
|
|
2088
2096
|
// EXPORTS (for closure compiler)
|
|
2089
2097
|
|
|
2090
2098
|
// MixpanelLib Exports
|
|
2091
|
-
MixpanelLib.prototype['init']
|
|
2092
|
-
MixpanelLib.prototype['reset']
|
|
2093
|
-
MixpanelLib.prototype['disable']
|
|
2094
|
-
MixpanelLib.prototype['time_event']
|
|
2095
|
-
MixpanelLib.prototype['track']
|
|
2096
|
-
MixpanelLib.prototype['track_links']
|
|
2097
|
-
MixpanelLib.prototype['track_forms']
|
|
2098
|
-
MixpanelLib.prototype['track_pageview']
|
|
2099
|
-
MixpanelLib.prototype['register']
|
|
2100
|
-
MixpanelLib.prototype['register_once']
|
|
2101
|
-
MixpanelLib.prototype['unregister']
|
|
2102
|
-
MixpanelLib.prototype['identify']
|
|
2103
|
-
MixpanelLib.prototype['alias']
|
|
2104
|
-
MixpanelLib.prototype['name_tag']
|
|
2105
|
-
MixpanelLib.prototype['set_config']
|
|
2106
|
-
MixpanelLib.prototype['get_config']
|
|
2107
|
-
MixpanelLib.prototype['get_property']
|
|
2108
|
-
MixpanelLib.prototype['get_distinct_id']
|
|
2109
|
-
MixpanelLib.prototype['toString']
|
|
2110
|
-
MixpanelLib.prototype['opt_out_tracking']
|
|
2111
|
-
MixpanelLib.prototype['opt_in_tracking']
|
|
2112
|
-
MixpanelLib.prototype['has_opted_out_tracking']
|
|
2113
|
-
MixpanelLib.prototype['has_opted_in_tracking']
|
|
2114
|
-
MixpanelLib.prototype['clear_opt_in_out_tracking']
|
|
2115
|
-
MixpanelLib.prototype['get_group']
|
|
2116
|
-
MixpanelLib.prototype['set_group']
|
|
2117
|
-
MixpanelLib.prototype['add_group']
|
|
2118
|
-
MixpanelLib.prototype['remove_group']
|
|
2119
|
-
MixpanelLib.prototype['track_with_groups']
|
|
2120
|
-
MixpanelLib.prototype['start_batch_senders']
|
|
2121
|
-
MixpanelLib.prototype['stop_batch_senders']
|
|
2122
|
-
MixpanelLib.prototype['start_session_recording']
|
|
2123
|
-
MixpanelLib.prototype['stop_session_recording']
|
|
2124
|
-
MixpanelLib.prototype['
|
|
2099
|
+
MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
|
|
2100
|
+
MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
|
|
2101
|
+
MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
|
|
2102
|
+
MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
|
|
2103
|
+
MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
|
|
2104
|
+
MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
|
|
2105
|
+
MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
|
|
2106
|
+
MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
|
|
2107
|
+
MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
|
|
2108
|
+
MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
|
|
2109
|
+
MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
|
|
2110
|
+
MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
|
|
2111
|
+
MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
|
|
2112
|
+
MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
|
|
2113
|
+
MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
|
|
2114
|
+
MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
|
|
2115
|
+
MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
|
|
2116
|
+
MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
|
|
2117
|
+
MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
|
|
2118
|
+
MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
|
|
2119
|
+
MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
|
|
2120
|
+
MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
|
|
2121
|
+
MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
|
|
2122
|
+
MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
|
|
2123
|
+
MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
|
|
2124
|
+
MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
|
|
2125
|
+
MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
|
|
2126
|
+
MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
|
|
2127
|
+
MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
|
|
2128
|
+
MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
|
|
2129
|
+
MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
|
|
2130
|
+
MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
|
|
2131
|
+
MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
|
|
2132
|
+
MixpanelLib.prototype['get_session_recording_properties'] = MixpanelLib.prototype.get_session_recording_properties;
|
|
2133
|
+
MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
|
|
2125
2134
|
|
|
2126
2135
|
// MixpanelPersistence Exports
|
|
2127
2136
|
MixpanelPersistence.prototype['properties'] = MixpanelPersistence.prototype.properties;
|
|
@@ -66,7 +66,7 @@ var MixpanelPersistence = function(config) {
|
|
|
66
66
|
|
|
67
67
|
this.load();
|
|
68
68
|
this.update_config(config);
|
|
69
|
-
this.upgrade(
|
|
69
|
+
this.upgrade();
|
|
70
70
|
this.save();
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -94,49 +94,12 @@ MixpanelPersistence.prototype.load = function() {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
MixpanelPersistence.prototype.upgrade = function(
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
old_cookie;
|
|
101
|
-
|
|
102
|
-
if (upgrade_from_old_lib) {
|
|
103
|
-
old_cookie_name = 'mp_super_properties';
|
|
104
|
-
// Case where they had a custom cookie name before.
|
|
105
|
-
if (typeof(upgrade_from_old_lib) === 'string') {
|
|
106
|
-
old_cookie_name = upgrade_from_old_lib;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
110
|
-
|
|
111
|
-
// remove the cookie
|
|
112
|
-
this.storage.remove(old_cookie_name);
|
|
113
|
-
this.storage.remove(old_cookie_name, true);
|
|
114
|
-
|
|
115
|
-
if (old_cookie) {
|
|
116
|
-
this['props'] = _.extend(
|
|
117
|
-
this['props'],
|
|
118
|
-
old_cookie['all'],
|
|
119
|
-
old_cookie['events']
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (!config['cookie_name'] && config['name'] !== 'mixpanel') {
|
|
125
|
-
// special case to handle people with cookies of the form
|
|
126
|
-
// mp_TOKEN_INSTANCENAME from the first release of this library
|
|
127
|
-
old_cookie_name = 'mp_' + config['token'] + '_' + config['name'];
|
|
128
|
-
old_cookie = this.storage.parse(old_cookie_name);
|
|
129
|
-
|
|
130
|
-
if (old_cookie) {
|
|
131
|
-
this.storage.remove(old_cookie_name);
|
|
132
|
-
this.storage.remove(old_cookie_name, true);
|
|
133
|
-
|
|
134
|
-
// Save the prop values that were in the cookie from before -
|
|
135
|
-
// this should only happen once as we delete the old one.
|
|
136
|
-
this.register_once(old_cookie);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
97
|
+
MixpanelPersistence.prototype.upgrade = function() {
|
|
98
|
+
var old_cookie,
|
|
99
|
+
old_localstorage;
|
|
139
100
|
|
|
101
|
+
// if transferring from cookie to localStorage or vice-versa, copy existing
|
|
102
|
+
// super properties over to new storage mode
|
|
140
103
|
if (this.storage === _.localStorage) {
|
|
141
104
|
old_cookie = _.cookie.parse(this.name);
|
|
142
105
|
|
|
@@ -146,6 +109,14 @@ MixpanelPersistence.prototype.upgrade = function(config) {
|
|
|
146
109
|
if (old_cookie) {
|
|
147
110
|
this.register_once(old_cookie);
|
|
148
111
|
}
|
|
112
|
+
} else if (this.storage === _.cookie) {
|
|
113
|
+
old_localstorage = _.localStorage.parse(this.name);
|
|
114
|
+
|
|
115
|
+
_.localStorage.remove(this.name);
|
|
116
|
+
|
|
117
|
+
if (old_localstorage) {
|
|
118
|
+
this.register_once(old_localstorage);
|
|
119
|
+
}
|
|
149
120
|
}
|
|
150
121
|
};
|
|
151
122
|
|
package/src/recorder/index.js
CHANGED
|
@@ -66,7 +66,10 @@ MixpanelRecorder.prototype.startRecording = function () {
|
|
|
66
66
|
resetIdleTimeout();
|
|
67
67
|
}, this),
|
|
68
68
|
'maskAllInputs': true,
|
|
69
|
-
'maskTextSelector': this.get_config('record_mask_text_selector')
|
|
69
|
+
'maskTextSelector': this.get_config('record_mask_text_selector'),
|
|
70
|
+
'blockSelector': this.get_config('record_block_selector'),
|
|
71
|
+
'maskTextClass': this.get_config('record_mask_text_class'),
|
|
72
|
+
'blockClass': this.get_config('record_block_class'),
|
|
70
73
|
});
|
|
71
74
|
|
|
72
75
|
resetIdleTimeout();
|