From 9569c16f2b10c4b10ba0c8fc69d52f166e776983 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Wed, 18 Jun 2014 11:45:47 -0500 Subject: [PATCH] Moving setting of the img src till after it is appended to the bottom to prevent double trackign in some browser --- mixpanel-jslib-snippet.min.js | 4 +- mixpanel.js | 2 +- mixpanel.min.js | 107 +++++++++++++++++----------------- 3 files changed, 56 insertions(+), 57 deletions(-) diff --git a/mixpanel-jslib-snippet.min.js b/mixpanel-jslib-snippet.min.js index d55f0fbc..faa12e20 100644 --- a/mixpanel-jslib-snippet.min.js +++ b/mixpanel-jslib-snippet.min.js @@ -1,2 +1,2 @@ -(function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" "); -for(g=0;ga?"0"+a:a}return a.getUTCFullYear()+"-"+c(a.getUTCMonth()+1)+"-"+c(a.getUTCDate())+"T"+c(a.getUTCHours())+":"+c(a.getUTCMinutes())+":"+c(a.getUTCSeconds())};b.G=function(a){var c={};b.a(a,function(a,f){b.ma(a)&&0=h;)d()}function b(){var a,c,e="",f;if('"'===h)for(;d();){if('"'===h)return d(),e;if("\\"===h)if(d(),"u"===h){for(c=f=0;4>c;c+=1){a=parseInt(d(), -16);if(!isFinite(a))break;f=16*f+a}e+=String.fromCharCode(f)}else if("string"===typeof g[h])e+=g[h];else break;else e+=h}j("Bad string")}function f(){var a;a="";"-"===h&&(a="-",d("-"));for(;"0"<=h&&"9">=h;)a+=h,d();if("."===h)for(a+=".";d()&&"0"<=h&&"9">=h;)a+=h;if("e"===h||"E"===h){a+=h;d();if("-"===h||"+"===h)a+=h,d();for(;"0"<=h&&"9">=h;)a+=h,d()}a=+a;if(isFinite(a))return a;j("Bad number")}function d(a){a&&a!==h&&j("Expected '"+a+"' instead of '"+h+"'");h=m.charAt(i);i+=1;return h}function j(a){throw{name:"SyntaxError", -message:a,kb:i,text:m};}var i,h,g={'"':'"',"\\":"\\","/":"/",b:"\u0008",f:"\u000c",n:"\n",r:"\r",t:"\t"},m,n;n=function(){c();switch(h){case "{":var i;a:{var g,m={};if("{"===h){d("{");c();if("}"===h){d("}");i=m;break a}for(;h;){g=b();c();d(":");Object.hasOwnProperty.call(m,g)&&j('Duplicate key "'+g+'"');m[g]=n();c();if("}"===h){d("}");i=m;break a}d(",");c()}}j("Bad object")}return i;case "[":a:{i=[];if("["===h){d("[");c();if("]"===h){d("]");g=i;break a}for(;h;){i.push(n());c();if("]"===h){d("]"); -g=i;break a}d(",");c()}}j("Bad array")}return g;case '"':return b();case "-":return f();default:return"0"<=h&&"9">=h?f():a()}};return function(a){m=a;i=0;h=" ";a=n();c();h&&j("Syntax error");return a}}();b.ca=function(a){var c,e,f,d,j=0,i=0,h="",h=[];if(!a)return a;a=b.ib(a);do c=a.charCodeAt(j++),e=a.charCodeAt(j++),f=a.charCodeAt(j++),d=c<<16|e<<8|f,c=d>>18&63,e=d>>12&63,f=d>>6&63,d&=63,h[i++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);while(ji?f++:h=127i?String.fromCharCode(i>>6|192,i&63|128):String.fromCharCode(i>> -12|224,i>>6&63|128,i&63|128);h!==q&&(f>b&&(c+=a.substring(b,f)),c+=h,b=f=j+1)}f>b&&(c+=a.substring(b,a.length));return c};b.Aa=function(){function a(){function a(c,b){var e,d=0;for(e=0;ez)p.T("Version mismatch; please ensure you're using the latest version of the Mixpanel code snippet.");else{var y={};b.a(s._i,function(a){var c;a&&b.isArray(a)&&(c=a[a.length-1],a=E.apply(this,a),y[c]=a)}); -var Q=function(){b.a(y,function(a,b){"mixpanel"!==b&&(s[b]=a)});s._=b};s.init=function(a,b,e){e?s[e]||(s[e]=y[e]=E(a,b,e),s[e].P()):(e=s,y.mixpanel?e=y.mixpanel:a&&(e=E(a,b,"mixpanel")),window.mixpanel=s=e,Q())};s.init();b.a(y,function(a){a.P()});if(r.addEventListener)"complete"==r.readyState?x():r.addEventListener("DOMContentLoaded",x,v);else if(r.attachEvent){r.attachEvent("onreadystatechange",x);z=v;try{z=window.frameElement==q}catch(R){}if(r.documentElement.doScroll&&z){var N=function(){try{r.documentElement.doScroll("left")}catch(a){setTimeout(N, -1);return}x()};N()}}b.ra(window,"load",x,o)}})(window.mixpanel); +(function(t){function n(){}function g(){}function D(a,c,e){var f,d="mixpanel"===e?t:t[e];if(d&&!b.isArray(d))q.error("You have already initialized "+e);else return f=new g,f.P(a,c,e),f.people=new n,f.people.P(f),A=A||f.d("debug"),b.e(d)||(f.N.call(f.people,d.people),f.N(d)),f}function m(a){this.props={};this.ea=!1;this.name=a.cookie_name?"mp_"+a.cookie_name:"mp_"+a.token+"_mixpanel";this.load();this.ya(a);this.ib(a);this.save()}function E(){this.qa="submit"}function B(){this.qa="click"}function w(){} +function x(){x.Ma||(J=x.Ma=!0,K=!1,b.a(y,function(a){a.Ca()}))}var I=Array.prototype,z=Object.prototype,L=I.slice,C=z.toString,F=z.hasOwnProperty,u=window.console,G=window.navigator,s=window.document,v=G.userAgent,N="__mps __mpso __mpa __mpap $people_distinct_id __alias".split(" "),z=t&&t.__SV||0,H=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,K=!H&&-1==v.indexOf("MSIE"),b={},A=!1,O={api_host:("https:"==s.location.protocol?"https://":"http://")+"api.mixpanel.com",cross_subdomain_cookie:!0, +cookie_name:"",loaded:function(){},store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,track_pageview:!0,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_cookie:!1,secure_cookie:!1,ip:!0},J=!1;(function(){var a=I.forEach,c=I.indexOf,e=Array.isArray,f={},d=b.a=function(c,e,b){if(null!=c)if(a&&c.forEach===a)c.forEach(e,b);else if(c.length===+c.length)for(var d=0,g=c.length;da?"0"+a:a}return a.getUTCFullYear()+"-"+c(a.getUTCMonth()+1)+"-"+c(a.getUTCDate())+"T"+c(a.getUTCHours())+":"+c(a.getUTCMinutes())+":"+c(a.getUTCSeconds())};b.H=function(a){var c={};b.a(a,function(a,f){b.na(a)&&0=k;)d()}function b(){var a,c,e="",f;if('"'===k)for(;d();){if('"'===k)return d(), +e;if("\\"===k)if(d(),"u"===k){for(c=f=0;4>c;c+=1){a=parseInt(d(),16);if(!isFinite(a))break;f=16*f+a}e+=String.fromCharCode(f)}else if("string"===typeof g[k])e+=g[k];else break;else e+=k}l("Bad string")}function f(){var a;a="";"-"===k&&(a="-",d("-"));for(;"0"<=k&&"9">=k;)a+=k,d();if("."===k)for(a+=".";d()&&"0"<=k&&"9">=k;)a+=k;if("e"===k||"E"===k){a+=k;d();if("-"===k||"+"===k)a+=k,d();for(;"0"<=k&&"9">=k;)a+=k,d()}a=+a;if(isFinite(a))return a;l("Bad number")}function d(a){a&&a!==k&&l("Expected '"+ +a+"' instead of '"+k+"'");k=r.charAt(h);h+=1;return k}function l(a){throw{name:"SyntaxError",message:a,lb:h,text:r};}var h,k,g={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},r,p;p=function(){c();switch(k){case "{":var h;a:{var g={};if("{"===k){d("{");c();if("}"===k){d("}");h=g;break a}for(;k;){h=b();c();d(":");Object.hasOwnProperty.call(g,h)&&l('Duplicate key "'+h+'"');g[h]=p();c();if("}"===k){d("}");h=g;break a}d(",");c()}}l("Bad object");h=void 0}return h;case "[":a:{h=[];if("["=== +k){d("[");c();if("]"===k){d("]");break a}for(;k;){h.push(p());c();if("]"===k){d("]");break a}d(",");c()}}l("Bad array");h=void 0}return h;case '"':return b();case "-":return f();default:return"0"<=k&&"9">=k?f():a()}};return function(a){r=a;h=0;k=" ";a=p();c();k&&l("Syntax error");return a}}();b.da=function(a){var c,e,f,d,l=0,h=0,k="",k=[];if(!a)return a;a=b.jb(a);do c=a.charCodeAt(l++),e=a.charCodeAt(l++),f=a.charCodeAt(l++),d=c<<16|e<<8|f,c=d>>18&63,e=d>>12&63,f=d>>6&63,d&=63,k[h++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+ +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);while(lh?f++:k=127h?String.fromCharCode(h>>6|192,h&63|128):String.fromCharCode(h>>12|224,h>>6&63|128,h&63|128);null!==k&&(f>b&&(c+=a.substring(b,f)),c+=k,b=f=l+1)}f>b&&(c+=a.substring(b,a.length));return c};b.Ba=function(){function a(){function a(c,b){var e,d=0;for(e=0;ez)q.U("Version mismatch; please ensure you're using the latest version of the Mixpanel code snippet.");else{var y={};b.a(t._i,function(a){var c;a&&b.isArray(a)&&(c=a[a.length-1],a=D.apply(this,a),y[c]=a)});var P=function(){b.a(y,function(a,b){"mixpanel"!==b&&(t[b]=a)});t._=b};t.init=function(a,b,e){e?t[e]||(t[e]=y[e]=D(a,b,e),t[e].Q()):(e=t,y.mixpanel?e=y.mixpanel:a&&(e=D(a,b,"mixpanel")),window.mixpanel=t=e,P())};t.init();b.a(y,function(a){a.Q()});if(s.addEventListener)"complete"==s.readyState? +x():s.addEventListener("DOMContentLoaded",x,!1);else if(s.attachEvent){s.attachEvent("onreadystatechange",x);z=!1;try{z=null==window.frameElement}catch(Q){}if(s.documentElement.doScroll&&z){var M=function(){try{s.documentElement.doScroll("left")}catch(a){setTimeout(M,1);return}x()};M()}}b.sa(window,"load",x,!0)}})(window.mixpanel); })();