mixpanel-browser 2.47.0 → 2.48.1

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.
@@ -6,7 +6,7 @@
6
6
 
7
7
  var Config = {
8
8
  DEBUG: false,
9
- LIB_VERSION: '2.47.0'
9
+ LIB_VERSION: '2.48.1'
10
10
  };
11
11
 
12
12
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -908,6 +908,7 @@
908
908
  'baiduspider',
909
909
  'bingbot',
910
910
  'bingpreview',
911
+ 'chrome-lighthouse',
911
912
  'facebookexternal',
912
913
  'petalbot',
913
914
  'pinterest',
@@ -3136,7 +3137,7 @@
3136
3137
  return this._mixpanel._track_or_batch({
3137
3138
  type: 'groups',
3138
3139
  data: date_encoded_data,
3139
- endpoint: this._get_config('api_host') + '/groups/',
3140
+ endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['groups'],
3140
3141
  batcher: this._mixpanel.request_batchers.groups
3141
3142
  }, callback);
3142
3143
  };
@@ -3497,7 +3498,7 @@
3497
3498
  return this._mixpanel._track_or_batch({
3498
3499
  type: 'people',
3499
3500
  data: date_encoded_data,
3500
- endpoint: this._get_config('api_host') + '/engage/',
3501
+ endpoint: this._get_config('api_host') + '/' + this._get_config('api_routes')['engage'],
3501
3502
  batcher: this._mixpanel.request_batchers.people
3502
3503
  }, callback);
3503
3504
  };
@@ -3533,11 +3534,12 @@
3533
3534
 
3534
3535
  MixpanelPeople.prototype._flush_one_queue = function(action, action_method, callback, queue_to_params_fn) {
3535
3536
  var _this = this;
3536
- var queued_data = _.extend({}, this._mixpanel['persistence']._get_queue(action));
3537
+ var queued_data = _.extend({}, this._mixpanel['persistence'].load_queue(action));
3537
3538
  var action_params = queued_data;
3538
3539
 
3539
3540
  if (!_.isUndefined(queued_data) && _.isObject(queued_data) && !_.isEmptyObject(queued_data)) {
3540
3541
  _this._mixpanel['persistence']._pop_from_people_queue(action, queued_data);
3542
+ _this._mixpanel['persistence'].save();
3541
3543
  if (queue_to_params_fn) {
3542
3544
  action_params = queue_to_params_fn(queued_data);
3543
3545
  }
@@ -3559,8 +3561,6 @@
3559
3561
  _set_callback, _add_callback, _append_callback, _set_once_callback, _union_callback, _unset_callback, _remove_callback
3560
3562
  ) {
3561
3563
  var _this = this;
3562
- var $append_queue = this._mixpanel['persistence']._get_queue(APPEND_ACTION);
3563
- var $remove_queue = this._mixpanel['persistence']._get_queue(REMOVE_ACTION);
3564
3564
 
3565
3565
  this._flush_one_queue(SET_ACTION, this.set, _set_callback);
3566
3566
  this._flush_one_queue(SET_ONCE_ACTION, this.set_once, _set_once_callback);
@@ -3570,6 +3570,7 @@
3570
3570
 
3571
3571
  // we have to fire off each $append individually since there is
3572
3572
  // no concat method server side
3573
+ var $append_queue = this._mixpanel['persistence'].load_queue(APPEND_ACTION);
3573
3574
  if (!_.isUndefined($append_queue) && _.isArray($append_queue) && $append_queue.length) {
3574
3575
  var $append_item;
3575
3576
  var append_callback = function(response, data) {
@@ -3581,16 +3582,17 @@
3581
3582
  }
3582
3583
  };
3583
3584
  for (var i = $append_queue.length - 1; i >= 0; i--) {
3585
+ $append_queue = this._mixpanel['persistence'].load_queue(APPEND_ACTION);
3584
3586
  $append_item = $append_queue.pop();
3587
+ _this._mixpanel['persistence'].save();
3585
3588
  if (!_.isEmptyObject($append_item)) {
3586
3589
  _this.append($append_item, append_callback);
3587
3590
  }
3588
3591
  }
3589
- // Save the shortened append queue
3590
- _this._mixpanel['persistence'].save();
3591
3592
  }
3592
3593
 
3593
3594
  // same for $remove
3595
+ var $remove_queue = this._mixpanel['persistence'].load_queue(REMOVE_ACTION);
3594
3596
  if (!_.isUndefined($remove_queue) && _.isArray($remove_queue) && $remove_queue.length) {
3595
3597
  var $remove_item;
3596
3598
  var remove_callback = function(response, data) {
@@ -3602,12 +3604,13 @@
3602
3604
  }
3603
3605
  };
3604
3606
  for (var j = $remove_queue.length - 1; j >= 0; j--) {
3607
+ $remove_queue = this._mixpanel['persistence'].load_queue(REMOVE_ACTION);
3605
3608
  $remove_item = $remove_queue.pop();
3609
+ _this._mixpanel['persistence'].save();
3606
3610
  if (!_.isEmptyObject($remove_item)) {
3607
3611
  _this.remove($remove_item, remove_callback);
3608
3612
  }
3609
3613
  }
3610
- _this._mixpanel['persistence'].save();
3611
3614
  }
3612
3615
  };
3613
3616
 
@@ -3689,6 +3692,9 @@
3689
3692
 
3690
3693
  MixpanelPersistence.prototype.properties = function() {
3691
3694
  var p = {};
3695
+
3696
+ this.load();
3697
+
3692
3698
  // Filter out reserved properties
3693
3699
  _.each(this['props'], function(v, k) {
3694
3700
  if (!_.include(RESERVED_PROPERTIES, k)) {
@@ -3765,6 +3771,7 @@
3765
3771
 
3766
3772
  MixpanelPersistence.prototype.save = function() {
3767
3773
  if (this.disabled) { return; }
3774
+
3768
3775
  this.storage.set(
3769
3776
  this.name,
3770
3777
  _.JSONEncode(this['props']),
@@ -3776,6 +3783,11 @@
3776
3783
  );
3777
3784
  };
3778
3785
 
3786
+ MixpanelPersistence.prototype.load_prop = function(key) {
3787
+ this.load();
3788
+ return this['props'][key];
3789
+ };
3790
+
3779
3791
  MixpanelPersistence.prototype.remove = function() {
3780
3792
  // remove both domain and subdomain cookies
3781
3793
  this.storage.remove(this.name, false, this.cookie_domain);
@@ -3799,6 +3811,8 @@
3799
3811
  if (typeof(default_value) === 'undefined') { default_value = 'None'; }
3800
3812
  this.expire_days = (typeof(days) === 'undefined') ? this.default_expiry : days;
3801
3813
 
3814
+ this.load();
3815
+
3802
3816
  _.each(props, function(val, prop) {
3803
3817
  if (!this['props'].hasOwnProperty(prop) || this['props'][prop] === default_value) {
3804
3818
  this['props'][prop] = val;
@@ -3820,8 +3834,8 @@
3820
3834
  if (_.isObject(props)) {
3821
3835
  this.expire_days = (typeof(days) === 'undefined') ? this.default_expiry : days;
3822
3836
 
3837
+ this.load();
3823
3838
  _.extend(this['props'], props);
3824
-
3825
3839
  this.save();
3826
3840
 
3827
3841
  return true;
@@ -3830,6 +3844,7 @@
3830
3844
  };
3831
3845
 
3832
3846
  MixpanelPersistence.prototype.unregister = function(prop) {
3847
+ this.load();
3833
3848
  if (prop in this['props']) {
3834
3849
  delete this['props'][prop];
3835
3850
  this.save();
@@ -3856,19 +3871,6 @@
3856
3871
  });
3857
3872
  };
3858
3873
 
3859
- // safely fills the passed in object with stored properties,
3860
- // does not override any properties defined in both
3861
- // returns the passed in object
3862
- MixpanelPersistence.prototype.safe_merge = function(props) {
3863
- _.each(this['props'], function(val, prop) {
3864
- if (!(prop in props)) {
3865
- props[prop] = val;
3866
- }
3867
- });
3868
-
3869
- return props;
3870
- };
3871
-
3872
3874
  MixpanelPersistence.prototype.update_config = function(config) {
3873
3875
  this.default_expiry = this.expire_days = config['cookie_expiration'];
3874
3876
  this.set_disabled(config['disable_persistence']);
@@ -4012,7 +4014,7 @@
4012
4014
  };
4013
4015
 
4014
4016
  MixpanelPersistence.prototype._pop_from_people_queue = function(queue, data) {
4015
- var q = this._get_queue(queue);
4017
+ var q = this['props'][this._get_queue_key(queue)];
4016
4018
  if (!_.isUndefined(q)) {
4017
4019
  _.each(data, function(v, k) {
4018
4020
  if (queue === APPEND_ACTION || queue === REMOVE_ACTION) {
@@ -4028,11 +4030,13 @@
4028
4030
  delete q[k];
4029
4031
  }
4030
4032
  }, this);
4031
-
4032
- this.save();
4033
4033
  }
4034
4034
  };
4035
4035
 
4036
+ MixpanelPersistence.prototype.load_queue = function(queue) {
4037
+ return this.load_prop(this._get_queue_key(queue));
4038
+ };
4039
+
4036
4040
  MixpanelPersistence.prototype._get_queue_key = function(queue) {
4037
4041
  if (queue === SET_ACTION) {
4038
4042
  return SET_QUEUE_KEY;
@@ -4053,25 +4057,21 @@
4053
4057
  }
4054
4058
  };
4055
4059
 
4056
- MixpanelPersistence.prototype._get_queue = function(queue) {
4057
- return this['props'][this._get_queue_key(queue)];
4058
- };
4059
4060
  MixpanelPersistence.prototype._get_or_create_queue = function(queue, default_val) {
4060
4061
  var key = this._get_queue_key(queue);
4061
4062
  default_val = _.isUndefined(default_val) ? {} : default_val;
4062
-
4063
4063
  return this['props'][key] || (this['props'][key] = default_val);
4064
4064
  };
4065
4065
 
4066
4066
  MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) {
4067
- var timers = this['props'][EVENT_TIMERS_KEY] || {};
4067
+ var timers = this.load_prop(EVENT_TIMERS_KEY) || {};
4068
4068
  timers[event_name] = timestamp;
4069
4069
  this['props'][EVENT_TIMERS_KEY] = timers;
4070
4070
  this.save();
4071
4071
  };
4072
4072
 
4073
4073
  MixpanelPersistence.prototype.remove_event_timer = function(event_name) {
4074
- var timers = this['props'][EVENT_TIMERS_KEY] || {};
4074
+ var timers = this.load_prop(EVENT_TIMERS_KEY) || {};
4075
4075
  var timestamp = timers[event_name];
4076
4076
  if (!_.isUndefined(timestamp)) {
4077
4077
  delete this['props'][EVENT_TIMERS_KEY][event_name];
@@ -4142,11 +4142,18 @@
4142
4142
  };
4143
4143
  }
4144
4144
 
4145
+ var DEFAULT_API_ROUTES = {
4146
+ 'track': 'track/',
4147
+ 'engage': 'engage/',
4148
+ 'groups': 'groups/'
4149
+ };
4150
+
4145
4151
  /*
4146
4152
  * Module-level globals
4147
4153
  */
4148
4154
  var DEFAULT_CONFIG = {
4149
4155
  'api_host': 'https://api-js.mixpanel.com',
4156
+ 'api_routes': DEFAULT_API_ROUTES,
4150
4157
  'api_method': 'POST',
4151
4158
  'api_transport': 'XHR',
4152
4159
  'api_payload_format': PAYLOAD_TYPE_BASE64,
@@ -4345,6 +4352,10 @@
4345
4352
  if (!_.localStorage.is_supported(true) || !USE_XHR) {
4346
4353
  this._batch_requests = false;
4347
4354
  console.log('Turning off Mixpanel request-queueing; needs XHR and localStorage support');
4355
+ _.each(this.get_batcher_configs(), function(batcher_config) {
4356
+ console.log('Clearing batch queue ' + batcher_config.queue_key);
4357
+ _.localStorage.remove(batcher_config.queue_key);
4358
+ });
4348
4359
  } else {
4349
4360
  this.init_batchers();
4350
4361
  if (sendBeacon && window$1.addEventListener) {
@@ -4409,7 +4420,7 @@
4409
4420
  MixpanelLib.prototype._set_default_superprops = function() {
4410
4421
  this['persistence'].update_search_keyword(document$1.referrer);
4411
4422
  if (this.get_config('store_google')) {
4412
- this.register(_.info.campaignParams(), {persistent: false});
4423
+ this.register(_.info.campaignParams());
4413
4424
  }
4414
4425
  if (this.get_config('save_referrer')) {
4415
4426
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -4692,12 +4703,22 @@
4692
4703
  return !!this.request_batchers.events;
4693
4704
  };
4694
4705
 
4706
+ MixpanelLib.prototype.get_batcher_configs = function() {
4707
+ var queue_prefix = '__mpq_' + this.get_config('token');
4708
+ var api_routes = this.get_config('api_routes');
4709
+ this._batcher_configs = this._batcher_configs || {
4710
+ events: {type: 'events', endpoint: '/' + api_routes['track'], queue_key: queue_prefix + '_ev'},
4711
+ people: {type: 'people', endpoint: '/' + api_routes['engage'], queue_key: queue_prefix + '_pp'},
4712
+ groups: {type: 'groups', endpoint: '/' + api_routes['groups'], queue_key: queue_prefix + '_gr'}
4713
+ };
4714
+ return this._batcher_configs;
4715
+ };
4716
+
4695
4717
  MixpanelLib.prototype.init_batchers = function() {
4696
- var token = this.get_config('token');
4697
4718
  if (!this.are_batchers_initialized()) {
4698
4719
  var batcher_for = _.bind(function(attrs) {
4699
4720
  return new RequestBatcher(
4700
- '__mpq_' + token + attrs.queue_suffix,
4721
+ attrs.queue_key,
4701
4722
  {
4702
4723
  libConfig: this['config'],
4703
4724
  sendRequestFunc: _.bind(function(data, options, cb) {
@@ -4716,10 +4737,11 @@
4716
4737
  }
4717
4738
  );
4718
4739
  }, this);
4740
+ var batcher_configs = this.get_batcher_configs();
4719
4741
  this.request_batchers = {
4720
- events: batcher_for({type: 'events', endpoint: '/track/', queue_suffix: '_ev'}),
4721
- people: batcher_for({type: 'people', endpoint: '/engage/', queue_suffix: '_pp'}),
4722
- groups: batcher_for({type: 'groups', endpoint: '/groups/', queue_suffix: '_gr'})
4742
+ events: batcher_for(batcher_configs.events),
4743
+ people: batcher_for(batcher_configs.people),
4744
+ groups: batcher_for(batcher_configs.groups)
4723
4745
  };
4724
4746
  }
4725
4747
  if (this.get_config('batch_autostart')) {
@@ -4728,6 +4750,7 @@
4728
4750
  };
4729
4751
 
4730
4752
  MixpanelLib.prototype.start_batch_senders = function() {
4753
+ this._batchers_were_started = true;
4731
4754
  if (this.are_batchers_initialized()) {
4732
4755
  this._batch_requests = true;
4733
4756
  _.each(this.request_batchers, function(batcher) {
@@ -4879,7 +4902,7 @@
4879
4902
  }
4880
4903
 
4881
4904
  // set defaults
4882
- properties = properties || {};
4905
+ properties = _.extend({}, properties);
4883
4906
  properties['token'] = this.get_config('token');
4884
4907
 
4885
4908
  // set $duration if time_event was previously called for this event
@@ -4925,7 +4948,7 @@
4925
4948
  var ret = this._track_or_batch({
4926
4949
  type: 'events',
4927
4950
  data: data,
4928
- endpoint: this.get_config('api_host') + '/track/',
4951
+ endpoint: this.get_config('api_host') + '/' + this.get_config('api_routes')['track'],
4929
4952
  batcher: this.request_batchers.events,
4930
4953
  should_send_immediately: should_send_immediately,
4931
4954
  send_request_options: options
@@ -4971,13 +4994,14 @@
4971
4994
  */
4972
4995
  MixpanelLib.prototype.add_group = addOptOutCheckMixpanelLib(function(group_key, group_id, callback) {
4973
4996
  var old_values = this.get_property(group_key);
4997
+ var prop = {};
4974
4998
  if (old_values === undefined) {
4975
- var prop = {};
4976
4999
  prop[group_key] = [group_id];
4977
5000
  this.register(prop);
4978
5001
  } else {
4979
5002
  if (old_values.indexOf(group_id) === -1) {
4980
5003
  old_values.push(group_id);
5004
+ prop[group_key] = old_values;
4981
5005
  this.register(prop);
4982
5006
  }
4983
5007
  }
@@ -5522,6 +5546,16 @@
5522
5546
  * The default config is:
5523
5547
  *
5524
5548
  * {
5549
+ * // host for requests (customizable for e.g. a local proxy)
5550
+ * api_host: 'https://api-js.mixpanel.com',
5551
+ *
5552
+ * // endpoints for different types of requests
5553
+ * api_routes: {
5554
+ * track: 'track/',
5555
+ * engage: 'engage/',
5556
+ * groups: 'groups/',
5557
+ * }
5558
+ *
5525
5559
  * // HTTP method for tracking requests
5526
5560
  * api_method: 'POST'
5527
5561
  *
@@ -5705,7 +5739,7 @@
5705
5739
  * @param {String} property_name The name of the super property you want to retrieve
5706
5740
  */
5707
5741
  MixpanelLib.prototype.get_property = function(property_name) {
5708
- return this['persistence']['props'][property_name];
5742
+ return this['persistence'].load_prop([property_name]);
5709
5743
  };
5710
5744
 
5711
5745
  MixpanelLib.prototype.toString = function() {
@@ -5778,9 +5812,13 @@
5778
5812
  }
5779
5813
 
5780
5814
  if (disabled) {
5781
- _.each(this.request_batchers, function(batcher) {
5782
- batcher.clear();
5783
- });
5815
+ this.stop_batch_senders();
5816
+ } else {
5817
+ // only start batchers after opt-in if they have previously been started
5818
+ // in order to avoid unintentionally starting up batching for the first time
5819
+ if (this._batchers_were_started) {
5820
+ this.start_batch_senders();
5821
+ }
5784
5822
  }
5785
5823
  };
5786
5824
 
@@ -5982,37 +6020,38 @@
5982
6020
  // EXPORTS (for closure compiler)
5983
6021
 
5984
6022
  // MixpanelLib Exports
5985
- MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
5986
- MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
5987
- MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
5988
- MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
5989
- MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
5990
- MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
5991
- MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
5992
- MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
5993
- MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
5994
- MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
5995
- MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
5996
- MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
5997
- MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
5998
- MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
5999
- MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
6000
- MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
6001
- MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
6002
- MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
6003
- MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
6004
- MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
6005
- MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
6006
- MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
6007
- MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
6008
- MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
6009
- MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
6010
- MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
6011
- MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
6012
- MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
6013
- MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6014
- MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6015
- MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6023
+ MixpanelLib.prototype['init'] = MixpanelLib.prototype.init;
6024
+ MixpanelLib.prototype['reset'] = MixpanelLib.prototype.reset;
6025
+ MixpanelLib.prototype['disable'] = MixpanelLib.prototype.disable;
6026
+ MixpanelLib.prototype['time_event'] = MixpanelLib.prototype.time_event;
6027
+ MixpanelLib.prototype['track'] = MixpanelLib.prototype.track;
6028
+ MixpanelLib.prototype['track_links'] = MixpanelLib.prototype.track_links;
6029
+ MixpanelLib.prototype['track_forms'] = MixpanelLib.prototype.track_forms;
6030
+ MixpanelLib.prototype['track_pageview'] = MixpanelLib.prototype.track_pageview;
6031
+ MixpanelLib.prototype['register'] = MixpanelLib.prototype.register;
6032
+ MixpanelLib.prototype['register_once'] = MixpanelLib.prototype.register_once;
6033
+ MixpanelLib.prototype['unregister'] = MixpanelLib.prototype.unregister;
6034
+ MixpanelLib.prototype['identify'] = MixpanelLib.prototype.identify;
6035
+ MixpanelLib.prototype['alias'] = MixpanelLib.prototype.alias;
6036
+ MixpanelLib.prototype['name_tag'] = MixpanelLib.prototype.name_tag;
6037
+ MixpanelLib.prototype['set_config'] = MixpanelLib.prototype.set_config;
6038
+ MixpanelLib.prototype['get_config'] = MixpanelLib.prototype.get_config;
6039
+ MixpanelLib.prototype['get_property'] = MixpanelLib.prototype.get_property;
6040
+ MixpanelLib.prototype['get_distinct_id'] = MixpanelLib.prototype.get_distinct_id;
6041
+ MixpanelLib.prototype['toString'] = MixpanelLib.prototype.toString;
6042
+ MixpanelLib.prototype['opt_out_tracking'] = MixpanelLib.prototype.opt_out_tracking;
6043
+ MixpanelLib.prototype['opt_in_tracking'] = MixpanelLib.prototype.opt_in_tracking;
6044
+ MixpanelLib.prototype['has_opted_out_tracking'] = MixpanelLib.prototype.has_opted_out_tracking;
6045
+ MixpanelLib.prototype['has_opted_in_tracking'] = MixpanelLib.prototype.has_opted_in_tracking;
6046
+ MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
6047
+ MixpanelLib.prototype['get_group'] = MixpanelLib.prototype.get_group;
6048
+ MixpanelLib.prototype['set_group'] = MixpanelLib.prototype.set_group;
6049
+ MixpanelLib.prototype['add_group'] = MixpanelLib.prototype.add_group;
6050
+ MixpanelLib.prototype['remove_group'] = MixpanelLib.prototype.remove_group;
6051
+ MixpanelLib.prototype['track_with_groups'] = MixpanelLib.prototype.track_with_groups;
6052
+ MixpanelLib.prototype['start_batch_senders'] = MixpanelLib.prototype.start_batch_senders;
6053
+ MixpanelLib.prototype['stop_batch_senders'] = MixpanelLib.prototype.stop_batch_senders;
6054
+ MixpanelLib.prototype['DEFAULT_API_ROUTES'] = DEFAULT_API_ROUTES;
6016
6055
 
6017
6056
  // MixpanelPersistence Exports
6018
6057
  MixpanelPersistence.prototype['properties'] = MixpanelPersistence.prototype.properties;
@@ -262,7 +262,7 @@ mixpanel.library_name.track(...);
262
262
  | Argument | Type | Description |
263
263
  | ------------- | ------------- | ----- |
264
264
  | **token** | <span class="mp-arg-type">String</span></br></span><span class="mp-arg-required">required</span> | Your Mixpanel API token |
265
- | **config** | <span class="mp-arg-type">Object</span></br></span><span class="mp-arg-optional">optional</span> | A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/8b2e1f7b/src/mixpanel-core.js#L87-L110">See a list of default config options</a>. |
265
+ | **config** | <span class="mp-arg-type">Object</span></br></span><span class="mp-arg-optional">optional</span> | A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/v2.46.0/src/mixpanel-core.js#L88-L127">See a list of default config options</a>. |
266
266
  | **name** | <span class="mp-arg-type">String</span></br></span><span class="mp-arg-optional">optional</span> | The name for the new mixpanel instance that you want created |
267
267
 
268
268
 
@@ -523,10 +523,20 @@ The default config is:
523
523
  // secure, meaning they will only be transmitted over https
524
524
  secure_cookie: false
525
525
 
526
+ // disables enriching user profiles with first touch marketing data
527
+ skip_first_touch_marketing: false
528
+
526
529
  // the amount of time track_links will
527
530
  // wait for Mixpanel's servers to respond
528
531
  track_links_timeout: 300
529
532
 
533
+ // adds any UTM parameters and click IDs present on the page to any events fired
534
+ track_marketing: true
535
+
536
+ // enables automatic page view tracking using default page view events through
537
+ // the track_pageview() method
538
+ track_pageview: false
539
+
530
540
  // if you set upgrade to be true, the library will check for
531
541
  // a cookie from our old js library and import super
532
542
  // properties from it, then the old cookie is deleted
@@ -684,6 +694,26 @@ If you pass a function in as the properties argument, the function will receive
684
694
  | **properties** | <span class="mp-arg-type">Object or Function</span></br></span><span class="mp-arg-optional">optional</span> | A properties object or function that returns a dictionary of properties when passed a DOMElement |
685
695
 
686
696
 
697
+ ___
698
+ ## mixpanel.track_pageview
699
+ Track a default Mixpanel page view event, which includes extra default event properties to improve page view data. The <code>config.track_pageview</code> option for <a href="#mixpanelinit">mixpanel.init()</a> may be turned on for tracking page loads automatically.
700
+
701
+
702
+
703
+
704
+ | Argument | Type | Description |
705
+ | ------------- | ------------- | ----- |
706
+ | **properties** | <span class="mp-arg-type">Object</span></br></span><span class="mp-arg-optional">optional</span> | An optional set of additional properties to send with the page view event |
707
+ | **options** | <span class="mp-arg-type">Object</span></br></span><span class="mp-arg-optional">optional</span> | Page view tracking options |
708
+ | **options.event_name** | <span class="mp-arg-type">String</span></br></span><span class="mp-arg-optional">optional</span> | <ul>
709
+ <li>Alternate name for the tracking event</li>
710
+ </ul> |
711
+ #### Returns:
712
+ | Type | Description |
713
+ | ----- | ------------- |
714
+ | <span class="mp-arg-type">Boolean or Object</span> | If the tracking request was successfully initiated/queued, an object with the tracking payload sent to the API server is returned; otherwise false. |
715
+
716
+
687
717
  ___
688
718
  ## mixpanel.track_with_groups
689
719
  Track an event with specific groups.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.47.0",
3
+ "version": "2.48.1",
4
4
  "description": "The official Mixpanel JavaScript browser client library",
5
5
  "main": "dist/mixpanel.cjs.js",
6
6
  "directories": {
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Config = {
2
2
  DEBUG: false,
3
- LIB_VERSION: '2.47.0'
3
+ LIB_VERSION: '2.48.1'
4
4
  };
5
5
 
6
6
  export default Config;