From 8c07b4d61e662c77f1eb249d22256c5fa98ab496 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 11 Oct 2018 11:11:32 +1300 Subject: Support window.Matomo in JS Tracker (#13568) * support window.Matomo in JS Tracker * Fix integration tests. --- js/piwik.min.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/piwik.min.js') diff --git a/js/piwik.min.js b/js/piwik.min.js index 77d49ac10c..d954114f2d 100644 --- a/js/piwik.min.js +++ b/js/piwik.min.js @@ -18,7 +18,7 @@ var I="000000";var t=function(ac,ad){return(I+(ad||0)).slice(-ac)};var z="\\u00" }else{at=null}}else{if(typeof at.toJSON=="function"&&((ae!=N&&ae!=O&&ae!=E)||r.call(at,"toJSON"))){at=at.toJSON(ai)}}}if(ag){at=ag.call(aA,ai,at)}if(at===null){return"null"}ae=u.call(at);if(ae==A){return""+at}else{if(ae==N){return at>-1/0&&at<1/0?""+at:"null"}else{if(ae==O){return C(""+at)}}}if(typeof at=="object"){for(af=aj.length;af--;){if(aj[af]===at){throw aa()}}aj.push(at);ar=[];av=ac;ac+=ax;if(ae==E){for(ah=0,af=at.length;ah0){for(ad="",af>10&&(af=10); ad.length=48&&ad<=57||ad>=97&&ad<=102||ad>=65&&ad<=70)){H()}}ag+=M("0x"+ah.slice(ae,G));break;default:H()}}else{if(ad==34){break}ad=ah.charCodeAt(G);ae=G;while(ad>=32&&ad!=92&&ad!=34){ad=ah.charCodeAt(++G)}ag+=ah.slice(ae,G)}}}if(ah.charCodeAt(G)==34){G++; return ag}H();default:ae=G;if(ad==45){ai=true;ad=ah.charCodeAt(++G)}if(ad>=48&&ad<=57){if(ad==48&&((ad=ah.charCodeAt(G+1)),ad>=48&&ad<=57)){H()}ai=false;for(;G=48&&ad<=57);G++){}if(ah.charCodeAt(G)==46){ac=++G;for(;ac=48&&ad<=57);ac++){}if(ac==G){H()}G=ac}ad=ah.charCodeAt(G);if(ad==101||ad==69){ad=ah.charCodeAt(++G);if(ad==43||ad==45){G++}for(ac=G;ac=48&&ad<=57);ac++){}if(ac==G){H()}G=ac}return +ah.slice(ae,G)}if(ai){H()}if(ah.slice(G,G+4)=="true"){G+=4;return true}else{if(ah.slice(G,G+5)=="false"){G+=5;return false}else{if(ah.slice(G,G+4)=="null"){G+=4;return null}}}H()}}return"$"};var W=function(ad){var ac,ae;if(ad=="$"){H()}if(typeof ad=="string"){if((F?ad.charAt(0):ad[0])=="@"){return ad.slice(1)}if(ad=="["){ac=[];for(;;ae||(ae=true)){ad=y();if(ad=="]"){break}if(ae){if(ad==","){ad=y();if(ad=="]"){H()}}else{H()}}if(ad==","){H()}ac.push(W(ad))}return ac}else{if(ad=="{"){ac={};for(;;ae||(ae=true)){ad=y(); -if(ad=="}"){break}if(ae){if(ad==","){ad=y();if(ad=="}"){H()}}else{H()}}if(ad==","||typeof ad!="string"||(F?ad.charAt(0):ad[0])!="@"||y()!=":"){H()}ac[ad.slice(1)]=W(y())}return ac}}H()}return ad};var P=function(ae,ad,af){var ac=w(ae,ad,af);if(ac===L){delete ae[ad]}else{ae[ad]=ac}};var w=function(af,ae,ag){var ad=af[ae],ac;if(typeof ad=="object"&&ad){if(u.call(ad)==E){for(ac=ad.length;ac--;){P(ad,ac,ag)}}else{m(ad,function(ah){P(ad,ah,ag)})}}return ag.call(af,ae,ad)};V.parse=function(ae,af){var ac,ad;G=0;X=""+ae;ac=W(y());if(y()!="$"){H()}G=X=null;return af&&u.call(af)==U?w((ad={},ad[""]=ac,ad),"",af):ac}}}V.runInContext=j;return V}if(h&&!c){j(i,h)}else{var f=i.JSON,k=i.JSON3,d=false;var g=j(i,(i.JSON3={noConflict:function(){if(!d){d=true;i.JSON=f;i.JSON3=k;f=k=null}return g}}));i.JSON={parse:g.parse,stringify:g.stringify}}if(c){define(function(){return g})}}).call(this);JSON_PIWIK=a})()}if(typeof _paq!=="object"){_paq=[]}if(typeof window.Piwik!=="object"){window.Piwik=(function(){var r,b={},y={},G=document,h=navigator,W=screen,T=window,i=T.performance||T.mozPerformance||T.msPerformance||T.webkitPerformance,t=T.encodeURIComponent,S=T.decodeURIComponent,l=unescape,I=[],E,e,ad=[],x=0,m=false; +if(ad=="}"){break}if(ae){if(ad==","){ad=y();if(ad=="}"){H()}}else{H()}}if(ad==","||typeof ad!="string"||(F?ad.charAt(0):ad[0])!="@"||y()!=":"){H()}ac[ad.slice(1)]=W(y())}return ac}}H()}return ad};var P=function(ae,ad,af){var ac=w(ae,ad,af);if(ac===L){delete ae[ad]}else{ae[ad]=ac}};var w=function(af,ae,ag){var ad=af[ae],ac;if(typeof ad=="object"&&ad){if(u.call(ad)==E){for(ac=ad.length;ac--;){P(ad,ac,ag)}}else{m(ad,function(ah){P(ad,ah,ag)})}}return ag.call(af,ae,ad)};V.parse=function(ae,af){var ac,ad;G=0;X=""+ae;ac=W(y());if(y()!="$"){H()}G=X=null;return af&&u.call(af)==U?w((ad={},ad[""]=ac,ad),"",af):ac}}}V.runInContext=j;return V}if(h&&!c){j(i,h)}else{var f=i.JSON,k=i.JSON3,d=false;var g=j(i,(i.JSON3={noConflict:function(){if(!d){d=true;i.JSON=f;i.JSON3=k;f=k=null}return g}}));i.JSON={parse:g.parse,stringify:g.stringify}}if(c){define(function(){return g})}}).call(this);JSON_PIWIK=a})()}if(typeof _paq!=="object"){_paq=[]}if(typeof window.Piwik!=="object"){window.Matomo=window.Piwik=(function(){var r,b={},y={},G=document,h=navigator,W=screen,T=window,i=T.performance||T.mozPerformance||T.msPerformance||T.webkitPerformance,t=T.encodeURIComponent,S=T.decodeURIComponent,l=unescape,I=[],E,e,ad=[],x=0,m=false; function p(ak){try{return S(ak)}catch(al){return unescape(ak)}}function J(al){var ak=typeof al;return ak!=="undefined"}function A(ak){return typeof ak==="function"}function V(ak){return typeof ak==="object"}function w(ak){return typeof ak==="string"||ak instanceof String}function B(al){if(!al){return true}var ak;var am=true;for(ak in al){if(Object.prototype.hasOwnProperty.call(al,ak)){am=false}}return am}function ag(ak){var al=typeof console;if(al!=="undefined"&&console&&console.error){console.error(ak)}}function ac(){var ap,ao,ar,al,ak;for(ap=0;ap0;if(an){aq=ar.split("::");am=aq[0];ar=aq[1];if("object"===typeof e[am]&&"function"===typeof e[am][ar]){e[am][ar].apply(e[am],al)}else{if(ak){ad.push(ak)}}}else{for(ao=0;ao0;if(at){aq=ar.split(".");if(am&&"object"===typeof am[aq[0]]){am=am[aq[0]]; ar=aq[1]}else{if(ak){ad.push(ak);break}}}if(am[ar]){am[ar].apply(am,al)}else{var au="The method '"+ar+'\' was not found in "_paq" variable. Please have a look at the Piwik tracker documentation: https://developer.piwik.org/api-reference/tracking-javascript';ag(au);if(!at){throw new TypeError(au)}}if(ar==="addTracker"){break}if(ar==="setTrackerUrl"||ar==="setSiteId"){break}}else{ar.apply(I[ao],al)}}}}}function aj(an,am,al,ak){if(an.addEventListener){an.addEventListener(am,al,ak);return true}if(an.attachEvent){return an.attachEvent("on"+am,al)}an["on"+am]=al}function n(ak){if(G.readyState==="complete"){ak()}else{if(T.addEventListener){T.addEventListener("load",ak,false)}else{if(T.attachEvent){T.attachEvent("onload",ak)}}}}function q(an){var ak=false;if(G.attachEvent){ak=G.readyState==="complete"}else{ak=G.readyState!=="loading"}if(ak){an();return}var am;if(G.addEventListener){aj(G,"DOMContentLoaded",function al(){G.removeEventListener("DOMContentLoaded",al,false);if(!ak){ak=true;an()}})}else{if(G.attachEvent){G.attachEvent("onreadystatechange",function al(){if(G.readyState==="complete"){G.detachEvent("onreadystatechange",al); if(!ak){ak=true;an()}}});if(G.documentElement.doScroll&&T===T.top){(function al(){if(!ak){try{G.documentElement.doScroll("left")}catch(ao){setTimeout(al,0);return}ak=true;an()}}())}}}aj(T,"load",function(){if(!ak){ak=true;an()}},false)}function Z(al,aq,ar){if(!al){return""}var ak="",an,am,ao,ap;for(an in b){if(Object.prototype.hasOwnProperty.call(b,an)){ap=b[an]&&"function"===typeof b[an][al];if(ap){am=b[an][al];ao=am(aq||{},ar);if(ao){ak+=ao}}}}return ak}function ae(){var ak;m=true;Z("unload");if(r){do{ak=new Date()}while(ak.getTimeAlias()1&&al!=="addTracker"){ag("The method "+al+' is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Piwik trackers documentation: https://developer.piwik.org/guides/tracking-javascript-guide#multiple-piwik-trackers') }aq[al]++}}}}return ap}var C=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCrossDomainLinkingTimeout","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking","requireConsent","setConsentGiven"];function aa(ak,am){var al=new Q(ak,am);I.push(al);_paq=c(_paq,C);for(E=0;E<_paq.length;E++){if(_paq[E]){ac(_paq[E])}}_paq=new H();return al}aj(T,"beforeunload",ae,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(an,am,al,ak){var ao=typeof ak;if(ao==="undefined"){ak=false}aj(an,am,al,ak)},onLoad:n,onReady:q,isNodeVisible:j,isOrWasNodeVisible:v.isNodeVisible},on:function(al,ak){if(!y[al]){y[al]=[]}y[al].push(ak)},off:function(am,al){if(!y[am]){return}var ak=0;for(ak;ak