mixpanel-browser 2.48.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ **2.48.1** (14 Nov 2023)
2
+ - UTM campaign properties will always be persisted super properties (fixes discrepancy between
3
+ minified and unminified package)
4
+
1
5
  **2.48.0** (7 Nov 2023)
2
6
  - API endpoint routes can now be configured individually (i.e. rename /track, /engage, /groups)
3
7
  - Event properties object passed to mixpanel.track() will no longer be mutated
@@ -2,7 +2,7 @@ define(function () { 'use strict';
2
2
 
3
3
  var Config = {
4
4
  DEBUG: false,
5
- LIB_VERSION: '2.48.0'
5
+ LIB_VERSION: '2.48.1'
6
6
  };
7
7
 
8
8
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -4416,7 +4416,7 @@ define(function () { 'use strict';
4416
4416
  MixpanelLib.prototype._set_default_superprops = function() {
4417
4417
  this['persistence'].update_search_keyword(document$1.referrer);
4418
4418
  if (this.get_config('store_google')) {
4419
- this.register(_.info.campaignParams(), {persistent: false});
4419
+ this.register(_.info.campaignParams());
4420
4420
  }
4421
4421
  if (this.get_config('save_referrer')) {
4422
4422
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var Config = {
4
4
  DEBUG: false,
5
- LIB_VERSION: '2.48.0'
5
+ LIB_VERSION: '2.48.1'
6
6
  };
7
7
 
8
8
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -4416,7 +4416,7 @@ MixpanelLib.prototype._loaded = function() {
4416
4416
  MixpanelLib.prototype._set_default_superprops = function() {
4417
4417
  this['persistence'].update_search_keyword(document$1.referrer);
4418
4418
  if (this.get_config('store_google')) {
4419
- this.register(_.info.campaignParams(), {persistent: false});
4419
+ this.register(_.info.campaignParams());
4420
4420
  }
4421
4421
  if (this.get_config('save_referrer')) {
4422
4422
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -3,7 +3,7 @@
3
3
 
4
4
  var Config = {
5
5
  DEBUG: false,
6
- LIB_VERSION: '2.48.0'
6
+ LIB_VERSION: '2.48.1'
7
7
  };
8
8
 
9
9
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -4417,7 +4417,7 @@
4417
4417
  MixpanelLib.prototype._set_default_superprops = function() {
4418
4418
  this['persistence'].update_search_keyword(document$1.referrer);
4419
4419
  if (this.get_config('store_google')) {
4420
- this.register(_.info.campaignParams(), {persistent: false});
4420
+ this.register(_.info.campaignParams());
4421
4421
  }
4422
4422
  if (this.get_config('save_referrer')) {
4423
4423
  this['persistence'].update_referrer_info(document$1.referrer);
@@ -26,7 +26,7 @@ a!==i&&g("Expected '"+a+"' instead of '"+i+"'");i=p.charAt(r);r+=1;return i}func
26
26
  128>e?c++:i=127<e&&2048>e?String.fromCharCode(e>>6|192,e&63|128):String.fromCharCode(e>>12|224,e>>6&63|128,e&63|128);i!==q&&(c>d&&(b+=a.substring(d,c)),b+=i,d=c=g+1)}c>d&&(b+=a.substring(d,a.length));return b};c.eb=function(){function a(){function a(b,d){var c,f=0;for(c=0;c<d.length;c++)f|=g[c]<<8*c;return b^f}var b,c,g=[],e=0;for(b=0;b<A.length;b++)c=A.charCodeAt(b),g.unshift(c&255),4<=g.length&&(e=a(e,g),g=[]);0<g.length&&(e=a(e,g));return e.toString(16)}function b(){var a=1*new Date,b;if(w.performance&&
27
27
  w.performance.now)b=w.performance.now();else for(b=0;a==1*new Date;)b++;return a.toString(16)+Math.floor(b).toString(16)}return function(){var c=(Z.height*Z.width).toString(16);return b()+"-"+Math.random().toString(16).replace(".","")+"-"+a()+"-"+c+"-"+b()}}();var ya="ahrefsbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,facebookexternal,petalbot,pinterest,screaming frog,yahoo! slurp,yandexbot,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleweblight,mediapartners-google,storebot-google".split(",");
28
28
  c.Eb=function(a){var b,a=a.toLowerCase();for(b=0;b<ya.length;b++)if(-1!==a.indexOf(ya[b]))return m;return D};c.jc=function(a){var b,d,f,h=[];c.g(b)&&(b="&");c.a(a,function(a,b){d=encodeURIComponent(a.toString());f=encodeURIComponent(b);h[h.length]=f+"="+d});return h.join(b)};c.Oa=function(a,b){var b=b.replace(/[[]/,"\\[").replace(/[\]]/,"\\]"),c=RegExp("[\\?&]"+b+"=([^&#]*)").exec(a);if(c===q||c&&"string"!==typeof c[1]&&c[1].length)return"";c=c[1];try{c=decodeURIComponent(c)}catch(f){o.error("Skipping decoding for malformed query param: "+
29
- c)}return c.replace(/\+/g," ")};c.cookie={get:function(a){for(var a=a+"=",b=u.cookie.split(";"),c=0;c<b.length;c++){for(var f=b[c];" "==f.charAt(0);)f=f.substring(1,f.length);if(0===f.indexOf(a))return decodeURIComponent(f.substring(a.length,f.length))}return q},parse:function(a){var b;try{b=c.P(c.cookie.get(a))||{}}catch(d){}return b},yd:function(a,b,c,f,h,g,e){var i="",k="",p="";e?i="; domain="+e:f&&(i=(i=ra(u.location.hostname))?"; domain=."+i:"");c&&(k=new Date,k.setTime(k.getTime()+1E3*c),k=
29
+ c)}return c.replace(/\+/g," ")};c.cookie={get:function(a){for(var a=a+"=",b=u.cookie.split(";"),c=0;c<b.length;c++){for(var f=b[c];" "==f.charAt(0);)f=f.substring(1,f.length);if(0===f.indexOf(a))return decodeURIComponent(f.substring(a.length,f.length))}return q},parse:function(a){var b;try{b=c.P(c.cookie.get(a))||{}}catch(d){}return b},xd:function(a,b,c,f,h,g,e){var i="",k="",p="";e?i="; domain="+e:f&&(i=(i=ra(u.location.hostname))?"; domain=."+i:"");c&&(k=new Date,k.setTime(k.getTime()+1E3*c),k=
30
30
  "; expires="+k.toGMTString());g&&(h=m,p="; SameSite=None");h&&(p+="; secure");u.cookie=a+"="+encodeURIComponent(b)+k+"; path=/"+i+p},set:function(a,b,c,f,h,g,e){var i="",k="",p="";e?i="; domain="+e:f&&(i=(i=ra(u.location.hostname))?"; domain=."+i:"");c&&(k=new Date,k.setTime(k.getTime()+864E5*c),k="; expires="+k.toGMTString());g&&(h=m,p="; SameSite=None");h&&(p+="; secure");a=a+"="+encodeURIComponent(b)+k+"; path=/"+i+p;return u.cookie=a},remove:function(a,b,d){c.cookie.set(a,"",-1,b,D,D,d)}};var fa=
31
31
  q;c.localStorage={qa:function(a){(a=U(q,a))||o.error("localStorage unsupported; falling back to cookie store");return a},error:function(a){o.error("localStorage error: "+a)},get:function(a){try{return window.localStorage.getItem(a)}catch(b){c.localStorage.error(b)}return q},parse:function(a){try{return c.P(c.localStorage.get(a))||{}}catch(b){}return q},set:function(a,b){try{window.localStorage.setItem(a,b)}catch(d){c.localStorage.error(d)}},remove:function(a){try{window.localStorage.removeItem(a)}catch(b){c.localStorage.error(b)}}};
32
32
  c.Pb=function(){function a(a,f,h){return function(g){if(g=g||b(window.event)){var e=m,i;c.Sa(h)&&(i=h(g));g=f.call(a,g);if(D===i||D===g)e=D;return e}}}function b(a){if(a)a.preventDefault=b.preventDefault,a.stopPropagation=b.stopPropagation;return a}b.preventDefault=function(){this.returnValue=D};b.stopPropagation=function(){this.cancelBubble=m};return function(b,c,h,g,e){b?b.addEventListener&&!g?b.addEventListener(c,h,!!e):(c="on"+c,b[c]=a(b,h,b[c])):o.error("No valid element provided to register_event")}}();
@@ -39,7 +39,7 @@ return d},ja:function(a,b,d){return d||c.j(a," OPR/")?c.j(a,"Mini")?"Opera Mini"
39
39
  "Safari":c.j(a,"Android")?"Android Mobile":c.j(a,"Konqueror")?"Konqueror":c.j(a,"Firefox")?"Firefox":c.j(a,"MSIE")||c.j(a,"Trident/")?"Internet Explorer":c.j(a,"Gecko")?"Mozilla":""},Ha:function(a,b,d){b={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,
40
40
  Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[c.info.ja(a,b,d)];if(b===l)return q;a=a.match(b);return!a?q:parseFloat(a[a.length-2])},Jb:function(){return/Windows/i.test(A)?/Phone/.test(A)||/WPDesktop/.test(A)?"Windows Phone":"Windows":
41
41
  /(iPhone|iPad|iPod)/.test(A)?"iOS":/Android/.test(A)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(A)?"BlackBerry":/Mac/i.test(A)?"Mac OS X":/Linux/.test(A)?"Linux":/CrOS/.test(A)?"Chrome OS":""},xb:function(a){return/Windows Phone/i.test(a)||/WPDesktop/.test(a)?"Windows Phone":/iPad/.test(a)?"iPad":/iPod/.test(a)?"iPod Touch":/iPhone/.test(a)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(a)?"BlackBerry":/Android/.test(a)?"Android":""},Ob:function(a){a=a.split("/");return 3<=a.length?a[2]:""},X:function(){return c.extend(c.ua({$os:c.info.Jb(),
42
- $browser:c.info.ja(A,I.vendor,Y),$referrer:u.referrer,$referring_domain:c.info.Ob(u.referrer),$device:c.info.xb(A)}),{$current_url:w.location.href,$browser_version:c.info.Ha(A,I.vendor,Y),$screen_height:Z.height,$screen_width:Z.width,mp_lib:"web",$lib_version:"2.48.0",$insert_id:ea(),time:c.timestamp()/1E3})},Nc:function(){return c.extend(c.ua({$os:c.info.Jb(),$browser:c.info.ja(A,I.vendor,Y)}),{$browser_version:c.info.Ha(A,I.vendor,Y)})},Kc:function(){return c.ua({current_page_title:u.title,current_domain:w.location.hostname,
42
+ $browser:c.info.ja(A,I.vendor,Y),$referrer:u.referrer,$referring_domain:c.info.Ob(u.referrer),$device:c.info.xb(A)}),{$current_url:w.location.href,$browser_version:c.info.Ha(A,I.vendor,Y),$screen_height:Z.height,$screen_width:Z.width,mp_lib:"web",$lib_version:"2.48.1",$insert_id:ea(),time:c.timestamp()/1E3})},Nc:function(){return c.extend(c.ua({$os:c.info.Jb(),$browser:c.info.ja(A,I.vendor,Y)}),{$browser_version:c.info.Ha(A,I.vendor,Y)})},Kc:function(){return c.ua({current_page_title:u.title,current_domain:w.location.hostname,
43
43
  current_url_path:w.location.pathname,current_url_protocol:w.location.protocol,current_url_search:w.location.search})}};var Ga=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Fa=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,$=q,aa=q;if("undefined"!==typeof JSON)$=JSON.stringify,aa=JSON.parse;$=$||c.ea;aa=aa||c.P;c.toArray=c.M;c.isObject=c.e;c.JSONEncode=c.ea;c.JSONDecode=c.P;c.isBlockedUA=c.Eb;c.isEmptyObject=c.pa;c.info=c.info;c.info.device=c.info.xb;c.info.browser=c.info.ja;c.info.browserVersion=c.info.Ha;c.info.properties=
44
44
  c.info.X;E.prototype.ma=function(){};E.prototype.Ma=function(){};E.prototype.Fa=function(){};E.prototype.Ra=function(a){this.Gb=a;return this};E.prototype.o=function(a,b,d,f){var h=this,g=c.xc(a);if(0===g.length)o.error("The DOM query ("+a+") returned 0 elements");else return c.a(g,function(a){c.Pb(a,this.Kb,function(a){var c={},g=h.ma(d,this),e=h.Gb.c("track_links_timeout");h.Ma(a,this,c);window.setTimeout(h.bc(f,g,c,m),e);h.Gb.o(b,g,h.bc(f,g,c))})},this),m};E.prototype.bc=function(a,b,c,f){var f=
45
45
  f||D,h=this;return function(){if(!c.uc)c.uc=m,a&&a(f,b)===D||h.Fa(b,c,f)}};E.prototype.ma=function(a,b){return"function"===typeof a?a(b):c.extend({},a)};c.Db(L,E);L.prototype.ma=function(a,b){var c=L.fd.ma.apply(this,arguments);if(b.href)c.url=b.href;return c};L.prototype.Ma=function(a,b,c){c.Hb=2===a.which||a.metaKey||a.ctrlKey||"_blank"===b.target;c.href=b.href;c.Hb||a.preventDefault()};L.prototype.Fa=function(a,b){b.Hb||setTimeout(function(){window.location=b.href},0)};c.Db(T,E);T.prototype.Ma=
@@ -50,7 +50,7 @@ function(a){var b=this.G.slice(0,a);if(b.length<a){var d=this.$();if(d.length){v
50
50
  D}}catch(k){this.h("Error removing items",a),b=D}return b},this);this.Ua.cb(function(){var a=f();b&&b(a)},c.bind(function(a){var c=D;this.h("Error acquiring storage lock",a);if(!U(this.i,m)&&(c=f(),!c))try{this.i.removeItem(this.L)}catch(d){this.h("Error clearing queue",d)}b&&b(c)},this),this.sa)};G.prototype.pd=function(a){this.G=na(this.G,a);this.Ua.cb(c.bind(function(){try{var b=this.$(),b=na(b,a);this.Xa(b)}catch(c){this.h("Error updating items",a)}},this),c.bind(function(a){this.h("Error acquiring storage lock",
51
51
  a)},this),this.sa)};G.prototype.$=function(){var a;try{if(a=this.i.getItem(this.L))a=aa(a),c.isArray(a)||(this.h("Invalid storage entry:",a),a=q)}catch(b){this.h("Error retrieving queue",b),a=q}return a||[]};G.prototype.Xa=function(a){try{return this.i.setItem(this.L,$(a)),m}catch(b){return this.h("Error saving queue",b),D}};G.prototype.clear=function(){this.G=[];this.i.removeItem(this.L)};var R=ga("batch");C.prototype.La=function(a,b){this.Y.La(a,this.na,b)};C.prototype.start=function(){this.ta=
52
52
  D;this.Ia=0;this.flush()};C.prototype.stop=function(){this.ta=m;if(this.$a)clearTimeout(this.$a),this.$a=q};C.prototype.clear=function(){this.Y.clear()};C.prototype.Sb=function(){this.C=this.A.batch_size};C.prototype.aa=function(){this.Tb(this.A.batch_flush_interval_ms)};C.prototype.Tb=function(a){this.na=a;if(!this.ta)this.$a=setTimeout(c.bind(this.flush,this),this.na)};C.prototype.flush=function(a){try{if(this.Rb)R.log("Flush: Request already in progress");else{var a=a||{},b=this.A.batch_request_timeout_ms,
53
- d=(new Date).getTime(),f=this.C,h=this.Y.zc(f),e=[],r={};c.a(h,function(a){var b=a.payload;this.ia&&!a.Mc&&(b=this.ia(b));if(b){b.event&&b.properties&&(b.properties=c.extend({},b.properties,{mp_sent_by_lib_version:"2.48.0"}));var d=m,f=a.id;if(f){if(5<(this.F[f]||0))this.h("[dupe] item ID sent too many times, not sending",{item:a,C:h.length,hd:this.F[f]}),d=D}else this.h("[dupe] found item with no ID",{item:a});d&&e.push(b)}r[a.id]=b},this);if(1>e.length)this.aa();else{this.Rb=m;var i=c.bind(function(e){this.Rb=
53
+ d=(new Date).getTime(),f=this.C,h=this.Y.zc(f),e=[],r={};c.a(h,function(a){var b=a.payload;this.ia&&!a.Mc&&(b=this.ia(b));if(b){b.event&&b.properties&&(b.properties=c.extend({},b.properties,{mp_sent_by_lib_version:"2.48.1"}));var d=m,f=a.id;if(f){if(5<(this.F[f]||0))this.h("[dupe] item ID sent too many times, not sending",{item:a,C:h.length,hd:this.F[f]}),d=D}else this.h("[dupe] found item with no ID",{item:a});d&&e.push(b)}r[a.id]=b},this);if(1>e.length)this.aa();else{this.Rb=m;var i=c.bind(function(e){this.Rb=
54
54
  D;try{var g=D;if(a.ec)this.Y.pd(r);else if(c.e(e)&&"timeout"===e.error&&(new Date).getTime()-d>=b)this.h("Network timeout; retrying"),this.flush();else if(c.e(e)&&e.O&&(500<=e.O.status||429===e.O.status||"timeout"===e.error)){var i=2*this.na,k=e.O.responseHeaders;if(k){var j=k["Retry-After"];j&&(i=1E3*parseInt(j,10)||i)}i=Math.min(6E5,i);this.h("Error; retry in "+i+" ms");this.Tb(i)}else if(c.e(e)&&e.O&&413===e.O.status)if(1<h.length){var p=Math.max(1,Math.floor(f/2));this.C=Math.min(this.C,p,h.length-
55
55
  1);this.h("413 response; reducing batch size to "+this.C);this.aa()}else this.h("Single-event request too large; dropping",h),this.Sb(),g=m;else g=m;g&&(this.Y.Oc(c.map(h,function(a){return a.id}),c.bind(function(a){a?(this.Ia=0,this.flush()):(this.h("Failed to remove items from queue"),5<++this.Ia?(this.h("Too many queue failures; disabling batching system."),this.dd()):this.aa())},this)),c.a(h,c.bind(function(a){var b=a.id;b?(this.F[b]=this.F[b]||0,this.F[b]++,5<this.F[b]&&this.h("[dupe] item ID sent too many times",
56
56
  {item:a,C:h.length,hd:this.F[b]})):this.h("[dupe] found item with no ID while removing",{item:a})},this)))}catch(n){this.h("Error handling API response",n),this.aa()}},this),k={method:"POST",ic:m,Ec:m,ac:b};if(a.ec)k.ab="sendBeacon";R.log("MIXPANEL REQUEST:",e);this.Uc(e,k,i)}}}catch(j){this.h("Error flushing request queue",j),this.aa()}};C.prototype.h=function(a,b){R.error.apply(R.error,arguments);if(this.I)try{b instanceof Error||(b=Error(a)),this.I(a,b)}catch(c){R.error(c)}};var Ma="__mp_opt_in_out_",
@@ -79,14 +79,14 @@ cookie_name:"",loaded:P,track_marketing:m,track_pageview:D,skip_first_touch_mark
79
79
  batch_request_timeout_ms:9E4,batch_autostart:m,hooks:{}},la=D;e.prototype.Ra=function(a,b,d){if(c.g(d))this.l("You must name your new library: init(token, config, name)");else if("mixpanel"===d)this.l("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");else return a=S(a,b,d),y[d]=a,a.ha(),a};e.prototype.U=function(a,b,d){b=b||{};this.__loaded=m;this.config={};var e={};"api_payload_format"in b||(b.api_host||za.api_host).match(/\.mixpanel\.com/)&&(e.api_payload_format=
80
80
  "json");this.Wb(c.extend({},za,e,b,{name:d,token:a,callback_fn:("mixpanel"===d?d:"mixpanel."+d)+"._jsc"}));this._jsc=P;this.xa=[];this.ya=[];this.wa=[];this.R={disable_all_events:D,identify_called:D};this.u={};if(this.Q=this.c("batch_requests"))if(!c.localStorage.qa(m)||!O)this.Q=D,o.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),c.a(this.yb(),function(a){o.log("Clearing batch queue "+a.Z);c.localStorage.remove(a.Z)});else if(this.Fc(),ba&&w.addEventListener){var h=
81
81
  c.bind(function(){this.u.J.ta||this.u.J.flush({ec:m})},this);w.addEventListener("pagehide",function(a){a.persisted&&h()});w.addEventListener("visibilitychange",function(){"hidden"===u.visibilityState&&h()})}this.persistence=this.cookie=new n(this.config);this.N={};this.pc();a=c.eb();this.K()||this.w({distinct_id:"$device:"+a,$device_id:a},"");this.c("track_pageview")&&this.cc()};e.prototype.ha=function(){this.c("loaded")(this);this.mb()};e.prototype.mb=function(){this.persistence.hc(u.referrer);this.c("store_google")&&
82
- this.m(c.info.ka(),{xd:D});this.c("save_referrer")&&this.persistence.bb(u.referrer)};e.prototype.mc=function(){c.a(this.xa,function(a){this.Da.apply(this,a)},this);this.V()||c.a(this.ya,function(a){this.k.apply(this,a)},this);delete this.xa;delete this.ya};e.prototype.Da=function(a,b){if(this.c("img"))return this.l("You can't use DOM tracking functions with img = true."),D;if(!la)return this.xa.push([a,b]),D;var c=(new a).Ra(this);return c.o.apply(c,b)};e.prototype.jb=function(a,b){if(c.g(a))return q;
83
- if(O)return function(c){a(c,b)};var d=this._jsc,e=""+Math.floor(1E8*Math.random()),h=this.c("callback_fn")+"["+e+"]";d[e]=function(c){delete d[e];a(c,b)};return h};e.prototype.k=function(a,b,d,e){var h=m;if(ma)return this.ya.push(arguments),h;var g={method:this.c("api_method"),ab:this.c("api_transport"),ic:this.c("verbose")},j=q;if(!e&&(c.Sa(d)||"string"===typeof d))e=d,d=q;d=c.extend(g,d||{});if(!O)d.method="GET";var g="POST"===d.method,i=ba&&g&&"sendbeacon"===d.ab.toLowerCase(),k=d.ic;b.verbose&&
84
- (k=m);this.c("test")&&(b.test=1);k&&(b.verbose=1);this.c("img")&&(b.img=1);if(!O)if(e)b.callback=e;else if(k||this.c("test"))b.callback="(function(){})";b.ip=this.c("ip")?1:0;b._=(new Date).getTime().toString();g&&(j="data="+encodeURIComponent(b.data),delete b.data);var a=a+("?"+c.jc(b)),n=this;if("img"in b)j=u.createElement("img"),j.src=a,u.body.appendChild(j);else if(i){try{h=ba(a,j)}catch(s){n.l(s),h=D}try{e&&e(h?1:0)}catch(o){n.l(o)}}else if(O)try{var v=new XMLHttpRequest;v.open(d.method,a,m);
85
- var t=this.c("xhr_headers");g&&(t["Content-Type"]="application/x-www-form-urlencoded");c.a(t,function(a,b){v.setRequestHeader(b,a)});if(d.ac&&"undefined"!==typeof v.timeout){v.timeout=d.ac;var w=(new Date).getTime()}v.withCredentials=m;v.onreadystatechange=function(){if(4===v.readyState)if(200===v.status){if(e)if(k){var a;try{a=c.P(v.responseText)}catch(b){if(n.l(b),d.Ec)a=v.responseText;else return}e(a)}else e(Number(v.responseText))}else a=v.timeout&&!v.status&&(new Date).getTime()-w>=v.timeout?
86
- "timeout":"Bad HTTP status: "+v.status+" "+v.statusText,n.l(a),e&&(k?e({status:0,error:a,O:v}):e(0))};v.send(j)}catch(y){n.l(y),h=D}else j=u.createElement("script"),j.type="text/javascript",j.async=m,j.defer=m,j.src=a,t=u.getElementsByTagName("script")[0],t.parentNode.insertBefore(j,t);return h};e.prototype.za=function(a){function b(a,b){c.a(a,function(a){if(c.isArray(a[0])){var d=b;c.a(a,function(a){d=d[a[0]].apply(d,a.slice(1))})}else this[a[0]].apply(this,a.slice(1))},b)}var d,e=[],h=[],g=[];c.a(a,
87
- function(a){a&&(d=a[0],c.isArray(d)?g.push(a):"function"===typeof a?a.call(this):c.isArray(a)&&"alias"===d?e.push(a):c.isArray(a)&&-1!==d.indexOf("track")&&"function"===typeof this[d]?g.push(a):h.push(a))},this);b(e,this);b(h,this);b(g,this)};e.prototype.nb=function(){return!!this.u.J};e.prototype.yb=function(){var a="__mpq_"+this.c("token"),b=this.c("api_routes");return this.fb=this.fb||{J:{type:"events",D:"/"+b.track,Z:a+"_ev"},Wa:{type:"people",D:"/"+b.engage,Z:a+"_pp"},Pa:{type:"groups",D:"/"+
88
- b.groups,Z:a+"_gr"}}};e.prototype.Fc=function(){if(!this.nb()){var a=c.bind(function(a){return new C(a.Z,{A:this.config,Vc:c.bind(function(b,c,e){this.k(this.c("api_host")+a.D,this.hb(b),c,this.jb(e,b))},this),ia:c.bind(function(b){return this.lb("before_send_"+a.type,b)},this),I:this.c("error_reporter"),ed:c.bind(this.Za,this)})},this),b=this.yb();this.u={J:a(b.J),Wa:a(b.Wa),Pa:a(b.Pa)}}this.c("batch_autostart")&&this.Ya()};e.prototype.Ya=function(){this.kc=m;if(this.nb())this.Q=m,c.a(this.u,function(a){a.start()})};
89
- e.prototype.Za=function(){this.Q=D;c.a(this.u,function(a){a.stop();a.clear()})};e.prototype.push=function(a){this.za([a])};e.prototype.disable=function(a){"undefined"===typeof a?this.R.wc=m:this.wa=this.wa.concat(a)};e.prototype.hb=function(a){a=c.ea(a);"base64"===this.c("api_payload_format")&&(a=c.tc(a));return{data:a}};e.prototype.Ea=function(a,b){var d=c.truncate(a.data,255),e=a.D,h=a.Ga,g=a.cd,j=a.Wc||{},b=b||P,i=m,k=c.bind(function(){j.Zb||(d=this.lb("before_send_"+a.type,d));return d?(o.log("MIXPANEL REQUEST:"),
82
+ this.m(c.info.ka());this.c("save_referrer")&&this.persistence.bb(u.referrer)};e.prototype.mc=function(){c.a(this.xa,function(a){this.Da.apply(this,a)},this);this.V()||c.a(this.ya,function(a){this.k.apply(this,a)},this);delete this.xa;delete this.ya};e.prototype.Da=function(a,b){if(this.c("img"))return this.l("You can't use DOM tracking functions with img = true."),D;if(!la)return this.xa.push([a,b]),D;var c=(new a).Ra(this);return c.o.apply(c,b)};e.prototype.jb=function(a,b){if(c.g(a))return q;if(O)return function(c){a(c,
83
+ b)};var d=this._jsc,e=""+Math.floor(1E8*Math.random()),h=this.c("callback_fn")+"["+e+"]";d[e]=function(c){delete d[e];a(c,b)};return h};e.prototype.k=function(a,b,d,e){var h=m;if(ma)return this.ya.push(arguments),h;var g={method:this.c("api_method"),ab:this.c("api_transport"),ic:this.c("verbose")},j=q;if(!e&&(c.Sa(d)||"string"===typeof d))e=d,d=q;d=c.extend(g,d||{});if(!O)d.method="GET";var g="POST"===d.method,i=ba&&g&&"sendbeacon"===d.ab.toLowerCase(),k=d.ic;b.verbose&&(k=m);this.c("test")&&(b.test=
84
+ 1);k&&(b.verbose=1);this.c("img")&&(b.img=1);if(!O)if(e)b.callback=e;else if(k||this.c("test"))b.callback="(function(){})";b.ip=this.c("ip")?1:0;b._=(new Date).getTime().toString();g&&(j="data="+encodeURIComponent(b.data),delete b.data);var a=a+("?"+c.jc(b)),n=this;if("img"in b)j=u.createElement("img"),j.src=a,u.body.appendChild(j);else if(i){try{h=ba(a,j)}catch(s){n.l(s),h=D}try{e&&e(h?1:0)}catch(o){n.l(o)}}else if(O)try{var v=new XMLHttpRequest;v.open(d.method,a,m);var t=this.c("xhr_headers");g&&
85
+ (t["Content-Type"]="application/x-www-form-urlencoded");c.a(t,function(a,b){v.setRequestHeader(b,a)});if(d.ac&&"undefined"!==typeof v.timeout){v.timeout=d.ac;var w=(new Date).getTime()}v.withCredentials=m;v.onreadystatechange=function(){if(4===v.readyState)if(200===v.status){if(e)if(k){var a;try{a=c.P(v.responseText)}catch(b){if(n.l(b),d.Ec)a=v.responseText;else return}e(a)}else e(Number(v.responseText))}else a=v.timeout&&!v.status&&(new Date).getTime()-w>=v.timeout?"timeout":"Bad HTTP status: "+
86
+ v.status+" "+v.statusText,n.l(a),e&&(k?e({status:0,error:a,O:v}):e(0))};v.send(j)}catch(y){n.l(y),h=D}else j=u.createElement("script"),j.type="text/javascript",j.async=m,j.defer=m,j.src=a,t=u.getElementsByTagName("script")[0],t.parentNode.insertBefore(j,t);return h};e.prototype.za=function(a){function b(a,b){c.a(a,function(a){if(c.isArray(a[0])){var d=b;c.a(a,function(a){d=d[a[0]].apply(d,a.slice(1))})}else this[a[0]].apply(this,a.slice(1))},b)}var d,e=[],h=[],g=[];c.a(a,function(a){a&&(d=a[0],c.isArray(d)?
87
+ g.push(a):"function"===typeof a?a.call(this):c.isArray(a)&&"alias"===d?e.push(a):c.isArray(a)&&-1!==d.indexOf("track")&&"function"===typeof this[d]?g.push(a):h.push(a))},this);b(e,this);b(h,this);b(g,this)};e.prototype.nb=function(){return!!this.u.J};e.prototype.yb=function(){var a="__mpq_"+this.c("token"),b=this.c("api_routes");return this.fb=this.fb||{J:{type:"events",D:"/"+b.track,Z:a+"_ev"},Wa:{type:"people",D:"/"+b.engage,Z:a+"_pp"},Pa:{type:"groups",D:"/"+b.groups,Z:a+"_gr"}}};e.prototype.Fc=
88
+ function(){if(!this.nb()){var a=c.bind(function(a){return new C(a.Z,{A:this.config,Vc:c.bind(function(b,c,e){this.k(this.c("api_host")+a.D,this.hb(b),c,this.jb(e,b))},this),ia:c.bind(function(b){return this.lb("before_send_"+a.type,b)},this),I:this.c("error_reporter"),ed:c.bind(this.Za,this)})},this),b=this.yb();this.u={J:a(b.J),Wa:a(b.Wa),Pa:a(b.Pa)}}this.c("batch_autostart")&&this.Ya()};e.prototype.Ya=function(){this.kc=m;if(this.nb())this.Q=m,c.a(this.u,function(a){a.start()})};e.prototype.Za=
89
+ function(){this.Q=D;c.a(this.u,function(a){a.stop();a.clear()})};e.prototype.push=function(a){this.za([a])};e.prototype.disable=function(a){"undefined"===typeof a?this.R.wc=m:this.wa=this.wa.concat(a)};e.prototype.hb=function(a){a=c.ea(a);"base64"===this.c("api_payload_format")&&(a=c.tc(a));return{data:a}};e.prototype.Ea=function(a,b){var d=c.truncate(a.data,255),e=a.D,h=a.Ga,g=a.cd,j=a.Wc||{},b=b||P,i=m,k=c.bind(function(){j.Zb||(d=this.lb("before_send_"+a.type,d));return d?(o.log("MIXPANEL REQUEST:"),
90
90
  o.log(d),this.k(e,this.hb(d),j,this.jb(b,d))):q},this);this.Q&&!g?h.La(d,function(a){a?b(1,d):k()}):i=k();return i&&d};e.prototype.o=M(function(a,b,d,e){!e&&"function"===typeof d&&(e=d,d=q);var d=d||{},h=d.transport;if(h)d.ab=h;h=d.send_immediately;"function"!==typeof e&&(e=P);if(c.g(a))this.l("No event name provided to mixpanel.track");else if(this.ib(a))e(0);else{b=c.extend({},b);b.token=this.c("token");var g=this.persistence.Pc(a);c.g(g)||(b.$duration=parseFloat((((new Date).getTime()-g)/1E3).toFixed(3)));
91
91
  this.mb();g=this.c("track_marketing")?c.info.Jc():{};b=c.extend({},c.info.X(),g,this.persistence.X(),this.N,b);g=this.c("property_blacklist");c.isArray(g)?c.a(g,function(a){delete b[a]}):this.l("Invalid value for property_blacklist config: "+g);return this.Ea({type:"events",data:{event:a,properties:b},D:this.c("api_host")+"/"+this.c("api_routes").track,Ga:this.u.J,cd:h,Wc:d},e)}});e.prototype.ad=M(function(a,b,d){c.isArray(b)||(b=[b]);var e={};e[a]=b;this.m(e);return this.people.set(a,b,d)});e.prototype.qc=
92
92
  M(function(a,b,c){var e=this.s(a),h={};e===l?(h[a]=[b],this.m(h)):-1===e.indexOf(b)&&(e.push(b),h[a]=e,this.m(h));return this.people.ca(a,b,c)});e.prototype.Qc=M(function(a,b,c){var e=this.s(a);if(e!==l){var h=e.indexOf(b);-1<h&&(e.splice(h,1),this.m({wd:e}));0===e.length&&this.da(a)}return this.people.remove(a,b,c)});e.prototype.od=M(function(a,b,d,e){var h=c.extend({},b||{});c.a(d,function(a,b){a!==q&&a!==l&&(h[b]=a)});return this.o(a,h,e)});e.prototype.lc=function(a,b){return a+"_"+JSON.stringify(b)};
@@ -6,7 +6,7 @@
6
6
 
7
7
  var Config = {
8
8
  DEBUG: false,
9
- LIB_VERSION: '2.48.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
@@ -4420,7 +4420,7 @@
4420
4420
  MixpanelLib.prototype._set_default_superprops = function() {
4421
4421
  this['persistence'].update_search_keyword(document$1.referrer);
4422
4422
  if (this.get_config('store_google')) {
4423
- this.register(_.info.campaignParams(), {persistent: false});
4423
+ this.register(_.info.campaignParams());
4424
4424
  }
4425
4425
  if (this.get_config('save_referrer')) {
4426
4426
  this['persistence'].update_referrer_info(document$1.referrer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.48.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.48.0'
3
+ LIB_VERSION: '2.48.1'
4
4
  };
5
5
 
6
6
  export default Config;
@@ -359,7 +359,7 @@ MixpanelLib.prototype._loaded = function() {
359
359
  MixpanelLib.prototype._set_default_superprops = function() {
360
360
  this['persistence'].update_search_keyword(document.referrer);
361
361
  if (this.get_config('store_google')) {
362
- this.register(_.info.campaignParams(), {persistent: false});
362
+ this.register(_.info.campaignParams());
363
363
  }
364
364
  if (this.get_config('save_referrer')) {
365
365
  this['persistence'].update_referrer_info(document.referrer);