diff --git a/build/mixpanel.amd.js b/build/mixpanel.amd.js index fac63c70..0c17e928 100644 --- a/build/mixpanel.amd.js +++ b/build/mixpanel.amd.js @@ -3354,10 +3354,16 @@ define(function () { 'use strict'; return this['props'][key] || (this['props'][key] = default_val); }; - MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { + MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3368,7 +3374,15 @@ define(function () { 'use strict'; delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3812,10 +3826,16 @@ define(function () { 'use strict'; properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4080,7 +4100,7 @@ define(function () { 'use strict'; * * @param {String} event_name The name of the event. */ - MixpanelLib.prototype.time_event = function(event_name) { + MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4090,7 +4110,7 @@ define(function () { 'use strict'; return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/build/mixpanel.cjs.js b/build/mixpanel.cjs.js index 371d6a48..395d41f1 100644 --- a/build/mixpanel.cjs.js +++ b/build/mixpanel.cjs.js @@ -3354,10 +3354,16 @@ MixpanelPersistence.prototype._get_or_create_queue = function(queue, default_val return this['props'][key] || (this['props'][key] = default_val); }; -MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { +MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3368,7 +3374,15 @@ MixpanelPersistence.prototype.remove_event_timer = function(event_name) { delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3812,10 +3826,16 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4080,7 +4100,7 @@ MixpanelLib.prototype.track_forms = function() { * * @param {String} event_name The name of the event. */ -MixpanelLib.prototype.time_event = function(event_name) { +MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4090,7 +4110,7 @@ MixpanelLib.prototype.time_event = function(event_name) { return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/build/mixpanel.globals.js b/build/mixpanel.globals.js index c042a221..8d5db4b9 100644 --- a/build/mixpanel.globals.js +++ b/build/mixpanel.globals.js @@ -3355,10 +3355,16 @@ return this['props'][key] || (this['props'][key] = default_val); }; - MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { + MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3369,7 +3375,15 @@ delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3813,10 +3827,16 @@ properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4081,7 +4101,7 @@ * * @param {String} event_name The name of the event. */ - MixpanelLib.prototype.time_event = function(event_name) { + MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4091,7 +4111,7 @@ return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/build/mixpanel.umd.js b/build/mixpanel.umd.js index 92e0e899..0f3e8098 100644 --- a/build/mixpanel.umd.js +++ b/build/mixpanel.umd.js @@ -3358,10 +3358,16 @@ return this['props'][key] || (this['props'][key] = default_val); }; - MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { + MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3372,7 +3378,15 @@ delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3816,10 +3830,16 @@ properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4084,7 +4104,7 @@ * * @param {String} event_name The name of the event. */ - MixpanelLib.prototype.time_event = function(event_name) { + MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4094,7 +4114,7 @@ return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/examples/commonjs-browserify/bundle.js b/examples/commonjs-browserify/bundle.js index 573cfa65..bfc227c3 100644 --- a/examples/commonjs-browserify/bundle.js +++ b/examples/commonjs-browserify/bundle.js @@ -3355,10 +3355,16 @@ MixpanelPersistence.prototype._get_or_create_queue = function(queue, default_val return this['props'][key] || (this['props'][key] = default_val); }; -MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { +MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3369,7 +3375,15 @@ MixpanelPersistence.prototype.remove_event_timer = function(event_name) { delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3813,10 +3827,16 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4081,7 +4101,7 @@ MixpanelLib.prototype.track_forms = function() { * * @param {String} event_name The name of the event. */ -MixpanelLib.prototype.time_event = function(event_name) { +MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4091,7 +4111,7 @@ MixpanelLib.prototype.time_event = function(event_name) { return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/examples/es2015-babelify/bundle.js b/examples/es2015-babelify/bundle.js index b1521f1c..23cc1503 100644 --- a/examples/es2015-babelify/bundle.js +++ b/examples/es2015-babelify/bundle.js @@ -1725,10 +1725,16 @@ MixpanelPersistence.prototype._get_or_create_queue = function (queue, default_va return this['props'][key] || (this['props'][key] = default_val); }; -MixpanelPersistence.prototype.set_event_timer = function (event_name, timestamp) { +MixpanelPersistence.prototype.set_event_timer = function (event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && typeof callback === 'function') { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -1739,7 +1745,15 @@ MixpanelPersistence.prototype.remove_event_timer = function (event_name) { delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_utils._.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -2194,10 +2208,16 @@ MixpanelLib.prototype.track = (0, _gdprUtils.addOptOutCheckMixpanelLib)(function properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_utils._.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_utils._.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -2457,7 +2477,7 @@ MixpanelLib.prototype.track_forms = function () { * * @param {String} event_name The name of the event. */ -MixpanelLib.prototype.time_event = function (event_name) { +MixpanelLib.prototype.time_event = function (event_name, callback) { if (_utils._.isUndefined(event_name)) { _utils.console.error('No event name provided to mixpanel.time_event'); return; @@ -2467,7 +2487,7 @@ MixpanelLib.prototype.time_event = function (event_name) { return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/examples/umd-webpack/bundle.js b/examples/umd-webpack/bundle.js index b755b5d7..54023044 100644 --- a/examples/umd-webpack/bundle.js +++ b/examples/umd-webpack/bundle.js @@ -3421,10 +3421,16 @@ return this['props'][key] || (this['props'][key] = default_val); }; - MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { + MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -3435,7 +3441,15 @@ delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -3879,10 +3893,16 @@ properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -4147,7 +4167,7 @@ * * @param {String} event_name The name of the event. */ - MixpanelLib.prototype.time_event = function(event_name) { + MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console$1.error('No event name provided to mixpanel.time_event'); return; @@ -4157,7 +4177,7 @@ return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/mixpanel.min.js b/mixpanel.min.js index c2b2c0f7..c9c5cae4 100644 --- a/mixpanel.min.js +++ b/mixpanel.min.js @@ -1,39 +1,39 @@ (function() { var l=void 0,m=!0,s=null,C=!1;function G(){return function(){}} (function(){function la(){function a(){if(!a.rd)ea=a.rd=m,fa=C,c.a(D,function(a){a.Kc()})}function b(){try{o.documentElement.doScroll("left")}catch(d){setTimeout(b,1);return}a()}if(o.addEventListener)"complete"===o.readyState?a():o.addEventListener("DOMContentLoaded",a,C);else if(o.attachEvent){o.attachEvent("onreadystatechange",a);var d=C;try{d=t.frameElement===s}catch(e){}o.documentElement.doScroll&&d&&b()}c.I(t,"load",a,m)}function ma(){w.init=function(a,b,d){if(d)return w[d]||(w[d]=D[d]=Q(a,b, -d),w[d].za()),w[d];d=w;if(D.mixpanel)d=D.mixpanel;else if(a)d=Q(a,b,"mixpanel"),d.za(),D.mixpanel=d;w=d;1===$&&(t.mixpanel=w);na()}}function na(){c.a(D,function(a,b){"mixpanel"!==b&&(w[b]=a)});w._=c}function Q(a,b,d){var e,g="mixpanel"===d?w:w[d];if(g&&0===$)e=g;else{if(g&&!c.isArray(g)){r.error("You have already initialized "+d);return}e=new f}e.ea(a,b,d);e.people=new n;e.people.ea(e);e.vb={};E=E||e.c("debug");e.__autotrack_enabled=e.c("autotrack");if(e.c("autotrack"))N.sd(e.c("token"),100,100)? -N.yd()?N.Y(e):(e.__autotrack_enabled=C,r.log("Disabling Automatic Event Collection because this browser is not supported")):(e.__autotrack_enabled=C,r.log("Not in active bucket: disabling Automatic Event Collection."));!c.e(g)&&c.isArray(g)&&(e.Sa.call(e.people,g.people),e.Sa(g));return e}function n(){}function f(){}function p(a){this.props={};this.Nb=C;this.name=a.persistence_name?"mp_"+a.persistence_name:"mp_"+a.token+"_mixpanel";var b=a.persistence;if("cookie"!==b&&"localStorage"!==b)r.X("Unknown persistence type "+ +d),w[d].za()),w[d];d=w;if(D.mixpanel)d=D.mixpanel;else if(a)d=Q(a,b,"mixpanel"),d.za(),D.mixpanel=d;w=d;1===$&&(t.mixpanel=w);na()}}function na(){c.a(D,function(a,b){"mixpanel"!==b&&(w[b]=a)});w._=c}function Q(a,b,d){var e,f="mixpanel"===d?w:w[d];if(f&&0===$)e=f;else{if(f&&!c.isArray(f)){r.error("You have already initialized "+d);return}e=new g}e.ea(a,b,d);e.people=new n;e.people.ea(e);e.vb={};E=E||e.c("debug");e.__autotrack_enabled=e.c("autotrack");if(e.c("autotrack"))N.sd(e.c("token"),100,100)? +N.yd()?N.Y(e):(e.__autotrack_enabled=C,r.log("Disabling Automatic Event Collection because this browser is not supported")):(e.__autotrack_enabled=C,r.log("Not in active bucket: disabling Automatic Event Collection."));!c.e(f)&&c.isArray(f)&&(e.Sa.call(e.people,f.people),e.Sa(f));return e}function n(){}function g(){}function p(a){this.props={};this.Nb=C;this.name=a.persistence_name?"mp_"+a.persistence_name:"mp_"+a.token+"_mixpanel";var b=a.persistence;if("cookie"!==b&&"localStorage"!==b)r.X("Unknown persistence type "+ b+"; falling back to cookie"),b=a.persistence="cookie";this.w="localStorage"===b&&c.localStorage.mb()?c.localStorage:c.cookie;this.load();this.xc(a);this.ae(a);this.save()}function R(){this.hc="submit"}function H(){this.hc="click"}function B(){}function u(){}function S(a){switch(typeof a.className){case "string":return a.className;case "object":return a.className.he||a.getAttribute("class")||"";default:return""}}function oa(a){var b="";T(a)&&a.childNodes&&a.childNodes.length&&c.a(a.childNodes,function(a){a&& 3===a.nodeType&&a.textContent&&(b+=c.trim(a.textContent).split(/(\s+)/).filter(U).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))});return c.trim(b)}function I(a,b){return a&&a.tagName&&a.tagName.toLowerCase()===b.toLowerCase()}function pa(a,b){if(!a||I(a,"html")||!(a&&1===a.nodeType))return C;switch(a.tagName.toLowerCase()){case "html":return C;case "form":return"submit"===b.type;case "input":return-1===["button","submit"].indexOf(a.getAttribute("type"))?"change"===b.type: "click"===b.type;case "select":case "textarea":return"change"===b.type;default:return"click"===b.type}}function T(a){for(var b=a;b.parentNode&&!I(b,"body");b=b.parentNode){var d=S(b).split(" ");if(c.g(d,"mp-sensitive")||c.g(d,"mp-no-track"))return C}if(c.g(S(a).split(" "),"mp-include"))return m;if(I(a,"input")||I(a,"select")||I(a,"textarea")||"true"===a.getAttribute("contenteditable"))return C;b=a.type||"";if("string"===typeof b)switch(b.toLowerCase()){case "hidden":return C;case "password":return C}a= a.name||a.id||"";return"string"===typeof a&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))?C:m}function U(a){if(a===s||c.e(a)||"string"===typeof a&&(a=c.trim(a),/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((a||"").replace(/[\- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(a)))return C; return m}function qa(a,b){ga(m,a,b)}function ra(a,b){ga(C,a,b)}function sa(a,b){return"1"===V(b).get(W(a,b))}function ha(a,b){return ta(b)?m:"0"===V(b).get(W(a,b))}function J(a){return aa(a,function(a){return this.c(a)})}function F(a){return aa(a,function(a){return this.L(a)})}function K(a){return aa(a,function(a){return this.L(a)})}function ua(a,b){b=b||{};V(b).remove(W(a,b),!!b.Sb)}function V(a){a=a||{};return"localStorage"===a.jc?c.localStorage:c.cookie}function W(a,b){b=b||{};return(b.ic||va)+ -a}function ta(a){var a=a&&a.window||t,b=a.navigator||{},d=C;c.a([b.doNotTrack,b.msDoNotTrack,a.doNotTrack],function(a){c.g([m,1,"1","yes"],a)&&(d=m)});return d}function ga(a,b,d){!c.Fa(b)||!b.length?console.error("gdpr."+(a?"optIn":"optOut")+" called with an invalid token"):(d=d||{},V(d).set(W(b,d),a?1:0,c.bc(d.Rb)?d.Rb:s,!!d.Sb,!!d.Ld),d.p&&a&&d.p(d.Ud||"$opt_in",d.Vd))}function aa(a,b){return function(){var d=C;try{var c=b.call(this,"token"),g=b.call(this,"opt_out_tracking_persistence_type"),j= -b.call(this,"opt_out_tracking_cookie_prefix"),k=b.call(this,"window");c&&(d=ha(c,{jc:g,ic:j,window:k}))}catch(i){console.error("Unexpected error when checking tracking opt-out status: "+i)}if(!d)return a.apply(this,arguments);d=arguments[arguments.length-1];"function"===typeof d&&d(0)}}var E=C,t;if("undefined"===typeof window){var z={hostname:""};t={navigator:{userAgent:""},document:{location:z,referrer:""},screen:{width:0,height:0},location:z}}else t=window;var z=Array.prototype,ia=Object.prototype, +a}function ta(a){var a=a&&a.window||t,b=a.navigator||{},d=C;c.a([b.doNotTrack,b.msDoNotTrack,a.doNotTrack],function(a){c.g([m,1,"1","yes"],a)&&(d=m)});return d}function ga(a,b,d){!c.Fa(b)||!b.length?console.error("gdpr."+(a?"optIn":"optOut")+" called with an invalid token"):(d=d||{},V(d).set(W(b,d),a?1:0,c.bc(d.Rb)?d.Rb:s,!!d.Sb,!!d.Ld),d.p&&a&&d.p(d.Ud||"$opt_in",d.Vd))}function aa(a,b){return function(){var d=C;try{var c=b.call(this,"token"),f=b.call(this,"opt_out_tracking_persistence_type"),j= +b.call(this,"opt_out_tracking_cookie_prefix"),k=b.call(this,"window");c&&(d=ha(c,{jc:f,ic:j,window:k}))}catch(i){console.error("Unexpected error when checking tracking opt-out status: "+i)}if(!d)return a.apply(this,arguments);d=arguments[arguments.length-1];"function"===typeof d&&d(0)}}var E=C,t;if("undefined"===typeof window){var z={hostname:""};t={navigator:{userAgent:""},document:{location:z,referrer:""},screen:{width:0,height:0},location:z}}else t=window;var z=Array.prototype,ia=Object.prototype, L=z.slice,O=ia.toString,X=ia.hasOwnProperty,y=t.console,M=t.navigator,o=t.document,P=t.opera,Y=t.screen,x=M.userAgent,ba=Function.prototype.bind,ja=z.forEach,ka=z.indexOf,z=Array.isArray,ca={},c={trim:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},r={log:function(){if(E&&!c.e(y)&&y)try{y.log.apply(y,arguments)}catch(a){c.a(arguments,function(a){y.log(a)})}},error:function(){if(E&&!c.e(y)&&y){var a=["Mixpanel error:"].concat(c.pa(arguments));try{y.error.apply(y,a)}catch(b){c.a(a, function(a){y.error(a)})}}},X:function(){if(!c.e(y)&&y){var a=["Mixpanel error:"].concat(c.pa(arguments));try{y.error.apply(y,a)}catch(b){c.a(a,function(a){y.error(a)})}}}};c.bind=function(a,b){var d,e;if(ba&&a.bind===ba)return ba.apply(a,L.call(arguments,1));if(!c.lb(a))throw new TypeError;d=L.call(arguments,2);return e=function(){if(!(this instanceof e))return a.apply(b,d.concat(L.call(arguments)));var c={};c.prototype=a.prototype;var j=new c;c.prototype=s;c=a.apply(j,d.concat(L.call(arguments))); -return Object(c)===c?c:j}};c.Lb=function(a){for(var b in a)"function"===typeof a[b]&&(a[b]=c.bind(a[b],a))};c.a=function(a,b,d){if(!(a===s||a===l))if(ja&&a.forEach===ja)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,g=a.length;c/g,">").replace(/"/g,""").replace(/'/g,"'"));return a};c.extend= +return Object(c)===c?c:j}};c.Lb=function(a){for(var b in a)"function"===typeof a[b]&&(a[b]=c.bind(a[b],a))};c.a=function(a,b,d){if(!(a===s||a===l))if(ja&&a.forEach===ja)a.forEach(b,d);else if(a.length===+a.length)for(var c=0,f=a.length;c/g,">").replace(/"/g,""").replace(/'/g,"'"));return a};c.extend= function(a){c.a(L.call(arguments,1),function(b){for(var d in b)b[d]!==l&&(a[d]=b[d])});return a};c.isArray=z||function(a){return"[object Array]"===O.call(a)};c.lb=function(a){try{return/^\s*\bfunction\b/.test(a)}catch(b){return C}};c.xd=function(a){return!(!a||!X.call(a,"callee"))};c.pa=function(a){return!a?[]:a.pa?a.pa():c.isArray(a)||c.xd(a)?L.call(a):c.ce(a)};c.keys=function(a){var b=[];if(a===s)return b;c.a(a,function(a,c){b[b.length]=c});return b};c.ce=function(a){var b=[];if(a===s)return b; c.a(a,function(a){b[b.length]=a});return b};c.le=function(a){return a};c.Yb=function(a,b){var d=C;if(a===s)return d;if(ka&&a.indexOf===ka)return-1!=a.indexOf(b);c.a(a,function(a){if(d||(d=a===b))return ca});return d};c.g=function(a,b){return-1!==a.indexOf(b)};c.$b=function(a,b){a.prototype=new b;a.Sd=b.prototype};c.h=function(a){return a===Object(a)&&!c.isArray(a)};c.la=function(a){if(c.h(a)){for(var b in a)if(X.call(a,b))return C;return m}return C};c.e=function(a){return a===l};c.Fa=function(a){return"[object String]"== O.call(a)};c.zd=function(a){return"[object Date]"==O.call(a)};c.bc=function(a){return"[object Number]"==O.call(a)};c.Ad=function(a){return!!(a&&1===a.nodeType)};c.eb=function(a){c.a(a,function(b,d){c.zd(b)?a[d]=c.td(b):c.h(b)&&(a[d]=c.eb(b))});return a};c.timestamp=function(){Date.now=Date.now||function(){return+new Date};return Date.now()};c.td=function(a){function b(a){return 10>a?"0"+a:a}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+ ":"+b(a.getUTCSeconds())};c.m=function(a){return function(){try{return a.apply(this,arguments)}catch(b){r.X("Implementation error. Please turn on debug and contact support@mixpanel.com."),E&&r.X(b)}}};c.Hd=function(a){for(var b=["identify","_check_and_handle_notifications","_show_notification"],d=0;d=i;)g()} -function d(){var a,b,d="",c;if('"'===i)for(;g();){if('"'===i)return g(),d;if("\\"===i)if(g(),"u"===i){for(b=c=0;4>b;b+=1){a=parseInt(g(),16);if(!isFinite(a))break;c=16*c+a}d+=String.fromCharCode(c)}else if("string"===typeof f[i])d+=f[i];else break;else d+=i}j("Bad string")}function c(){var a;a="";"-"===i&&(a="-",g("-"));for(;"0"<=i&&"9">=i;)a+=i,g();if("."===i)for(a+=".";g()&&"0"<=i&&"9">=i;)a+=i;if("e"===i||"E"===i){a+=i;g();if("-"===i||"+"===i)a+=i,g();for(;"0"<=i&&"9">=i;)a+=i,g()}a=+a;if(isFinite(a))return a; -j("Bad number")}function g(a){a&&a!==i&&j("Expected '"+a+"' instead of '"+i+"'");i=h.charAt(k);k+=1;return i}function j(a){a=new SyntaxError(a);a.ge=k;a.text=h;throw a;}var k,i,f={'"':'"',"\\":"\\","/":"/",b:"\u0008",f:"\u000c",n:"\n",r:"\r",t:"\t"},h,q;q=function(){b();switch(i){case "{":var k;a:{var f,h={};if("{"===i){g("{");b();if("}"===i){g("}");k=h;break a}for(;i;){f=d();b();g(":");Object.hasOwnProperty.call(h,f)&&j('Duplicate key "'+f+'"');h[f]=q();b();if("}"===i){g("}");k=h;break a}g(","); -b()}}j("Bad object")}return k;case "[":a:{k=[];if("["===i){g("[");b();if("]"===i){g("]");f=k;break a}for(;i;){k.push(q());b();if("]"===i){g("]");f=k;break a}g(",");b()}}j("Bad array")}return f;case '"':return d();case "-":return c();default:return"0"<=i&&"9">=i?c():a()}};return function(a){h=a;k=0;i=" ";a=q();b();i&&j("Syntax error");return a}}();c.$a=function(a){var b,d,e,g,j=0,k=0,i="",i=[];if(!a)return a;a=c.be(a);do b=a.charCodeAt(j++),d=a.charCodeAt(j++),e=a.charCodeAt(j++),g=b<<16|d<<8|e,b= -g>>18&63,d=g>>12&63,e=g>>6&63,g&=63,i[k++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g);while(jk?c++:i=127k?String.fromCharCode(k>>6|192,k&63|128):String.fromCharCode(k>>12|224,k>>6&63|128,k&63|128);i!==s&&(c>d&&(b+=a.substring(d,c)),b+=i,d=c=j+1)}c>d&&(b+=a.substring(d,a.length));return b};c.ub=function(){function a(){function a(b,d){var c,e=0;for(c=0;c=i;)f()} +function d(){var a,b,d="",c;if('"'===i)for(;f();){if('"'===i)return f(),d;if("\\"===i)if(f(),"u"===i){for(b=c=0;4>b;b+=1){a=parseInt(f(),16);if(!isFinite(a))break;c=16*c+a}d+=String.fromCharCode(c)}else if("string"===typeof g[i])d+=g[i];else break;else d+=i}j("Bad string")}function c(){var a;a="";"-"===i&&(a="-",f("-"));for(;"0"<=i&&"9">=i;)a+=i,f();if("."===i)for(a+=".";f()&&"0"<=i&&"9">=i;)a+=i;if("e"===i||"E"===i){a+=i;f();if("-"===i||"+"===i)a+=i,f();for(;"0"<=i&&"9">=i;)a+=i,f()}a=+a;if(isFinite(a))return a; +j("Bad number")}function f(a){a&&a!==i&&j("Expected '"+a+"' instead of '"+i+"'");i=h.charAt(k);k+=1;return i}function j(a){a=new SyntaxError(a);a.ge=k;a.text=h;throw a;}var k,i,g={'"':'"',"\\":"\\","/":"/",b:"\u0008",f:"\u000c",n:"\n",r:"\r",t:"\t"},h,q;q=function(){b();switch(i){case "{":var k;a:{var g,h={};if("{"===i){f("{");b();if("}"===i){f("}");k=h;break a}for(;i;){g=d();b();f(":");Object.hasOwnProperty.call(h,g)&&j('Duplicate key "'+g+'"');h[g]=q();b();if("}"===i){f("}");k=h;break a}f(","); +b()}}j("Bad object")}return k;case "[":a:{k=[];if("["===i){f("[");b();if("]"===i){f("]");g=k;break a}for(;i;){k.push(q());b();if("]"===i){f("]");g=k;break a}f(",");b()}}j("Bad array")}return g;case '"':return d();case "-":return c();default:return"0"<=i&&"9">=i?c():a()}};return function(a){h=a;k=0;i=" ";a=q();b();i&&j("Syntax error");return a}}();c.$a=function(a){var b,d,e,f,j=0,k=0,i="",i=[];if(!a)return a;a=c.be(a);do b=a.charCodeAt(j++),d=a.charCodeAt(j++),e=a.charCodeAt(j++),f=b<<16|d<<8|e,b= +f>>18&63,d=f>>12&63,e=f>>6&63,f&=63,i[k++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(b)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f);while(jk?c++:i=127k?String.fromCharCode(k>>6|192,k&63|128):String.fromCharCode(k>>12|224,k>>6&63|128,k&63|128);i!==s&&(c>d&&(b+=a.substring(d,c)),b+=i,d=c=j+1)}c>d&&(b+=a.substring(d,a.length));return b};c.ub=function(){function a(){function a(b,d){var c,e=0;for(c=0;cb&&delete a[d];c.la(a)&&delete this.props.__cmpns}});p.prototype.$d=function(){if(!this.Nb)this.F(c.info.ld()),this.Nb=m};p.prototype.yc=function(a){this.v(c.info.Kd(a))};p.prototype.tb=function(a){this.F({$initial_referrer:a||"$direct",$initial_referring_domain:c.info.kc(a)||"$direct"},"")};p.prototype.wd=function(){return c.Ha({$initial_referrer:this.props.$initial_referrer, $initial_referring_domain:this.props.$initial_referring_domain})};p.prototype.xc=function(a){this.Tb=this.gb=a.cookie_expiration;this.pc(a.disable_persistence);this.Md(a.cross_subdomain_cookie);this.Pd(a.secure_cookie)};p.prototype.pc=function(a){(this.disabled=a)?this.remove():this.save()};p.prototype.Md=function(a){if(a!==this.bb)this.bb=a,this.remove(),this.save()};p.prototype.ud=function(){return this.bb};p.prototype.Pd=function(a){if(a!==this.mc)this.mc=a?m:C,this.remove(),this.save()};p.prototype.B= -function(a,b){var d=this.Ta(a),e=b[a],g=this.O("$set"),j=this.O("$set_once"),f=this.O("$unset"),i=this.O("$add"),h=this.O("$union"),n=this.O("$remove",[]),q=this.O("$append",[]);"__mps"===d?(c.extend(g,e),this.G("$add",e),this.G("$union",e),this.G("$unset",e)):"__mpso"===d?(c.a(e,function(a,b){b in j||(j[b]=a)}),this.G("$unset",e)):"__mpus"===d?c.a(e,function(a){c.a([g,j,i,h],function(b){a in b&&delete b[a]});c.a(q,function(b){a in b&&delete b[a]});f[a]=m}):"__mpa"===d?(c.a(e,function(a,b){b in g? -g[b]+=a:(b in i||(i[b]=0),i[b]+=a)},this),this.G("$unset",e)):"__mpu"===d?(c.a(e,function(a,b){c.isArray(a)&&(b in h||(h[b]=[]),h[b]=h[b].concat(a))}),this.G("$unset",e)):"__mpr"===d?(n.push(e),this.G("$append",e)):"__mpap"===d&&(q.push(e),this.G("$unset",e));r.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):");r.log(b);this.save()};p.prototype.G=function(a,b){var d=this.ya(a);c.e(d)||(c.a(b,function(b,g){"$append"===a||"$remove"===a?c.a(d,function(a){a[g]===b&&delete a[g]}):delete d[g]}, -this),this.save())};p.prototype.Ta=function(a){if("$set"===a)return"__mps";if("$set_once"===a)return"__mpso";if("$unset"===a)return"__mpus";if("$add"===a)return"__mpa";if("$append"===a)return"__mpap";if("$remove"===a)return"__mpr";if("$union"===a)return"__mpu";r.error("Invalid queue:",a)};p.prototype.ya=function(a){return this.props[this.Ta(a)]};p.prototype.O=function(a,b){var d=this.Ta(a),b=c.e(b)?{}:b;return this.props[d]||(this.props[d]=b)};p.prototype.Nd=function(a){var b=this.props.__timers|| -{};b[a]=(new Date).getTime();this.props.__timers=b;this.save()};p.prototype.Fd=function(a){var b=(this.props.__timers||{})[a];c.e(b)||(delete this.props.__timers[a],this.save());return b};var h;c.extend(n.prototype,z);f.prototype.Y=function(a,b,d){if(c.e(d))r.error("You must name your new library: init(token, config, name)");else if("mixpanel"===d)r.error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");else return a=Q(a,b,d),w[d]=a,a.za(),a};f.prototype.ea= -function(a,b,d){this.__loaded=m;this.config={};this.oc(c.extend({},xa,b,{name:d,token:a,callback_fn:("mixpanel"===d?d:"mixpanel."+d)+"._jsc"}));this._jsc=G();this.Qa=[];this.Ra=[];this.Pa=[];this.V={disable_all_events:C,identify_called:C};this.persistence=this.cookie=new p(this.config);this.Pc();a=c.ub();this.Q()||this.F({distinct_id:a,$device_id:a},"")};f.prototype.za=function(){this.c("loaded")(this);this.c("track_pageview")&&this.uc()};f.prototype.Kc=function(){c.a(this.Qa,function(a){this.Xa.apply(this, -a)},this);this.ka()||c.a(this.Ra,function(a){this.i.apply(this,a)},this);delete this.Qa;delete this.Ra};f.prototype.Xa=function(a,b){if(this.c("img"))return r.error("You can't use DOM tracking functions with img = true."),C;if(!ea)return this.Qa.push([a,b]),C;var c=(new a).Y(this);return c.p.apply(c,b)};f.prototype.fa=function(a,b){if(c.e(a))return s;if(Z)return function(c){a(c,b)};var d=this._jsc,e=""+Math.floor(1E8*Math.random()),g=this.c("callback_fn")+"["+e+"]";d[e]=function(c){delete d[e];a(c, -b)};return g};f.prototype.i=function(a,b,d){if(fa)this.Ra.push(arguments);else{var e=this.c("verbose");b.verbose&&(e=m);this.c("test")&&(b.test=1);e&&(b.verbose=1);this.c("img")&&(b.img=1);if(!Z)if(d)b.callback=d;else if(e||this.c("test"))b.callback="(function(){})";b.ip=this.c("ip")?1:0;b._=(new Date).getTime().toString();a+="?"+c.Dc(b);if("img"in b){var g=o.createElement("img");g.src=a;o.body.appendChild(g)}else if(Z)try{var j=new XMLHttpRequest;j.open("GET",a,m);c.a(this.c("xhr_headers"),function(a, -b){j.setRequestHeader(b,a)});j.withCredentials=m;j.onreadystatechange=function(){if(4===j.readyState)if(200===j.status){if(d)if(e){var a;try{a=c.ua(j.responseText)}catch(b){r.error(b);return}d(a)}else d(Number(j.responseText))}else a="Bad HTTP status: "+j.status+" "+j.statusText,r.error(a),d&&(e?d({status:0,error:a}):d(0))};j.send(s)}catch(f){r.error(f)}else{g=o.createElement("script");g.type="text/javascript";g.async=m;g.defer=m;g.src=a;var i=o.getElementsByTagName("script")[0];i.parentNode.insertBefore(g, -i)}}};f.prototype.Sa=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=[],g=[],f=[];c.a(a,function(a){a&&(d=a[0],c.isArray(d)?f.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]?f.push(a):g.push(a))},this);b(e,this);b(g,this);b(f,this)};f.prototype.push=function(a){this.Sa([a])}; -f.prototype.disable=function(a){"undefined"===typeof a?this.V.nd=m:this.Pa=this.Pa.concat(a)};f.prototype.p=J(function(a,b,d){"function"!==typeof d&&(d=G());if(c.e(a))r.error("No event name provided to mixpanel.track");else if(this.zb(a))d(0);else{b=b||{};b.token=this.c("token");var e=this.persistence.Fd(a);c.e(e)||(b.$duration=parseFloat((((new Date).getTime()-e)/1E3).toFixed(3)));this.persistence.yc(o.referrer);this.c("store_google")&&this.persistence.$d();this.c("save_referrer")&&this.persistence.tb(o.referrer); -b=c.extend({},c.info.oa(),this.persistence.oa(),b);e=this.c("property_blacklist");c.isArray(e)?c.a(e,function(a){delete b[a]}):r.error("Invalid value for property_blacklist config: "+e);a=c.truncate({event:a,properties:b},255);e=c.aa(a);e=c.$a(e);r.log("MIXPANEL REQUEST:");r.log(a);this.i(this.c("api_host")+"/track/",{data:e},this.fa(d,a));return a}});f.prototype.Od=J(function(a,b,d){c.isArray(b)||(b=[b]);var e={};e[a]=b;this.v(e);return this.people.set(a,b,d)});f.prototype.fd=J(function(a,b,c){var e= -this.D(a);if(e===l){var g={};g[a]=[b];this.v(g)}else-1===e.indexOf(b)&&(e.push(b),this.v(g));return this.people.qa(a,b,c)});f.prototype.Gd=J(function(a,b,c){var e=this.D(a);if(e!==l){var g=e.indexOf(b);-1");this.md=c.P(a.cta)||"Close";this.ma=c.P(a.type)||"takeover";this.style=c.P(a.style)||"light";this.title=c.P(a.title)||"";this.sa=h.Fc;this.$=h.Ec;this.ia=a.cta_url||s;this.kb=a.image_url||s;this.R=a.thumb_image_url||s;this.La=a.video_url||s;this.Ba=m;if(!this.ia)this.ia="#dismiss",this.Ba=C;this.u="mini"=== -this.ma;if(!this.u)this.ma="takeover";this.Cd=!this.u?h.ba:h.Ma;this.Hb();this.Ea=this.Tc();this.Wc()};h=f.Gc;h.S=200;h.z="mixpanel-notification";h.ta=0.6;h.K=25;h.va=200;h.ba=388;h.Ma=420;h.A=85;h.Na=5;h.N=60;h.Oa=Math.round(h.N/2);h.Fc=595;h.Ec=334;h.prototype.show=function(){var a=this;this.Hb();this.q?(this.Vc(),this.Uc(),this.$c(this.Ic)):setTimeout(function(){a.show()},300)};h.prototype.cb=c.m(function(){this.cc||this.Eb({invisible:m});var a=this.Qd?this.k("video"):this.W();if(this.zc)this.bd("bg", -"visible"),this.T(a,"exiting"),setTimeout(this.Gb,h.S);else{var b,c,e;this.u?(b="right",c=20,e=-100):(b="top",c=h.K,e=h.va+h.K);this.wa([{s:this.k("bg"),o:"opacity",start:h.ta,l:0},{s:a,o:"opacity",start:1,l:0},{s:a,o:b,start:c,l:e}],h.S,this.Gb)}});h.prototype.T=c.m(function(a,b){b=h.z+"-"+b;"string"===typeof a&&(a=this.k(a));a.className?~(" "+a.className+" ").indexOf(" "+b+" ")||(a.className+=" "+b):a.className=b});h.prototype.bd=c.m(function(a,b){b=h.z+"-"+b;"string"===typeof a&&(a=this.k(a)); -if(a.className)a.className=(" "+a.className+" ").replace(" "+b+" ","").replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")});h.prototype.wa=c.m(function(a,b,c,e){var g=this,f=C,h,i;h=1*new Date;var n,e=e||h;n=h-e;for(h=0;h=i.start?1:-1;i.J=i.start+(i.l-i.start)*n/b;if("opacity"!==i.o)i.J=Math.round(i.J);if(0=i.l||0>o&&i.J<=i.l)i.J=i.l}}if(f){for(h=0;h'):this.Xb="",this.R?(a.push(this.R),this.sc='
'):this.sc="");return a};h.prototype.Uc=function(){var a="",b="",c="";this.na= -o.createElement("div");this.na.id=h.z+"-wrapper";if(this.u)a='
'+this.body+'
';else{var a=this.Ba||this.Z?"":'
',e=this.Z?'
':"";this.U("ie",7)&&(e=a="");a='
'+this.sc+ -'
'+this.Xb+'
'+this.title+'
'+this.body+'
'+a+''+this.md+""+e+"
"}this.Bc?(b="//www.youtube.com/embed/"+this.Bc+"?wmode=transparent&showinfo=0&modestbranding=0&rel=0&autoplay=1&loop=0&vq=hd1080", -this.Cc&&(b+="&enablejsapi=1&html5=1&controls=0",c='
')):this.Ac&&(b="//player.vimeo.com/video/"+this.Ac+"?autoplay=1&title=0&byline=0&portrait=0");if(this.Z)this.de='',c='
'+c+"
";b=c+a;this.hb&&(b=(this.u?a:"")+'
'+(this.u?c:b)+"
");this.na.innerHTML=('
'+b+"
").replace(/class=\"/g,'class="'+ -h.z+"-").replace(/id=\"/g,'id="'+h.z+"-")};h.prototype.Vc=function(){this.j="dark"===this.style?{ab:"#1d1f25",ga:"#282b32",Aa:"#3a4147",Kb:"#4a5157",jd:"#32353c",Ob:"0.4",nb:"#2a3137",Ja:"#fff",sb:"#9498a3",rc:"#464851",Ia:"#ddd"}:{ab:"#fff",ga:"#e7eaee",Aa:"#eceff3",Kb:"#f5f5f5",jd:"#e4ecf2",Ob:"1.0",nb:"#fafafa",Ja:"#5c6578",sb:"#8b949b",rc:"#ced9e6",Ia:"#7c8598"};var a="0px 0px 35px 0px rgba(45, 49, 56, 0.7)",b=a,d=a,e=h.N+2*h.Na,g=h.S/1E3+"s";this.u&&(a="none");var f={};f["@media only screen and (max-width: "+ -(h.Ma+20-1)+"px)"]={"#overlay":{display:"none"}};a={".flipped":{transform:"rotateY(180deg)"},"#overlay":{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",overflow:"auto","text-align":"center","z-index":"10000","font-family":'"Helvetica", "Arial", sans-serif',"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"#overlay.mini":{height:"0",overflow:"visible"},"#overlay a":{width:"initial",padding:"0","text-decoration":"none","text-transform":"none",color:"inherit"}, -"#bgwrapper":{position:"relative",width:"100%",height:"100%"},"#bg":{position:"fixed",top:"0",left:"0",width:"100%",height:"100%","min-width":4*this.pd+"px","min-height":4*this.od+"px","background-color":"black",opacity:"0.0","-ms-filter":"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)",filter:"alpha(opacity=60)",transition:"opacity "+g},"#bg.visible":{opacity:h.ta},".mini #bg":{width:"0",height:"0","min-width":"0"},"#flipcontainer":{perspective:"1000px",position:"absolute",width:"100%"},"#flipper":{position:"relative", -"transform-style":"preserve-3d",transition:"0.3s"},"#takeover":{position:"absolute",left:"50%",width:h.ba+"px","margin-left":Math.round(-h.ba/2)+"px","backface-visibility":"hidden",transform:"rotateY(0deg)",opacity:"0.0",top:h.va+"px",transition:"opacity "+g+", top "+g},"#takeover.visible":{opacity:"1.0",top:h.K+"px"},"#takeover.exiting":{opacity:"0.0",top:h.va+"px"},"#thumbspacer":{height:h.Oa+"px"},"#thumbborder-wrapper":{position:"absolute",top:-h.Na+"px",left:h.ba/2-h.Oa-h.Na+"px",width:e+"px", -height:e/2+"px",overflow:"hidden"},"#thumbborder":{position:"absolute",width:e+"px",height:e+"px","border-radius":e+"px","background-color":this.j.ga,opacity:"0.5"},"#thumbnail":{position:"absolute",top:"0px",left:h.ba/2-h.Oa+"px",width:h.N+"px",height:h.N+"px",overflow:"hidden","z-index":"100","border-radius":h.N+"px"},"#mini":{position:"absolute",right:"20px",top:h.K+"px",width:this.Cd+"px",height:2*h.A+"px","margin-top":20-h.A+"px","backface-visibility":"hidden",opacity:"0.0",transform:"rotateX(90deg)", -transition:"opacity 0.3s, transform 0.3s, right 0.3s"},"#mini.visible":{opacity:"1.0",transform:"rotateX(0deg)"},"#mini.exiting":{opacity:"0.0",right:"-150px"},"#mainbox":{"border-radius":"4px","box-shadow":a,"text-align":"center","background-color":this.j.ab,"font-size":"14px",color:this.j.sb},"#mini #mainbox":{height:h.A+"px","margin-top":h.A+"px","border-radius":"3px",transition:"background-color "+g},"#mini-border":{height:h.A+6+"px",width:h.Ma+6+"px",position:"absolute",top:"-3px",left:"-3px", -"margin-top":h.A+"px","border-radius":"6px",opacity:"0.25","background-color":"#fff","z-index":"-1","box-shadow":d},"#mini-icon":{position:"relative",display:"inline-block",width:"75px",height:h.A+"px","border-radius":"3px 0 0 3px","background-color":this.j.ga,background:"linear-gradient(135deg, "+this.j.Kb+" 0%, "+this.j.ga+" 100%)",transition:"background-color "+g},"#mini:hover #mini-icon":{"background-color":this.j.nb},"#mini:hover #mainbox":{"background-color":this.j.nb},"#mini-icon-img":{position:"absolute", -"background-image":"url("+this.R+")",width:"48px",height:"48px",top:"20px",left:"12px"},"#content":{padding:"30px 20px 0px 20px"},"#mini-content":{"text-align":"left",height:h.A+"px",cursor:"pointer"},"#img":{width:"328px","margin-top":"30px","border-radius":"5px"},"#title":{"max-height":"600px",overflow:"hidden","word-wrap":"break-word",padding:"25px 0px 20px 0px","font-size":"19px","font-weight":"bold",color:this.j.Ja},"#body":{"max-height":"600px","margin-bottom":"25px",overflow:"hidden","word-wrap":"break-word", -"line-height":"21px","font-size":"15px","font-weight":"normal","text-align":"left"},"#mini #body":{display:"inline-block","max-width":"250px",margin:"0 0 0 30px",height:h.A+"px","font-size":"16px","letter-spacing":"0.8px",color:this.j.Ja},"#mini #body-text":{display:"table",height:h.A+"px"},"#mini #body-text div":{display:"table-cell","vertical-align":"middle"},"#tagline":{"margin-bottom":"15px","font-size":"10px","font-weight":"600","letter-spacing":"0.8px",color:"#ccd7e0","text-align":"left"},"#tagline a":{color:this.j.rc, -transition:"color "+g},"#tagline a:hover":{color:this.j.Ia},"#cancel":{position:"absolute",right:"0",width:"8px",height:"8px",padding:"10px","border-radius":"20px",margin:"12px 12px 0 0","box-sizing":"content-box",cursor:"pointer",transition:"background-color "+g},"#mini #cancel":{margin:"7px 7px 0 0"},"#cancel-icon":{width:"8px",height:"8px",overflow:"hidden","background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/cancel-x.png)",opacity:this.j.Ob},"#cancel:hover":{"background-color":this.j.Aa}, -"#button":{display:"block",height:"60px","line-height":"60px","text-align":"center","background-color":this.j.ga,"border-radius":"0 0 4px 4px",overflow:"hidden",cursor:"pointer",transition:"background-color "+g},"#button-close":{display:"inline-block",width:"9px",height:"60px","margin-right":"8px","vertical-align":"top","background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/close-x-"+this.style+".png)","background-repeat":"no-repeat","background-position":"0px 25px"},"#button-play":{display:"inline-block", -width:"30px",height:"60px","margin-left":"15px","background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/play-"+this.style+"-small.png)","background-repeat":"no-repeat","background-position":"0px 15px"},"a#button-link":{display:"inline-block","vertical-align":"top","text-align":"center","font-size":"17px","font-weight":"bold",overflow:"hidden","word-wrap":"break-word",color:this.j.Ja,transition:"color "+g},"#button:hover":{"background-color":this.j.Aa,color:this.j.Ia},"#button:hover a":{color:this.j.Ia}, -"#video-noflip":{position:"relative",top:2*-this.$+"px"},"#video-flip":{"backface-visibility":"hidden",transform:"rotateY(180deg)"},"#video":{position:"absolute",width:this.sa-1+"px",height:this.$+"px",top:h.K+"px","margin-top":"100px",left:"50%","margin-left":Math.round(-this.sa/2)+"px",overflow:"hidden","border-radius":"5px","box-shadow":b,transform:"translateZ(1px)",transition:"opacity "+g+", top "+g},"#video.exiting":{opacity:"0.0",top:this.$+"px"},"#video-holder":{position:"absolute",width:this.sa- -1+"px",height:this.$+"px",overflow:"hidden","border-radius":"5px"},"#video-frame":{"margin-left":"-1px",width:this.sa+"px"},"#video-controls":{opacity:"0",transition:"opacity 0.5s"},"#video:hover #video-controls":{opacity:"1.0"},"#video .video-progress-el":{position:"absolute",bottom:"0",height:"25px","border-radius":"0 0 0 5px"},"#video-progress":{width:"90%"},"#video-progress-total":{width:"100%","background-color":this.j.ab,opacity:"0.7"},"#video-elapsed":{width:"0","background-color":"#6cb6f5", -opacity:"0.9"},"#video #video-time":{width:"10%",right:"0","font-size":"11px","line-height":"25px",color:this.j.sb,"background-color":"#666","border-radius":"0 0 5px 0"}};this.U("ie",8)&&c.extend(a,{"* html #overlay":{position:"absolute"},"* html #bg":{position:"absolute"},"html, body":{height:"100%"}});this.U("ie",7)&&c.extend(a,{"#mini #body":{display:"inline",zoom:"1",border:"1px solid "+this.j.Aa},"#mini #body-text":{padding:"20px"},"#mini #mini-icon":{display:"none"}});var b="backface-visibility,border-radius,box-shadow,opacity,perspective,transform,transform-style,transition".split(","), -d=["khtml","moz","ms","o","webkit"],k;for(k in a)for(e=0;e(w.__SV||0)?r.X("Version mismatch; please ensure you're using the latest version of the Mixpanel code snippet."):(c.a(w._i,function(a){a&&c.isArray(a)&&(D[a[a.length-1]]=Q.apply(this,a))}),ma(),w.init(),c.a(D,function(a){a.za()}),la())})()})(); +function(a,b){var d=this.Ta(a),e=b[a],f=this.O("$set"),j=this.O("$set_once"),g=this.O("$unset"),i=this.O("$add"),h=this.O("$union"),n=this.O("$remove",[]),q=this.O("$append",[]);"__mps"===d?(c.extend(f,e),this.G("$add",e),this.G("$union",e),this.G("$unset",e)):"__mpso"===d?(c.a(e,function(a,b){b in j||(j[b]=a)}),this.G("$unset",e)):"__mpus"===d?c.a(e,function(a){c.a([f,j,i,h],function(b){a in b&&delete b[a]});c.a(q,function(b){a in b&&delete b[a]});g[a]=m}):"__mpa"===d?(c.a(e,function(a,b){b in f? +f[b]+=a:(b in i||(i[b]=0),i[b]+=a)},this),this.G("$unset",e)):"__mpu"===d?(c.a(e,function(a,b){c.isArray(a)&&(b in h||(h[b]=[]),h[b]=h[b].concat(a))}),this.G("$unset",e)):"__mpr"===d?(n.push(e),this.G("$append",e)):"__mpap"===d&&(q.push(e),this.G("$unset",e));r.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):");r.log(b);this.save()};p.prototype.G=function(a,b){var d=this.ya(a);c.e(d)||(c.a(b,function(b,f){"$append"===a||"$remove"===a?c.a(d,function(a){a[f]===b&&delete a[f]}):delete d[f]}, +this),this.save())};p.prototype.Ta=function(a){if("$set"===a)return"__mps";if("$set_once"===a)return"__mpso";if("$unset"===a)return"__mpus";if("$add"===a)return"__mpa";if("$append"===a)return"__mpap";if("$remove"===a)return"__mpr";if("$union"===a)return"__mpu";r.error("Invalid queue:",a)};p.prototype.ya=function(a){return this.props[this.Ta(a)]};p.prototype.O=function(a,b){var d=this.Ta(a),b=c.e(b)?{}:b;return this.props[d]||(this.props[d]=b)};p.prototype.Nd=function(a,b){var c=this.props.__timers|| +{};c[a]=(new Date).getTime();this.props.__timers=c;if(b&&"function"===typeof b)c=this.event_timer_callbacks||{},c[a]=b,this.event_timer_callbacks=c;this.save()};p.prototype.Fd=function(a){var b=(this.props.__timers||{})[a];c.e(b)||(delete this.props.__timers[a],this.save());a=(this.event_timer_callbacks||{})[a];c.e(a)||delete this.event_timer_callbacks;return[b,a]};var h;c.extend(n.prototype,z);g.prototype.Y=function(a,b,d){if(c.e(d))r.error("You must name your new library: init(token, config, name)"); +else if("mixpanel"===d)r.error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");else return a=Q(a,b,d),w[d]=a,a.za(),a};g.prototype.ea=function(a,b,d){this.__loaded=m;this.config={};this.oc(c.extend({},xa,b,{name:d,token:a,callback_fn:("mixpanel"===d?d:"mixpanel."+d)+"._jsc"}));this._jsc=G();this.Qa=[];this.Ra=[];this.Pa=[];this.V={disable_all_events:C,identify_called:C};this.persistence=this.cookie=new p(this.config);this.Pc();a=c.ub();this.Q()||this.F({distinct_id:a, +$device_id:a},"")};g.prototype.za=function(){this.c("loaded")(this);this.c("track_pageview")&&this.uc()};g.prototype.Kc=function(){c.a(this.Qa,function(a){this.Xa.apply(this,a)},this);this.ka()||c.a(this.Ra,function(a){this.i.apply(this,a)},this);delete this.Qa;delete this.Ra};g.prototype.Xa=function(a,b){if(this.c("img"))return r.error("You can't use DOM tracking functions with img = true."),C;if(!ea)return this.Qa.push([a,b]),C;var c=(new a).Y(this);return c.p.apply(c,b)};g.prototype.fa=function(a, +b){if(c.e(a))return s;if(Z)return function(c){a(c,b)};var d=this._jsc,e=""+Math.floor(1E8*Math.random()),f=this.c("callback_fn")+"["+e+"]";d[e]=function(c){delete d[e];a(c,b)};return f};g.prototype.i=function(a,b,d){if(fa)this.Ra.push(arguments);else{var e=this.c("verbose");b.verbose&&(e=m);this.c("test")&&(b.test=1);e&&(b.verbose=1);this.c("img")&&(b.img=1);if(!Z)if(d)b.callback=d;else if(e||this.c("test"))b.callback="(function(){})";b.ip=this.c("ip")?1:0;b._=(new Date).getTime().toString();a+="?"+ +c.Dc(b);if("img"in b){var f=o.createElement("img");f.src=a;o.body.appendChild(f)}else if(Z)try{var j=new XMLHttpRequest;j.open("GET",a,m);c.a(this.c("xhr_headers"),function(a,b){j.setRequestHeader(b,a)});j.withCredentials=m;j.onreadystatechange=function(){if(4===j.readyState)if(200===j.status){if(d)if(e){var a;try{a=c.ua(j.responseText)}catch(b){r.error(b);return}d(a)}else d(Number(j.responseText))}else a="Bad HTTP status: "+j.status+" "+j.statusText,r.error(a),d&&(e?d({status:0,error:a}):d(0))}; +j.send(s)}catch(g){r.error(g)}else{f=o.createElement("script");f.type="text/javascript";f.async=m;f.defer=m;f.src=a;var i=o.getElementsByTagName("script")[0];i.parentNode.insertBefore(f,i)}}};g.prototype.Sa=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=[],f=[],j=[];c.a(a,function(a){a&&(d=a[0],c.isArray(d)?j.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]?j.push(a):f.push(a))},this);b(e,this);b(f,this);b(j,this)};g.prototype.push=function(a){this.Sa([a])};g.prototype.disable=function(a){"undefined"===typeof a?this.V.nd=m:this.Pa=this.Pa.concat(a)};g.prototype.p=J(function(a,b,d){"function"!==typeof d&&(d=G());if(c.e(a))r.error("No event name provided to mixpanel.track");else if(this.zb(a))d(0);else{b=b||{};b.token=this.c("token");var e=this.persistence.Fd(a),f=e[0],e=e[1]; +if(!c.e(f))f=parseFloat((((new Date).getTime()-f)/1E3).toFixed(3)),c.e(e)||(f=e(f)),b.$duration=f;this.persistence.yc(o.referrer);this.c("store_google")&&this.persistence.$d();this.c("save_referrer")&&this.persistence.tb(o.referrer);b=c.extend({},c.info.oa(),this.persistence.oa(),b);f=this.c("property_blacklist");c.isArray(f)?c.a(f,function(a){delete b[a]}):r.error("Invalid value for property_blacklist config: "+f);a=c.truncate({event:a,properties:b},255);f=c.aa(a);f=c.$a(f);r.log("MIXPANEL REQUEST:"); +r.log(a);this.i(this.c("api_host")+"/track/",{data:f},this.fa(d,a));return a}});g.prototype.Od=J(function(a,b,d){c.isArray(b)||(b=[b]);var e={};e[a]=b;this.v(e);return this.people.set(a,b,d)});g.prototype.fd=J(function(a,b,c){var e=this.D(a);if(e===l){var f={};f[a]=[b];this.v(f)}else-1===e.indexOf(b)&&(e.push(b),this.v(f));return this.people.qa(a,b,c)});g.prototype.Gd=J(function(a,b,c){var e=this.D(a);if(e!==l){var f=e.indexOf(b);-1");this.md=c.P(a.cta)||"Close";this.ma=c.P(a.type)||"takeover"; +this.style=c.P(a.style)||"light";this.title=c.P(a.title)||"";this.sa=h.Fc;this.$=h.Ec;this.ia=a.cta_url||s;this.kb=a.image_url||s;this.R=a.thumb_image_url||s;this.La=a.video_url||s;this.Ba=m;if(!this.ia)this.ia="#dismiss",this.Ba=C;this.u="mini"===this.ma;if(!this.u)this.ma="takeover";this.Cd=!this.u?h.ba:h.Ma;this.Hb();this.Ea=this.Tc();this.Wc()};h=g.Gc;h.S=200;h.z="mixpanel-notification";h.ta=0.6;h.K=25;h.va=200;h.ba=388;h.Ma=420;h.A=85;h.Na=5;h.N=60;h.Oa=Math.round(h.N/2);h.Fc=595;h.Ec=334;h.prototype.show= +function(){var a=this;this.Hb();this.q?(this.Vc(),this.Uc(),this.$c(this.Ic)):setTimeout(function(){a.show()},300)};h.prototype.cb=c.m(function(){this.cc||this.Eb({invisible:m});var a=this.Qd?this.k("video"):this.W();if(this.zc)this.bd("bg","visible"),this.T(a,"exiting"),setTimeout(this.Gb,h.S);else{var b,c,e;this.u?(b="right",c=20,e=-100):(b="top",c=h.K,e=h.va+h.K);this.wa([{s:this.k("bg"),o:"opacity",start:h.ta,l:0},{s:a,o:"opacity",start:1,l:0},{s:a,o:b,start:c,l:e}],h.S,this.Gb)}});h.prototype.T= +c.m(function(a,b){b=h.z+"-"+b;"string"===typeof a&&(a=this.k(a));a.className?~(" "+a.className+" ").indexOf(" "+b+" ")||(a.className+=" "+b):a.className=b});h.prototype.bd=c.m(function(a,b){b=h.z+"-"+b;"string"===typeof a&&(a=this.k(a));if(a.className)a.className=(" "+a.className+" ").replace(" "+b+" ","").replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")});h.prototype.wa=c.m(function(a,b,c,e){var f=this,g=C,h,i;h=1*new Date;var n,e=e||h;n=h-e;for(h=0;h=i.start?1:-1;i.J=i.start+(i.l-i.start)*n/b;if("opacity"!==i.o)i.J=Math.round(i.J);if(0=i.l||0>o&&i.J<=i.l)i.J=i.l}}if(g){for(h=0;h'):this.Xb="",this.R?(a.push(this.R),this.sc= +'
'):this.sc="");return a};h.prototype.Uc=function(){var a="",b="",c="";this.na=o.createElement("div");this.na.id=h.z+"-wrapper";if(this.u)a='
'+ +this.body+'
';else{var a=this.Ba||this.Z?"":'
',e=this.Z?'
':"";this.U("ie",7)&&(e=a="");a='
'+this.sc+'
'+this.Xb+'
'+this.title+'
'+this.body+'
'+ +a+''+this.md+""+e+"
"}this.Bc?(b="//www.youtube.com/embed/"+this.Bc+"?wmode=transparent&showinfo=0&modestbranding=0&rel=0&autoplay=1&loop=0&vq=hd1080",this.Cc&&(b+="&enablejsapi=1&html5=1&controls=0",c='
')): +this.Ac&&(b="//player.vimeo.com/video/"+this.Ac+"?autoplay=1&title=0&byline=0&portrait=0");if(this.Z)this.de='',c='
'+c+"
";b=c+a;this.hb&&(b=(this.u?a:"")+'
'+(this.u?c:b)+"
"); +this.na.innerHTML=('
'+b+"
").replace(/class=\"/g,'class="'+h.z+"-").replace(/id=\"/g,'id="'+h.z+"-")};h.prototype.Vc=function(){this.j="dark"===this.style?{ab:"#1d1f25",ga:"#282b32",Aa:"#3a4147",Kb:"#4a5157",jd:"#32353c",Ob:"0.4",nb:"#2a3137",Ja:"#fff",sb:"#9498a3",rc:"#464851",Ia:"#ddd"}:{ab:"#fff",ga:"#e7eaee",Aa:"#eceff3",Kb:"#f5f5f5",jd:"#e4ecf2",Ob:"1.0",nb:"#fafafa", +Ja:"#5c6578",sb:"#8b949b",rc:"#ced9e6",Ia:"#7c8598"};var a="0px 0px 35px 0px rgba(45, 49, 56, 0.7)",b=a,d=a,e=h.N+2*h.Na,f=h.S/1E3+"s";this.u&&(a="none");var g={};g["@media only screen and (max-width: "+(h.Ma+20-1)+"px)"]={"#overlay":{display:"none"}};a={".flipped":{transform:"rotateY(180deg)"},"#overlay":{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",overflow:"auto","text-align":"center","z-index":"10000","font-family":'"Helvetica", "Arial", sans-serif',"-webkit-font-smoothing":"antialiased", +"-moz-osx-font-smoothing":"grayscale"},"#overlay.mini":{height:"0",overflow:"visible"},"#overlay a":{width:"initial",padding:"0","text-decoration":"none","text-transform":"none",color:"inherit"},"#bgwrapper":{position:"relative",width:"100%",height:"100%"},"#bg":{position:"fixed",top:"0",left:"0",width:"100%",height:"100%","min-width":4*this.pd+"px","min-height":4*this.od+"px","background-color":"black",opacity:"0.0","-ms-filter":"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)",filter:"alpha(opacity=60)", +transition:"opacity "+f},"#bg.visible":{opacity:h.ta},".mini #bg":{width:"0",height:"0","min-width":"0"},"#flipcontainer":{perspective:"1000px",position:"absolute",width:"100%"},"#flipper":{position:"relative","transform-style":"preserve-3d",transition:"0.3s"},"#takeover":{position:"absolute",left:"50%",width:h.ba+"px","margin-left":Math.round(-h.ba/2)+"px","backface-visibility":"hidden",transform:"rotateY(0deg)",opacity:"0.0",top:h.va+"px",transition:"opacity "+f+", top "+f},"#takeover.visible":{opacity:"1.0", +top:h.K+"px"},"#takeover.exiting":{opacity:"0.0",top:h.va+"px"},"#thumbspacer":{height:h.Oa+"px"},"#thumbborder-wrapper":{position:"absolute",top:-h.Na+"px",left:h.ba/2-h.Oa-h.Na+"px",width:e+"px",height:e/2+"px",overflow:"hidden"},"#thumbborder":{position:"absolute",width:e+"px",height:e+"px","border-radius":e+"px","background-color":this.j.ga,opacity:"0.5"},"#thumbnail":{position:"absolute",top:"0px",left:h.ba/2-h.Oa+"px",width:h.N+"px",height:h.N+"px",overflow:"hidden","z-index":"100","border-radius":h.N+ +"px"},"#mini":{position:"absolute",right:"20px",top:h.K+"px",width:this.Cd+"px",height:2*h.A+"px","margin-top":20-h.A+"px","backface-visibility":"hidden",opacity:"0.0",transform:"rotateX(90deg)",transition:"opacity 0.3s, transform 0.3s, right 0.3s"},"#mini.visible":{opacity:"1.0",transform:"rotateX(0deg)"},"#mini.exiting":{opacity:"0.0",right:"-150px"},"#mainbox":{"border-radius":"4px","box-shadow":a,"text-align":"center","background-color":this.j.ab,"font-size":"14px",color:this.j.sb},"#mini #mainbox":{height:h.A+ +"px","margin-top":h.A+"px","border-radius":"3px",transition:"background-color "+f},"#mini-border":{height:h.A+6+"px",width:h.Ma+6+"px",position:"absolute",top:"-3px",left:"-3px","margin-top":h.A+"px","border-radius":"6px",opacity:"0.25","background-color":"#fff","z-index":"-1","box-shadow":d},"#mini-icon":{position:"relative",display:"inline-block",width:"75px",height:h.A+"px","border-radius":"3px 0 0 3px","background-color":this.j.ga,background:"linear-gradient(135deg, "+this.j.Kb+" 0%, "+this.j.ga+ +" 100%)",transition:"background-color "+f},"#mini:hover #mini-icon":{"background-color":this.j.nb},"#mini:hover #mainbox":{"background-color":this.j.nb},"#mini-icon-img":{position:"absolute","background-image":"url("+this.R+")",width:"48px",height:"48px",top:"20px",left:"12px"},"#content":{padding:"30px 20px 0px 20px"},"#mini-content":{"text-align":"left",height:h.A+"px",cursor:"pointer"},"#img":{width:"328px","margin-top":"30px","border-radius":"5px"},"#title":{"max-height":"600px",overflow:"hidden", +"word-wrap":"break-word",padding:"25px 0px 20px 0px","font-size":"19px","font-weight":"bold",color:this.j.Ja},"#body":{"max-height":"600px","margin-bottom":"25px",overflow:"hidden","word-wrap":"break-word","line-height":"21px","font-size":"15px","font-weight":"normal","text-align":"left"},"#mini #body":{display:"inline-block","max-width":"250px",margin:"0 0 0 30px",height:h.A+"px","font-size":"16px","letter-spacing":"0.8px",color:this.j.Ja},"#mini #body-text":{display:"table",height:h.A+"px"},"#mini #body-text div":{display:"table-cell", +"vertical-align":"middle"},"#tagline":{"margin-bottom":"15px","font-size":"10px","font-weight":"600","letter-spacing":"0.8px",color:"#ccd7e0","text-align":"left"},"#tagline a":{color:this.j.rc,transition:"color "+f},"#tagline a:hover":{color:this.j.Ia},"#cancel":{position:"absolute",right:"0",width:"8px",height:"8px",padding:"10px","border-radius":"20px",margin:"12px 12px 0 0","box-sizing":"content-box",cursor:"pointer",transition:"background-color "+f},"#mini #cancel":{margin:"7px 7px 0 0"},"#cancel-icon":{width:"8px", +height:"8px",overflow:"hidden","background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/cancel-x.png)",opacity:this.j.Ob},"#cancel:hover":{"background-color":this.j.Aa},"#button":{display:"block",height:"60px","line-height":"60px","text-align":"center","background-color":this.j.ga,"border-radius":"0 0 4px 4px",overflow:"hidden",cursor:"pointer",transition:"background-color "+f},"#button-close":{display:"inline-block",width:"9px",height:"60px","margin-right":"8px","vertical-align":"top", +"background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/close-x-"+this.style+".png)","background-repeat":"no-repeat","background-position":"0px 25px"},"#button-play":{display:"inline-block",width:"30px",height:"60px","margin-left":"15px","background-image":"url(//cdn.mxpnl.com/site_media/images/icons/notifications/play-"+this.style+"-small.png)","background-repeat":"no-repeat","background-position":"0px 15px"},"a#button-link":{display:"inline-block","vertical-align":"top","text-align":"center", +"font-size":"17px","font-weight":"bold",overflow:"hidden","word-wrap":"break-word",color:this.j.Ja,transition:"color "+f},"#button:hover":{"background-color":this.j.Aa,color:this.j.Ia},"#button:hover a":{color:this.j.Ia},"#video-noflip":{position:"relative",top:2*-this.$+"px"},"#video-flip":{"backface-visibility":"hidden",transform:"rotateY(180deg)"},"#video":{position:"absolute",width:this.sa-1+"px",height:this.$+"px",top:h.K+"px","margin-top":"100px",left:"50%","margin-left":Math.round(-this.sa/ +2)+"px",overflow:"hidden","border-radius":"5px","box-shadow":b,transform:"translateZ(1px)",transition:"opacity "+f+", top "+f},"#video.exiting":{opacity:"0.0",top:this.$+"px"},"#video-holder":{position:"absolute",width:this.sa-1+"px",height:this.$+"px",overflow:"hidden","border-radius":"5px"},"#video-frame":{"margin-left":"-1px",width:this.sa+"px"},"#video-controls":{opacity:"0",transition:"opacity 0.5s"},"#video:hover #video-controls":{opacity:"1.0"},"#video .video-progress-el":{position:"absolute", +bottom:"0",height:"25px","border-radius":"0 0 0 5px"},"#video-progress":{width:"90%"},"#video-progress-total":{width:"100%","background-color":this.j.ab,opacity:"0.7"},"#video-elapsed":{width:"0","background-color":"#6cb6f5",opacity:"0.9"},"#video #video-time":{width:"10%",right:"0","font-size":"11px","line-height":"25px",color:this.j.sb,"background-color":"#666","border-radius":"0 0 5px 0"}};this.U("ie",8)&&c.extend(a,{"* html #overlay":{position:"absolute"},"* html #bg":{position:"absolute"},"html, body":{height:"100%"}}); +this.U("ie",7)&&c.extend(a,{"#mini #body":{display:"inline",zoom:"1",border:"1px solid "+this.j.Aa},"#mini #body-text":{padding:"20px"},"#mini #mini-icon":{display:"none"}});var b="backface-visibility,border-radius,box-shadow,opacity,perspective,transform,transform-style,transition".split(","),d=["khtml","moz","ms","o","webkit"],k;for(k in a)for(e=0;e +(w.__SV||0)?r.X("Version mismatch; please ensure you're using the latest version of the Mixpanel code snippet."):(c.a(w._i,function(a){a&&c.isArray(a)&&(D[a[a.length-1]]=Q.apply(this,a))}),ma(),w.init(),c.a(D,function(a){a.za()}),la())})()})(); })(); diff --git a/package-lock.json b/package-lock.json index 0901b135..8826a21a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mixpanel-browser", - "version": "2.24.0", + "version": "2.26.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/mixpanel-core.js b/src/mixpanel-core.js index efcf4067..728c16b8 100644 --- a/src/mixpanel-core.js +++ b/src/mixpanel-core.js @@ -696,10 +696,16 @@ MixpanelPersistence.prototype._get_or_create_queue = function(queue, default_val return this['props'][key] || (this['props'][key] = default_val); }; -MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) { +MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp, callback) { var timers = this['props'][EVENT_TIMERS_KEY] || {}; timers[event_name] = timestamp; this['props'][EVENT_TIMERS_KEY] = timers; + + if (callback && (typeof(callback) === 'function')) { + var callbacks = this['event_timer_callbacks'] || {}; + callbacks[event_name] = callback; + this['event_timer_callbacks'] = callbacks; + } this.save(); }; @@ -710,7 +716,15 @@ MixpanelPersistence.prototype.remove_event_timer = function(event_name) { delete this['props'][EVENT_TIMERS_KEY][event_name]; this.save(); } - return timestamp; + + var callbacks = this['event_timer_callbacks'] || {}; + var callback = callbacks[event_name]; + if (!_.isUndefined(callback)) { + delete this['event_timer_callbacks']; + this.save; + } + + return [timestamp, callback]; }; /** @@ -1154,10 +1168,16 @@ MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, pro properties['token'] = this.get_config('token'); // set $duration if time_event was previously called for this event - var start_timestamp = this['persistence'].remove_event_timer(event_name); + var start_timestamp_with_callback = this['persistence'].remove_event_timer(event_name); + var start_timestamp = start_timestamp_with_callback[0]; + var timer_callback = start_timestamp_with_callback[1]; if (!_.isUndefined(start_timestamp)) { var duration_in_ms = new Date().getTime() - start_timestamp; - properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3)); + var end_timestamp = parseFloat((duration_in_ms / 1000).toFixed(3)); + if (!_.isUndefined(timer_callback)) { + end_timestamp = timer_callback(end_timestamp); + } + properties['$duration'] = end_timestamp; } // update persistence @@ -1422,7 +1442,7 @@ MixpanelLib.prototype.track_forms = function() { * * @param {String} event_name The name of the event. */ -MixpanelLib.prototype.time_event = function(event_name) { +MixpanelLib.prototype.time_event = function(event_name, callback) { if (_.isUndefined(event_name)) { console.error('No event name provided to mixpanel.time_event'); return; @@ -1432,7 +1452,7 @@ MixpanelLib.prototype.time_event = function(event_name) { return; } - this['persistence'].set_event_timer(event_name, new Date().getTime()); + this['persistence'].set_event_timer(event_name, new Date().getTime(), callback); }; /** diff --git a/tests/test.js b/tests/test.js index d462564c..715d7f5e 100644 --- a/tests/test.js +++ b/tests/test.js @@ -610,6 +610,20 @@ same(data.properties.$duration, 0.123); }); + test("it allows a callback to modify the duration value on next track", 2, function() { + mixpanel.test.time_event('test', function (elapsed) { + return elapsed + 100; + }); + this.clock.tick(123); + var data = mixpanel.test.track('test'); + same(data.properties.$duration, 100.123); + + mixpanel.test.time_event('test'); + this.clock.tick(123); + var data_without_callback = mixpanel.test.track('test') + same(data_without_callback.properties.$duration, 0.123); + }); + mpmodule("json"); test("basic", 2, function() {