mixpanel-browser 2.48.1 → 2.50.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.
@@ -1,21 +1,23 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
3
  typeof define === 'function' && define.amd ? define(factory) :
4
- (global.mixpanel = factory());
5
- }(this, function () { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mixpanel = factory());
5
+ })(this, (function () { 'use strict';
6
6
 
7
7
  var Config = {
8
8
  DEBUG: false,
9
- LIB_VERSION: '2.48.1'
9
+ LIB_VERSION: '2.50.0'
10
10
  };
11
11
 
12
+ /* eslint camelcase: "off", eqeqeq: "off" */
13
+
12
14
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
13
- var window$1;
15
+ var win;
14
16
  if (typeof(window) === 'undefined') {
15
17
  var loc = {
16
18
  hostname: ''
17
19
  };
18
- window$1 = {
20
+ win = {
19
21
  navigator: { userAgent: '' },
20
22
  document: {
21
23
  location: loc,
@@ -25,32 +27,37 @@
25
27
  location: loc
26
28
  };
27
29
  } else {
28
- window$1 = window;
30
+ win = window;
29
31
  }
30
32
 
33
+ // Maximum allowed session recording length
34
+ var MAX_RECORDING_MS = 24 * 60 * 60 * 1000; // 24 hours
35
+
31
36
  /*
32
37
  * Saved references to long variable names, so that closure compiler can
33
38
  * minimize file size.
34
39
  */
35
40
 
36
- var ArrayProto = Array.prototype;
37
- var FuncProto = Function.prototype;
38
- var ObjProto = Object.prototype;
39
- var slice = ArrayProto.slice;
40
- var toString = ObjProto.toString;
41
- var hasOwnProperty = ObjProto.hasOwnProperty;
42
- var windowConsole = window$1.console;
43
- var navigator = window$1.navigator;
44
- var document$1 = window$1.document;
45
- var windowOpera = window$1.opera;
46
- var screen = window$1.screen;
47
- var userAgent = navigator.userAgent;
48
- var nativeBind = FuncProto.bind;
49
- var nativeForEach = ArrayProto.forEach;
50
- var nativeIndexOf = ArrayProto.indexOf;
51
- var nativeMap = ArrayProto.map;
52
- var nativeIsArray = Array.isArray;
53
- var breaker = {};
41
+ var ArrayProto = Array.prototype,
42
+ FuncProto = Function.prototype,
43
+ ObjProto = Object.prototype,
44
+ slice = ArrayProto.slice,
45
+ toString = ObjProto.toString,
46
+ hasOwnProperty = ObjProto.hasOwnProperty,
47
+ windowConsole = win.console,
48
+ navigator = win.navigator,
49
+ document$1 = win.document,
50
+ windowOpera = win.opera,
51
+ screen = win.screen,
52
+ userAgent = navigator.userAgent;
53
+
54
+ var nativeBind = FuncProto.bind,
55
+ nativeForEach = ArrayProto.forEach,
56
+ nativeIndexOf = ArrayProto.indexOf,
57
+ nativeMap = ArrayProto.map,
58
+ nativeIsArray = Array.isArray,
59
+ breaker = {};
60
+
54
61
  var _ = {
55
62
  trim: function(str) {
56
63
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
@@ -840,8 +847,8 @@
840
847
  var T = function() {
841
848
  var time = 1 * new Date(); // cross-browser version of Date.now()
842
849
  var ticks;
843
- if (window$1.performance && window$1.performance.now) {
844
- ticks = window$1.performance.now();
850
+ if (win.performance && win.performance.now) {
851
+ ticks = win.performance.now();
845
852
  } else {
846
853
  // fall back to busy loop
847
854
  ticks = 0;
@@ -905,6 +912,7 @@
905
912
  // sending false tracking data
906
913
  var BLOCKED_UA_STRS = [
907
914
  'ahrefsbot',
915
+ 'ahrefssiteaudit',
908
916
  'baiduspider',
909
917
  'bingbot',
910
918
  'bingpreview',
@@ -1625,7 +1633,14 @@
1625
1633
  return '';
1626
1634
  },
1627
1635
 
1628
- properties: function() {
1636
+ currentUrl: function() {
1637
+ return win.location.href;
1638
+ },
1639
+
1640
+ properties: function(extra_props) {
1641
+ if (typeof extra_props !== 'object') {
1642
+ extra_props = {};
1643
+ }
1629
1644
  return _.extend(_.strip_empty_properties({
1630
1645
  '$os': _.info.os(),
1631
1646
  '$browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
@@ -1633,7 +1648,7 @@
1633
1648
  '$referring_domain': _.info.referringDomain(document$1.referrer),
1634
1649
  '$device': _.info.device(userAgent)
1635
1650
  }), {
1636
- '$current_url': window$1.location.href,
1651
+ '$current_url': _.info.currentUrl(),
1637
1652
  '$browser_version': _.info.browserVersion(userAgent, navigator.vendor, windowOpera),
1638
1653
  '$screen_height': screen.height,
1639
1654
  '$screen_width': screen.width,
@@ -1641,7 +1656,7 @@
1641
1656
  '$lib_version': Config.LIB_VERSION,
1642
1657
  '$insert_id': cheap_guid(),
1643
1658
  'time': _.timestamp() / 1000 // epoch time in seconds
1644
- });
1659
+ }, _.strip_empty_properties(extra_props));
1645
1660
  },
1646
1661
 
1647
1662
  people_properties: function() {
@@ -1656,10 +1671,10 @@
1656
1671
  mpPageViewProperties: function() {
1657
1672
  return _.strip_empty_properties({
1658
1673
  'current_page_title': document$1.title,
1659
- 'current_domain': window$1.location.hostname,
1660
- 'current_url_path': window$1.location.pathname,
1661
- 'current_url_protocol': window$1.location.protocol,
1662
- 'current_url_search': window$1.location.search
1674
+ 'current_domain': win.location.hostname,
1675
+ 'current_url_path': win.location.pathname,
1676
+ 'current_url_protocol': win.location.protocol,
1677
+ 'current_url_search': win.location.search
1663
1678
  });
1664
1679
  }
1665
1680
  };
@@ -1697,8 +1712,7 @@
1697
1712
  return matches ? matches[0] : '';
1698
1713
  };
1699
1714
 
1700
- var JSONStringify = null;
1701
- var JSONParse = null;
1715
+ var JSONStringify = null, JSONParse = null;
1702
1716
  if (typeof JSON !== 'undefined') {
1703
1717
  JSONStringify = JSON.stringify;
1704
1718
  JSONParse = JSON.parse;
@@ -1719,6 +1733,8 @@
1719
1733
  _['info']['browserVersion'] = _.info.browserVersion;
1720
1734
  _['info']['properties'] = _.info.properties;
1721
1735
 
1736
+ /* eslint camelcase: "off" */
1737
+
1722
1738
  /**
1723
1739
  * DomTracker Object
1724
1740
  * @constructor
@@ -1868,8 +1884,6 @@
1868
1884
  }, 0);
1869
1885
  };
1870
1886
 
1871
- // eslint-disable-line camelcase
1872
-
1873
1887
  var logger$2 = console_with_prefix('lock');
1874
1888
 
1875
1889
  /**
@@ -2016,8 +2030,6 @@
2016
2030
  }
2017
2031
  };
2018
2032
 
2019
- // eslint-disable-line camelcase
2020
-
2021
2033
  var logger$1 = console_with_prefix('batch');
2022
2034
 
2023
2035
  /**
@@ -2295,8 +2307,6 @@
2295
2307
  this.storage.removeItem(this.storageKey);
2296
2308
  };
2297
2309
 
2298
- // eslint-disable-line camelcase
2299
-
2300
2310
  // maximum interval between request retries after exponential backoff
2301
2311
  var MAX_RETRY_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes
2302
2312
 
@@ -2591,6 +2601,19 @@
2591
2601
  }
2592
2602
  };
2593
2603
 
2604
+ /**
2605
+ * GDPR utils
2606
+ *
2607
+ * The General Data Protection Regulation (GDPR) is a regulation in EU law on data protection
2608
+ * and privacy for all individuals within the European Union. It addresses the export of personal
2609
+ * data outside the EU. The GDPR aims primarily to give control back to citizens and residents
2610
+ * over their personal data and to simplify the regulatory environment for international business
2611
+ * by unifying the regulation within the EU.
2612
+ *
2613
+ * This set of utilities is intended to enable opt in/out functionality in the Mixpanel JS SDK.
2614
+ * These functions are used internally by the SDK and are not intended to be publicly exposed.
2615
+ */
2616
+
2594
2617
  /**
2595
2618
  * A function used to track a Mixpanel event (e.g. MixpanelLib.track)
2596
2619
  * @callback trackFunction
@@ -2776,14 +2799,14 @@
2776
2799
  if (options && options.ignoreDnt) {
2777
2800
  return false;
2778
2801
  }
2779
- var win = (options && options.window) || window$1;
2780
- var nav = win['navigator'] || {};
2802
+ var win$1 = (options && options.window) || win;
2803
+ var nav = win$1['navigator'] || {};
2781
2804
  var hasDntOn = false;
2782
2805
 
2783
2806
  _.each([
2784
2807
  nav['doNotTrack'], // standard
2785
2808
  nav['msDoNotTrack'],
2786
- win['doNotTrack']
2809
+ win$1['doNotTrack']
2787
2810
  ], function(dntValue) {
2788
2811
  if (_.includes([true, 1, '1', 'yes'], dntValue)) {
2789
2812
  hasDntOn = true;
@@ -2877,6 +2900,8 @@
2877
2900
  };
2878
2901
  }
2879
2902
 
2903
+ /* eslint camelcase: "off" */
2904
+
2880
2905
  /** @const */ var SET_ACTION = '$set';
2881
2906
  /** @const */ var SET_ONCE_ACTION = '$set_once';
2882
2907
  /** @const */ var UNSET_ACTION = '$unset';
@@ -2994,6 +3019,8 @@
2994
3019
  }
2995
3020
  };
2996
3021
 
3022
+ /* eslint camelcase: "off" */
3023
+
2997
3024
  /**
2998
3025
  * Mixpanel Group Object
2999
3026
  * @constructor
@@ -3162,6 +3189,8 @@
3162
3189
  MixpanelGroup.prototype['unset'] = MixpanelGroup.prototype.unset;
3163
3190
  MixpanelGroup.prototype['toString'] = MixpanelGroup.prototype.toString;
3164
3191
 
3192
+ /* eslint camelcase: "off" */
3193
+
3165
3194
  /**
3166
3195
  * Mixpanel People Object
3167
3196
  * @constructor
@@ -3207,7 +3236,6 @@
3207
3236
  data[SET_ACTION] = _.extend(
3208
3237
  {},
3209
3238
  _.info.people_properties(),
3210
- this._mixpanel['persistence'].get_referrer_info(),
3211
3239
  data[SET_ACTION]
3212
3240
  );
3213
3241
  return this._send_request(data, callback);
@@ -3631,6 +3659,8 @@
3631
3659
  MixpanelPeople.prototype['delete_user'] = MixpanelPeople.prototype.delete_user;
3632
3660
  MixpanelPeople.prototype['toString'] = MixpanelPeople.prototype.toString;
3633
3661
 
3662
+ /* eslint camelcase: "off" */
3663
+
3634
3664
  /*
3635
3665
  * Constants
3636
3666
  */
@@ -4080,6 +4110,8 @@
4080
4110
  return timestamp;
4081
4111
  };
4082
4112
 
4113
+ /* eslint camelcase: "off" */
4114
+
4083
4115
  /*
4084
4116
  * Mixpanel JS Library
4085
4117
  *
@@ -4126,7 +4158,7 @@
4126
4158
  */
4127
4159
  // http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
4128
4160
  // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials
4129
- var USE_XHR = (window$1.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4161
+ var USE_XHR = (win.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4130
4162
 
4131
4163
  // IE<10 does not support cross-origin XHR's but script tags
4132
4164
  // with defer won't block window.onload; ENQUEUE_REQUESTS
@@ -4145,7 +4177,8 @@
4145
4177
  var DEFAULT_API_ROUTES = {
4146
4178
  'track': 'track/',
4147
4179
  'engage': 'engage/',
4148
- 'groups': 'groups/'
4180
+ 'groups': 'groups/',
4181
+ 'record': 'record/'
4149
4182
  };
4150
4183
 
4151
4184
  /*
@@ -4167,10 +4200,12 @@
4167
4200
  'cookie_domain': '',
4168
4201
  'cookie_name': '',
4169
4202
  'loaded': NOOP_FUNC,
4203
+ 'mp_loader': null,
4170
4204
  'track_marketing': true,
4171
4205
  'track_pageview': false,
4172
4206
  'skip_first_touch_marketing': false,
4173
4207
  'store_google': true,
4208
+ 'stop_utm_persistence': false,
4174
4209
  'save_referrer': true,
4175
4210
  'test': false,
4176
4211
  'verbose': false,
@@ -4195,7 +4230,12 @@
4195
4230
  'batch_flush_interval_ms': 5000,
4196
4231
  'batch_request_timeout_ms': 90000,
4197
4232
  'batch_autostart': true,
4198
- 'hooks': {}
4233
+ 'hooks': {},
4234
+ 'record_sessions_percent': 0,
4235
+ 'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
4236
+ 'record_max_ms': MAX_RECORDING_MS,
4237
+ 'record_mask_text_selector': '*',
4238
+ 'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
4199
4239
  };
4200
4240
 
4201
4241
  var DOM_LOADED = false;
@@ -4358,7 +4398,7 @@
4358
4398
  });
4359
4399
  } else {
4360
4400
  this.init_batchers();
4361
- if (sendBeacon && window$1.addEventListener) {
4401
+ if (sendBeacon && win.addEventListener) {
4362
4402
  // Before page closes or hides (user tabs away etc), attempt to flush any events
4363
4403
  // queued up via navigator.sendBeacon. Since sendBeacon doesn't report success/failure,
4364
4404
  // events will not be removed from the persistent store; if the site is loaded again,
@@ -4375,12 +4415,12 @@
4375
4415
  this.request_batchers.events.flush({unloading: true});
4376
4416
  }
4377
4417
  }, this);
4378
- window$1.addEventListener('pagehide', function(ev) {
4418
+ win.addEventListener('pagehide', function(ev) {
4379
4419
  if (ev['persisted']) {
4380
4420
  flush_on_unload();
4381
4421
  }
4382
4422
  });
4383
- window$1.addEventListener('visibilitychange', function() {
4423
+ win.addEventListener('visibilitychange', function() {
4384
4424
  if (document$1['visibilityState'] === 'hidden') {
4385
4425
  flush_on_unload();
4386
4426
  }
@@ -4404,8 +4444,44 @@
4404
4444
  }, '');
4405
4445
  }
4406
4446
 
4407
- if (this.get_config('track_pageview')) {
4408
- this.track_pageview();
4447
+ var track_pageview_option = this.get_config('track_pageview');
4448
+ if (track_pageview_option) {
4449
+ this._init_url_change_tracking(track_pageview_option);
4450
+ }
4451
+
4452
+ if (this.get_config('record_sessions_percent') > 0 && Math.random() * 100 <= this.get_config('record_sessions_percent')) {
4453
+ this.start_session_recording();
4454
+ }
4455
+ };
4456
+
4457
+ MixpanelLib.prototype.start_session_recording = addOptOutCheckMixpanelLib(function () {
4458
+ if (!win['MutationObserver']) {
4459
+ console.critical('Browser does not support MutationObserver; skipping session recording');
4460
+ return;
4461
+ }
4462
+
4463
+ var handleLoadedRecorder = _.bind(function() {
4464
+ this._recorder = this._recorder || new win['__mp_recorder'](this);
4465
+ this._recorder['startRecording']();
4466
+ }, this);
4467
+
4468
+ if (_.isUndefined(win['__mp_recorder'])) {
4469
+ var scriptEl = document$1.createElement('script');
4470
+ scriptEl.type = 'text/javascript';
4471
+ scriptEl.async = true;
4472
+ scriptEl.onload = handleLoadedRecorder;
4473
+ scriptEl.src = this.get_config('recorder_src');
4474
+ document$1.head.appendChild(scriptEl);
4475
+ } else {
4476
+ handleLoadedRecorder();
4477
+ }
4478
+ });
4479
+
4480
+ MixpanelLib.prototype.stop_session_recording = function () {
4481
+ if (this._recorder) {
4482
+ this._recorder['stopRecording']();
4483
+ } else {
4484
+ console.critical('Session recorder module not loaded');
4409
4485
  }
4410
4486
  };
4411
4487
 
@@ -4414,12 +4490,25 @@
4414
4490
  MixpanelLib.prototype._loaded = function() {
4415
4491
  this.get_config('loaded')(this);
4416
4492
  this._set_default_superprops();
4493
+ this['people'].set_once(this['persistence'].get_referrer_info());
4494
+
4495
+ // The original 'store_google' functionality will be deprecated and the config will be
4496
+ // used to clear previously managed UTM parameters from persistence.
4497
+ // stop_utm_persistence is `false` by default now but will be default `true` in the future.
4498
+ if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
4499
+ var utm_params = _.info.campaignParams(null);
4500
+ _.each(utm_params, function(_utm_value, utm_key) {
4501
+ // We need to unregister persisted UTM parameters so old values
4502
+ // are not mixed with the new UTM parameters
4503
+ this.unregister(utm_key);
4504
+ }.bind(this));
4505
+ }
4417
4506
  };
4418
4507
 
4419
4508
  // update persistence with info on referrer, UTM params, etc
4420
4509
  MixpanelLib.prototype._set_default_superprops = function() {
4421
4510
  this['persistence'].update_search_keyword(document$1.referrer);
4422
- if (this.get_config('store_google')) {
4511
+ if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
4423
4512
  this.register(_.info.campaignParams());
4424
4513
  }
4425
4514
  if (this.get_config('save_referrer')) {
@@ -4457,6 +4546,55 @@
4457
4546
  return dt.track.apply(dt, args);
4458
4547
  };
4459
4548
 
4549
+ MixpanelLib.prototype._init_url_change_tracking = function(track_pageview_option) {
4550
+ var previous_tracked_url = '';
4551
+ var tracked = this.track_pageview();
4552
+ if (tracked) {
4553
+ previous_tracked_url = _.info.currentUrl();
4554
+ }
4555
+
4556
+ if (_.include(['full-url', 'url-with-path-and-query-string', 'url-with-path'], track_pageview_option)) {
4557
+ win.addEventListener('popstate', function() {
4558
+ win.dispatchEvent(new Event('mp_locationchange'));
4559
+ });
4560
+ win.addEventListener('hashchange', function() {
4561
+ win.dispatchEvent(new Event('mp_locationchange'));
4562
+ });
4563
+ var nativePushState = win.history.pushState;
4564
+ if (typeof nativePushState === 'function') {
4565
+ win.history.pushState = function(state, unused, url) {
4566
+ nativePushState.call(win.history, state, unused, url);
4567
+ win.dispatchEvent(new Event('mp_locationchange'));
4568
+ };
4569
+ }
4570
+ var nativeReplaceState = win.history.replaceState;
4571
+ if (typeof nativeReplaceState === 'function') {
4572
+ win.history.replaceState = function(state, unused, url) {
4573
+ nativeReplaceState.call(win.history, state, unused, url);
4574
+ win.dispatchEvent(new Event('mp_locationchange'));
4575
+ };
4576
+ }
4577
+ win.addEventListener('mp_locationchange', function() {
4578
+ var current_url = _.info.currentUrl();
4579
+ var should_track = false;
4580
+ if (track_pageview_option === 'full-url') {
4581
+ should_track = current_url !== previous_tracked_url;
4582
+ } else if (track_pageview_option === 'url-with-path-and-query-string') {
4583
+ should_track = current_url.split('#')[0] !== previous_tracked_url.split('#')[0];
4584
+ } else if (track_pageview_option === 'url-with-path') {
4585
+ should_track = current_url.split('#')[0].split('?')[0] !== previous_tracked_url.split('#')[0].split('?')[0];
4586
+ }
4587
+
4588
+ if (should_track) {
4589
+ var tracked = this.track_pageview();
4590
+ if (tracked) {
4591
+ previous_tracked_url = current_url;
4592
+ }
4593
+ }
4594
+ }.bind(this));
4595
+ }
4596
+ };
4597
+
4460
4598
  /**
4461
4599
  * _prepare_callback() should be called by callers of _send_request for use
4462
4600
  * as the callback argument.
@@ -4918,6 +5056,13 @@
4918
5056
  ? _.info.marketingParams()
4919
5057
  : {};
4920
5058
 
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
+
4921
5066
  // note: extend writes to the first object, so lets make sure we
4922
5067
  // don't write to the persistence properties object and info
4923
5068
  // properties object by passing in a new object
@@ -4925,7 +5070,7 @@
4925
5070
  // update properties with pageview info and super-properties
4926
5071
  properties = _.extend(
4927
5072
  {},
4928
- _.info.properties(),
5073
+ _.info.properties({'mp_loader': this.get_config('mp_loader')}),
4929
5074
  marketing_properties,
4930
5075
  this['persistence'].properties(),
4931
5076
  this.unpersisted_superprops,
@@ -5089,10 +5234,9 @@
5089
5234
 
5090
5235
  /**
5091
5236
  * Track a default Mixpanel page view event, which includes extra default event properties to
5092
- * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
5093
- * may be turned on for tracking page loads automatically.
5237
+ * improve page view data.
5094
5238
  *
5095
- * ### Usage
5239
+ * ### Usage:
5096
5240
  *
5097
5241
  * // track a default $mp_web_page_view event
5098
5242
  * mixpanel.track_pageview();
@@ -5109,6 +5253,23 @@
5109
5253
  * // views on different products or internal applications that are considered completely separate
5110
5254
  * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
5111
5255
  *
5256
+ * ### Notes:
5257
+ *
5258
+ * The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
5259
+ * may be turned on for tracking page loads automatically.
5260
+ *
5261
+ * // track only page loads
5262
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: true});
5263
+ *
5264
+ * // track when the URL changes in any manner
5265
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'full-url'});
5266
+ *
5267
+ * // track when the URL changes, ignoring any changes in the hash part
5268
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path-and-query-string'});
5269
+ *
5270
+ * // track when the path changes, ignoring any query parameter or hash changes
5271
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path'});
5272
+ *
5112
5273
  * @param {Object} [properties] An optional set of additional properties to send with the page view event
5113
5274
  * @param {Object} [options] Page view tracking options
5114
5275
  * @param {String} [options.event_name] - Alternate name for the tracking event
@@ -5859,7 +6020,7 @@
5859
6020
  /**
5860
6021
  * Opt the user in to data tracking and cookies/localstorage for this Mixpanel instance
5861
6022
  *
5862
- * ### Usage
6023
+ * ### Usage:
5863
6024
  *
5864
6025
  * // opt user in
5865
6026
  * mixpanel.opt_in_tracking();
@@ -5899,7 +6060,7 @@
5899
6060
  /**
5900
6061
  * Opt the user out of data tracking and cookies/localstorage for this Mixpanel instance
5901
6062
  *
5902
- * ### Usage
6063
+ * ### Usage:
5903
6064
  *
5904
6065
  * // opt user out
5905
6066
  * mixpanel.opt_out_tracking();
@@ -5940,7 +6101,7 @@
5940
6101
  /**
5941
6102
  * Check whether the user has opted in to data tracking and cookies/localstorage for this Mixpanel instance
5942
6103
  *
5943
- * ### Usage
6104
+ * ### Usage:
5944
6105
  *
5945
6106
  * var has_opted_in = mixpanel.has_opted_in_tracking();
5946
6107
  * // use has_opted_in value
@@ -5957,7 +6118,7 @@
5957
6118
  /**
5958
6119
  * Check whether the user has opted out of data tracking and cookies/localstorage for this Mixpanel instance
5959
6120
  *
5960
- * ### Usage
6121
+ * ### Usage:
5961
6122
  *
5962
6123
  * var has_opted_out = mixpanel.has_opted_out_tracking();
5963
6124
  * // use has_opted_out value
@@ -5974,7 +6135,7 @@
5974
6135
  /**
5975
6136
  * Clear the user's opt in/out status of data tracking and cookies/localstorage for this Mixpanel instance
5976
6137
  *
5977
- * ### Usage
6138
+ * ### Usage:
5978
6139
  *
5979
6140
  * // clear user's opt-in/out status
5980
6141
  * mixpanel.clear_opt_in_out_tracking();
@@ -6051,6 +6212,8 @@
6051
6212
  MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6052
6213
  MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6053
6214
  MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6215
+ MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
6216
+ MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
6054
6217
  MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
6055
6218
 
6056
6219
  // MixpanelPersistence Exports
@@ -6098,7 +6261,7 @@
6098
6261
 
6099
6262
  mixpanel_master = instance;
6100
6263
  if (init_type === INIT_SNIPPET) {
6101
- window$1[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6264
+ win[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6102
6265
  }
6103
6266
  extend_mp();
6104
6267
  }
@@ -6148,7 +6311,7 @@
6148
6311
  // check to make sure we arn't in a frame
6149
6312
  var toplevel = false;
6150
6313
  try {
6151
- toplevel = window$1.frameElement === null;
6314
+ toplevel = win.frameElement === null;
6152
6315
  } catch(e) {
6153
6316
  // noop
6154
6317
  }
@@ -6159,7 +6322,7 @@
6159
6322
  }
6160
6323
 
6161
6324
  // fallback handler, always will work
6162
- _.register_event(window$1, 'load', dom_loaded_handler, true);
6325
+ _.register_event(win, 'load', dom_loaded_handler, true);
6163
6326
  };
6164
6327
 
6165
6328
  function init_as_module() {
@@ -6173,8 +6336,10 @@
6173
6336
  return mixpanel_master;
6174
6337
  }
6175
6338
 
6339
+ /* eslint camelcase: "off" */
6340
+
6176
6341
  var mixpanel = init_as_module();
6177
6342
 
6178
6343
  return mixpanel;
6179
6344
 
6180
- }));
6345
+ }));