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.
@@ -3,16 +3,18 @@
3
3
 
4
4
  var Config = {
5
5
  DEBUG: false,
6
- LIB_VERSION: '2.48.1'
6
+ LIB_VERSION: '2.50.0'
7
7
  };
8
8
 
9
+ /* eslint camelcase: "off", eqeqeq: "off" */
10
+
9
11
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
10
- var window$1;
12
+ var win;
11
13
  if (typeof(window) === 'undefined') {
12
14
  var loc = {
13
15
  hostname: ''
14
16
  };
15
- window$1 = {
17
+ win = {
16
18
  navigator: { userAgent: '' },
17
19
  document: {
18
20
  location: loc,
@@ -22,32 +24,37 @@
22
24
  location: loc
23
25
  };
24
26
  } else {
25
- window$1 = window;
27
+ win = window;
26
28
  }
27
29
 
30
+ // Maximum allowed session recording length
31
+ var MAX_RECORDING_MS = 24 * 60 * 60 * 1000; // 24 hours
32
+
28
33
  /*
29
34
  * Saved references to long variable names, so that closure compiler can
30
35
  * minimize file size.
31
36
  */
32
37
 
33
- var ArrayProto = Array.prototype;
34
- var FuncProto = Function.prototype;
35
- var ObjProto = Object.prototype;
36
- var slice = ArrayProto.slice;
37
- var toString = ObjProto.toString;
38
- var hasOwnProperty = ObjProto.hasOwnProperty;
39
- var windowConsole = window$1.console;
40
- var navigator = window$1.navigator;
41
- var document$1 = window$1.document;
42
- var windowOpera = window$1.opera;
43
- var screen = window$1.screen;
44
- var userAgent = navigator.userAgent;
45
- var nativeBind = FuncProto.bind;
46
- var nativeForEach = ArrayProto.forEach;
47
- var nativeIndexOf = ArrayProto.indexOf;
48
- var nativeMap = ArrayProto.map;
49
- var nativeIsArray = Array.isArray;
50
- var breaker = {};
38
+ var ArrayProto = Array.prototype,
39
+ FuncProto = Function.prototype,
40
+ ObjProto = Object.prototype,
41
+ slice = ArrayProto.slice,
42
+ toString = ObjProto.toString,
43
+ hasOwnProperty = ObjProto.hasOwnProperty,
44
+ windowConsole = win.console,
45
+ navigator = win.navigator,
46
+ document$1 = win.document,
47
+ windowOpera = win.opera,
48
+ screen = win.screen,
49
+ userAgent = navigator.userAgent;
50
+
51
+ var nativeBind = FuncProto.bind,
52
+ nativeForEach = ArrayProto.forEach,
53
+ nativeIndexOf = ArrayProto.indexOf,
54
+ nativeMap = ArrayProto.map,
55
+ nativeIsArray = Array.isArray,
56
+ breaker = {};
57
+
51
58
  var _ = {
52
59
  trim: function(str) {
53
60
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
@@ -837,8 +844,8 @@
837
844
  var T = function() {
838
845
  var time = 1 * new Date(); // cross-browser version of Date.now()
839
846
  var ticks;
840
- if (window$1.performance && window$1.performance.now) {
841
- ticks = window$1.performance.now();
847
+ if (win.performance && win.performance.now) {
848
+ ticks = win.performance.now();
842
849
  } else {
843
850
  // fall back to busy loop
844
851
  ticks = 0;
@@ -902,6 +909,7 @@
902
909
  // sending false tracking data
903
910
  var BLOCKED_UA_STRS = [
904
911
  'ahrefsbot',
912
+ 'ahrefssiteaudit',
905
913
  'baiduspider',
906
914
  'bingbot',
907
915
  'bingpreview',
@@ -1622,7 +1630,14 @@
1622
1630
  return '';
1623
1631
  },
1624
1632
 
1625
- properties: function() {
1633
+ currentUrl: function() {
1634
+ return win.location.href;
1635
+ },
1636
+
1637
+ properties: function(extra_props) {
1638
+ if (typeof extra_props !== 'object') {
1639
+ extra_props = {};
1640
+ }
1626
1641
  return _.extend(_.strip_empty_properties({
1627
1642
  '$os': _.info.os(),
1628
1643
  '$browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
@@ -1630,7 +1645,7 @@
1630
1645
  '$referring_domain': _.info.referringDomain(document$1.referrer),
1631
1646
  '$device': _.info.device(userAgent)
1632
1647
  }), {
1633
- '$current_url': window$1.location.href,
1648
+ '$current_url': _.info.currentUrl(),
1634
1649
  '$browser_version': _.info.browserVersion(userAgent, navigator.vendor, windowOpera),
1635
1650
  '$screen_height': screen.height,
1636
1651
  '$screen_width': screen.width,
@@ -1638,7 +1653,7 @@
1638
1653
  '$lib_version': Config.LIB_VERSION,
1639
1654
  '$insert_id': cheap_guid(),
1640
1655
  'time': _.timestamp() / 1000 // epoch time in seconds
1641
- });
1656
+ }, _.strip_empty_properties(extra_props));
1642
1657
  },
1643
1658
 
1644
1659
  people_properties: function() {
@@ -1653,10 +1668,10 @@
1653
1668
  mpPageViewProperties: function() {
1654
1669
  return _.strip_empty_properties({
1655
1670
  'current_page_title': document$1.title,
1656
- 'current_domain': window$1.location.hostname,
1657
- 'current_url_path': window$1.location.pathname,
1658
- 'current_url_protocol': window$1.location.protocol,
1659
- 'current_url_search': window$1.location.search
1671
+ 'current_domain': win.location.hostname,
1672
+ 'current_url_path': win.location.pathname,
1673
+ 'current_url_protocol': win.location.protocol,
1674
+ 'current_url_search': win.location.search
1660
1675
  });
1661
1676
  }
1662
1677
  };
@@ -1694,8 +1709,7 @@
1694
1709
  return matches ? matches[0] : '';
1695
1710
  };
1696
1711
 
1697
- var JSONStringify = null;
1698
- var JSONParse = null;
1712
+ var JSONStringify = null, JSONParse = null;
1699
1713
  if (typeof JSON !== 'undefined') {
1700
1714
  JSONStringify = JSON.stringify;
1701
1715
  JSONParse = JSON.parse;
@@ -1716,6 +1730,8 @@
1716
1730
  _['info']['browserVersion'] = _.info.browserVersion;
1717
1731
  _['info']['properties'] = _.info.properties;
1718
1732
 
1733
+ /* eslint camelcase: "off" */
1734
+
1719
1735
  /**
1720
1736
  * DomTracker Object
1721
1737
  * @constructor
@@ -1865,8 +1881,6 @@
1865
1881
  }, 0);
1866
1882
  };
1867
1883
 
1868
- // eslint-disable-line camelcase
1869
-
1870
1884
  var logger$2 = console_with_prefix('lock');
1871
1885
 
1872
1886
  /**
@@ -2013,8 +2027,6 @@
2013
2027
  }
2014
2028
  };
2015
2029
 
2016
- // eslint-disable-line camelcase
2017
-
2018
2030
  var logger$1 = console_with_prefix('batch');
2019
2031
 
2020
2032
  /**
@@ -2292,8 +2304,6 @@
2292
2304
  this.storage.removeItem(this.storageKey);
2293
2305
  };
2294
2306
 
2295
- // eslint-disable-line camelcase
2296
-
2297
2307
  // maximum interval between request retries after exponential backoff
2298
2308
  var MAX_RETRY_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes
2299
2309
 
@@ -2588,6 +2598,19 @@
2588
2598
  }
2589
2599
  };
2590
2600
 
2601
+ /**
2602
+ * GDPR utils
2603
+ *
2604
+ * The General Data Protection Regulation (GDPR) is a regulation in EU law on data protection
2605
+ * and privacy for all individuals within the European Union. It addresses the export of personal
2606
+ * data outside the EU. The GDPR aims primarily to give control back to citizens and residents
2607
+ * over their personal data and to simplify the regulatory environment for international business
2608
+ * by unifying the regulation within the EU.
2609
+ *
2610
+ * This set of utilities is intended to enable opt in/out functionality in the Mixpanel JS SDK.
2611
+ * These functions are used internally by the SDK and are not intended to be publicly exposed.
2612
+ */
2613
+
2591
2614
  /**
2592
2615
  * A function used to track a Mixpanel event (e.g. MixpanelLib.track)
2593
2616
  * @callback trackFunction
@@ -2773,14 +2796,14 @@
2773
2796
  if (options && options.ignoreDnt) {
2774
2797
  return false;
2775
2798
  }
2776
- var win = (options && options.window) || window$1;
2777
- var nav = win['navigator'] || {};
2799
+ var win$1 = (options && options.window) || win;
2800
+ var nav = win$1['navigator'] || {};
2778
2801
  var hasDntOn = false;
2779
2802
 
2780
2803
  _.each([
2781
2804
  nav['doNotTrack'], // standard
2782
2805
  nav['msDoNotTrack'],
2783
- win['doNotTrack']
2806
+ win$1['doNotTrack']
2784
2807
  ], function(dntValue) {
2785
2808
  if (_.includes([true, 1, '1', 'yes'], dntValue)) {
2786
2809
  hasDntOn = true;
@@ -2874,6 +2897,8 @@
2874
2897
  };
2875
2898
  }
2876
2899
 
2900
+ /* eslint camelcase: "off" */
2901
+
2877
2902
  /** @const */ var SET_ACTION = '$set';
2878
2903
  /** @const */ var SET_ONCE_ACTION = '$set_once';
2879
2904
  /** @const */ var UNSET_ACTION = '$unset';
@@ -2991,6 +3016,8 @@
2991
3016
  }
2992
3017
  };
2993
3018
 
3019
+ /* eslint camelcase: "off" */
3020
+
2994
3021
  /**
2995
3022
  * Mixpanel Group Object
2996
3023
  * @constructor
@@ -3159,6 +3186,8 @@
3159
3186
  MixpanelGroup.prototype['unset'] = MixpanelGroup.prototype.unset;
3160
3187
  MixpanelGroup.prototype['toString'] = MixpanelGroup.prototype.toString;
3161
3188
 
3189
+ /* eslint camelcase: "off" */
3190
+
3162
3191
  /**
3163
3192
  * Mixpanel People Object
3164
3193
  * @constructor
@@ -3204,7 +3233,6 @@
3204
3233
  data[SET_ACTION] = _.extend(
3205
3234
  {},
3206
3235
  _.info.people_properties(),
3207
- this._mixpanel['persistence'].get_referrer_info(),
3208
3236
  data[SET_ACTION]
3209
3237
  );
3210
3238
  return this._send_request(data, callback);
@@ -3628,6 +3656,8 @@
3628
3656
  MixpanelPeople.prototype['delete_user'] = MixpanelPeople.prototype.delete_user;
3629
3657
  MixpanelPeople.prototype['toString'] = MixpanelPeople.prototype.toString;
3630
3658
 
3659
+ /* eslint camelcase: "off" */
3660
+
3631
3661
  /*
3632
3662
  * Constants
3633
3663
  */
@@ -4077,6 +4107,8 @@
4077
4107
  return timestamp;
4078
4108
  };
4079
4109
 
4110
+ /* eslint camelcase: "off" */
4111
+
4080
4112
  /*
4081
4113
  * Mixpanel JS Library
4082
4114
  *
@@ -4123,7 +4155,7 @@
4123
4155
  */
4124
4156
  // http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
4125
4157
  // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials
4126
- var USE_XHR = (window$1.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4158
+ var USE_XHR = (win.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());
4127
4159
 
4128
4160
  // IE<10 does not support cross-origin XHR's but script tags
4129
4161
  // with defer won't block window.onload; ENQUEUE_REQUESTS
@@ -4142,7 +4174,8 @@
4142
4174
  var DEFAULT_API_ROUTES = {
4143
4175
  'track': 'track/',
4144
4176
  'engage': 'engage/',
4145
- 'groups': 'groups/'
4177
+ 'groups': 'groups/',
4178
+ 'record': 'record/'
4146
4179
  };
4147
4180
 
4148
4181
  /*
@@ -4164,10 +4197,12 @@
4164
4197
  'cookie_domain': '',
4165
4198
  'cookie_name': '',
4166
4199
  'loaded': NOOP_FUNC,
4200
+ 'mp_loader': null,
4167
4201
  'track_marketing': true,
4168
4202
  'track_pageview': false,
4169
4203
  'skip_first_touch_marketing': false,
4170
4204
  'store_google': true,
4205
+ 'stop_utm_persistence': false,
4171
4206
  'save_referrer': true,
4172
4207
  'test': false,
4173
4208
  'verbose': false,
@@ -4192,7 +4227,12 @@
4192
4227
  'batch_flush_interval_ms': 5000,
4193
4228
  'batch_request_timeout_ms': 90000,
4194
4229
  'batch_autostart': true,
4195
- 'hooks': {}
4230
+ 'hooks': {},
4231
+ 'record_sessions_percent': 0,
4232
+ 'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
4233
+ 'record_max_ms': MAX_RECORDING_MS,
4234
+ 'record_mask_text_selector': '*',
4235
+ 'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
4196
4236
  };
4197
4237
 
4198
4238
  var DOM_LOADED = false;
@@ -4355,7 +4395,7 @@
4355
4395
  });
4356
4396
  } else {
4357
4397
  this.init_batchers();
4358
- if (sendBeacon && window$1.addEventListener) {
4398
+ if (sendBeacon && win.addEventListener) {
4359
4399
  // Before page closes or hides (user tabs away etc), attempt to flush any events
4360
4400
  // queued up via navigator.sendBeacon. Since sendBeacon doesn't report success/failure,
4361
4401
  // events will not be removed from the persistent store; if the site is loaded again,
@@ -4372,12 +4412,12 @@
4372
4412
  this.request_batchers.events.flush({unloading: true});
4373
4413
  }
4374
4414
  }, this);
4375
- window$1.addEventListener('pagehide', function(ev) {
4415
+ win.addEventListener('pagehide', function(ev) {
4376
4416
  if (ev['persisted']) {
4377
4417
  flush_on_unload();
4378
4418
  }
4379
4419
  });
4380
- window$1.addEventListener('visibilitychange', function() {
4420
+ win.addEventListener('visibilitychange', function() {
4381
4421
  if (document$1['visibilityState'] === 'hidden') {
4382
4422
  flush_on_unload();
4383
4423
  }
@@ -4401,8 +4441,44 @@
4401
4441
  }, '');
4402
4442
  }
4403
4443
 
4404
- if (this.get_config('track_pageview')) {
4405
- this.track_pageview();
4444
+ var track_pageview_option = this.get_config('track_pageview');
4445
+ if (track_pageview_option) {
4446
+ this._init_url_change_tracking(track_pageview_option);
4447
+ }
4448
+
4449
+ if (this.get_config('record_sessions_percent') > 0 && Math.random() * 100 <= this.get_config('record_sessions_percent')) {
4450
+ this.start_session_recording();
4451
+ }
4452
+ };
4453
+
4454
+ MixpanelLib.prototype.start_session_recording = addOptOutCheckMixpanelLib(function () {
4455
+ if (!win['MutationObserver']) {
4456
+ console.critical('Browser does not support MutationObserver; skipping session recording');
4457
+ return;
4458
+ }
4459
+
4460
+ var handleLoadedRecorder = _.bind(function() {
4461
+ this._recorder = this._recorder || new win['__mp_recorder'](this);
4462
+ this._recorder['startRecording']();
4463
+ }, this);
4464
+
4465
+ if (_.isUndefined(win['__mp_recorder'])) {
4466
+ var scriptEl = document$1.createElement('script');
4467
+ scriptEl.type = 'text/javascript';
4468
+ scriptEl.async = true;
4469
+ scriptEl.onload = handleLoadedRecorder;
4470
+ scriptEl.src = this.get_config('recorder_src');
4471
+ document$1.head.appendChild(scriptEl);
4472
+ } else {
4473
+ handleLoadedRecorder();
4474
+ }
4475
+ });
4476
+
4477
+ MixpanelLib.prototype.stop_session_recording = function () {
4478
+ if (this._recorder) {
4479
+ this._recorder['stopRecording']();
4480
+ } else {
4481
+ console.critical('Session recorder module not loaded');
4406
4482
  }
4407
4483
  };
4408
4484
 
@@ -4411,12 +4487,25 @@
4411
4487
  MixpanelLib.prototype._loaded = function() {
4412
4488
  this.get_config('loaded')(this);
4413
4489
  this._set_default_superprops();
4490
+ this['people'].set_once(this['persistence'].get_referrer_info());
4491
+
4492
+ // The original 'store_google' functionality will be deprecated and the config will be
4493
+ // used to clear previously managed UTM parameters from persistence.
4494
+ // stop_utm_persistence is `false` by default now but will be default `true` in the future.
4495
+ if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
4496
+ var utm_params = _.info.campaignParams(null);
4497
+ _.each(utm_params, function(_utm_value, utm_key) {
4498
+ // We need to unregister persisted UTM parameters so old values
4499
+ // are not mixed with the new UTM parameters
4500
+ this.unregister(utm_key);
4501
+ }.bind(this));
4502
+ }
4414
4503
  };
4415
4504
 
4416
4505
  // update persistence with info on referrer, UTM params, etc
4417
4506
  MixpanelLib.prototype._set_default_superprops = function() {
4418
4507
  this['persistence'].update_search_keyword(document$1.referrer);
4419
- if (this.get_config('store_google')) {
4508
+ if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
4420
4509
  this.register(_.info.campaignParams());
4421
4510
  }
4422
4511
  if (this.get_config('save_referrer')) {
@@ -4454,6 +4543,55 @@
4454
4543
  return dt.track.apply(dt, args);
4455
4544
  };
4456
4545
 
4546
+ MixpanelLib.prototype._init_url_change_tracking = function(track_pageview_option) {
4547
+ var previous_tracked_url = '';
4548
+ var tracked = this.track_pageview();
4549
+ if (tracked) {
4550
+ previous_tracked_url = _.info.currentUrl();
4551
+ }
4552
+
4553
+ if (_.include(['full-url', 'url-with-path-and-query-string', 'url-with-path'], track_pageview_option)) {
4554
+ win.addEventListener('popstate', function() {
4555
+ win.dispatchEvent(new Event('mp_locationchange'));
4556
+ });
4557
+ win.addEventListener('hashchange', function() {
4558
+ win.dispatchEvent(new Event('mp_locationchange'));
4559
+ });
4560
+ var nativePushState = win.history.pushState;
4561
+ if (typeof nativePushState === 'function') {
4562
+ win.history.pushState = function(state, unused, url) {
4563
+ nativePushState.call(win.history, state, unused, url);
4564
+ win.dispatchEvent(new Event('mp_locationchange'));
4565
+ };
4566
+ }
4567
+ var nativeReplaceState = win.history.replaceState;
4568
+ if (typeof nativeReplaceState === 'function') {
4569
+ win.history.replaceState = function(state, unused, url) {
4570
+ nativeReplaceState.call(win.history, state, unused, url);
4571
+ win.dispatchEvent(new Event('mp_locationchange'));
4572
+ };
4573
+ }
4574
+ win.addEventListener('mp_locationchange', function() {
4575
+ var current_url = _.info.currentUrl();
4576
+ var should_track = false;
4577
+ if (track_pageview_option === 'full-url') {
4578
+ should_track = current_url !== previous_tracked_url;
4579
+ } else if (track_pageview_option === 'url-with-path-and-query-string') {
4580
+ should_track = current_url.split('#')[0] !== previous_tracked_url.split('#')[0];
4581
+ } else if (track_pageview_option === 'url-with-path') {
4582
+ should_track = current_url.split('#')[0].split('?')[0] !== previous_tracked_url.split('#')[0].split('?')[0];
4583
+ }
4584
+
4585
+ if (should_track) {
4586
+ var tracked = this.track_pageview();
4587
+ if (tracked) {
4588
+ previous_tracked_url = current_url;
4589
+ }
4590
+ }
4591
+ }.bind(this));
4592
+ }
4593
+ };
4594
+
4457
4595
  /**
4458
4596
  * _prepare_callback() should be called by callers of _send_request for use
4459
4597
  * as the callback argument.
@@ -4915,6 +5053,13 @@
4915
5053
  ? _.info.marketingParams()
4916
5054
  : {};
4917
5055
 
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
+
4918
5063
  // note: extend writes to the first object, so lets make sure we
4919
5064
  // don't write to the persistence properties object and info
4920
5065
  // properties object by passing in a new object
@@ -4922,7 +5067,7 @@
4922
5067
  // update properties with pageview info and super-properties
4923
5068
  properties = _.extend(
4924
5069
  {},
4925
- _.info.properties(),
5070
+ _.info.properties({'mp_loader': this.get_config('mp_loader')}),
4926
5071
  marketing_properties,
4927
5072
  this['persistence'].properties(),
4928
5073
  this.unpersisted_superprops,
@@ -5086,10 +5231,9 @@
5086
5231
 
5087
5232
  /**
5088
5233
  * Track a default Mixpanel page view event, which includes extra default event properties to
5089
- * improve page view data. The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
5090
- * may be turned on for tracking page loads automatically.
5234
+ * improve page view data.
5091
5235
  *
5092
- * ### Usage
5236
+ * ### Usage:
5093
5237
  *
5094
5238
  * // track a default $mp_web_page_view event
5095
5239
  * mixpanel.track_pageview();
@@ -5106,6 +5250,23 @@
5106
5250
  * // views on different products or internal applications that are considered completely separate
5107
5251
  * mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
5108
5252
  *
5253
+ * ### Notes:
5254
+ *
5255
+ * The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
5256
+ * may be turned on for tracking page loads automatically.
5257
+ *
5258
+ * // track only page loads
5259
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: true});
5260
+ *
5261
+ * // track when the URL changes in any manner
5262
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'full-url'});
5263
+ *
5264
+ * // track when the URL changes, ignoring any changes in the hash part
5265
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path-and-query-string'});
5266
+ *
5267
+ * // track when the path changes, ignoring any query parameter or hash changes
5268
+ * mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path'});
5269
+ *
5109
5270
  * @param {Object} [properties] An optional set of additional properties to send with the page view event
5110
5271
  * @param {Object} [options] Page view tracking options
5111
5272
  * @param {String} [options.event_name] - Alternate name for the tracking event
@@ -5856,7 +6017,7 @@
5856
6017
  /**
5857
6018
  * Opt the user in to data tracking and cookies/localstorage for this Mixpanel instance
5858
6019
  *
5859
- * ### Usage
6020
+ * ### Usage:
5860
6021
  *
5861
6022
  * // opt user in
5862
6023
  * mixpanel.opt_in_tracking();
@@ -5896,7 +6057,7 @@
5896
6057
  /**
5897
6058
  * Opt the user out of data tracking and cookies/localstorage for this Mixpanel instance
5898
6059
  *
5899
- * ### Usage
6060
+ * ### Usage:
5900
6061
  *
5901
6062
  * // opt user out
5902
6063
  * mixpanel.opt_out_tracking();
@@ -5937,7 +6098,7 @@
5937
6098
  /**
5938
6099
  * Check whether the user has opted in to data tracking and cookies/localstorage for this Mixpanel instance
5939
6100
  *
5940
- * ### Usage
6101
+ * ### Usage:
5941
6102
  *
5942
6103
  * var has_opted_in = mixpanel.has_opted_in_tracking();
5943
6104
  * // use has_opted_in value
@@ -5954,7 +6115,7 @@
5954
6115
  /**
5955
6116
  * Check whether the user has opted out of data tracking and cookies/localstorage for this Mixpanel instance
5956
6117
  *
5957
- * ### Usage
6118
+ * ### Usage:
5958
6119
  *
5959
6120
  * var has_opted_out = mixpanel.has_opted_out_tracking();
5960
6121
  * // use has_opted_out value
@@ -5971,7 +6132,7 @@
5971
6132
  /**
5972
6133
  * Clear the user's opt in/out status of data tracking and cookies/localstorage for this Mixpanel instance
5973
6134
  *
5974
- * ### Usage
6135
+ * ### Usage:
5975
6136
  *
5976
6137
  * // clear user's opt-in/out status
5977
6138
  * mixpanel.clear_opt_in_out_tracking();
@@ -6048,6 +6209,8 @@
6048
6209
  MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6049
6210
  MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6050
6211
  MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6212
+ MixpanelLib.prototype['start_session_recording'] = MixpanelLib.prototype.start_session_recording;
6213
+ MixpanelLib.prototype['stop_session_recording'] = MixpanelLib.prototype.stop_session_recording;
6051
6214
  MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
6052
6215
 
6053
6216
  // MixpanelPersistence Exports
@@ -6095,7 +6258,7 @@
6095
6258
 
6096
6259
  mixpanel_master = instance;
6097
6260
  if (init_type === INIT_SNIPPET) {
6098
- window$1[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6261
+ win[PRIMARY_INSTANCE_NAME] = mixpanel_master;
6099
6262
  }
6100
6263
  extend_mp();
6101
6264
  }
@@ -6145,7 +6308,7 @@
6145
6308
  // check to make sure we arn't in a frame
6146
6309
  var toplevel = false;
6147
6310
  try {
6148
- toplevel = window$1.frameElement === null;
6311
+ toplevel = win.frameElement === null;
6149
6312
  } catch(e) {
6150
6313
  // noop
6151
6314
  }
@@ -6156,12 +6319,12 @@
6156
6319
  }
6157
6320
 
6158
6321
  // fallback handler, always will work
6159
- _.register_event(window$1, 'load', dom_loaded_handler, true);
6322
+ _.register_event(win, 'load', dom_loaded_handler, true);
6160
6323
  };
6161
6324
 
6162
6325
  function init_from_snippet() {
6163
6326
  init_type = INIT_SNIPPET;
6164
- mixpanel_master = window$1[PRIMARY_INSTANCE_NAME];
6327
+ mixpanel_master = win[PRIMARY_INSTANCE_NAME];
6165
6328
 
6166
6329
  // Initialization
6167
6330
  if (_.isUndefined(mixpanel_master)) {
@@ -6199,6 +6362,8 @@
6199
6362
  add_dom_loaded_handler();
6200
6363
  }
6201
6364
 
6365
+ /* eslint camelcase: "off" */
6366
+
6202
6367
  init_from_snippet();
6203
6368
 
6204
- }());
6369
+ })();