diff options
author | Daniel Jalkut <jalkut@red-sweater.com> | 2022-05-18 11:20:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 11:20:21 +0300 |
commit | f17af4c1b8811467962137163e28719831604066 (patch) | |
tree | 060af26349c50298df289e0cb6551586e2dd4349 /matomo.js | |
parent | e078b77488cfdc264a55bf594da7923c6a8cbb15 (diff) |
Take care to always 'return request' in appendAvailablePerformanceMetrics (#19232)
* Take care to always 'return request' in appendAvailablePerformanceMetrics
This alleviates a variety of spurious "Invalid idSite: 0" issues as described in #12264. That issue was closed in 2019 but since then many of us have continued to see issues that do not seem to be rooted in client configuration errors, as suggested by https://github.com/matomo-org/matomo/issues/12264#issuecomment-474991737.
* Add minified matomo.js.
* Delete piwik.min.js
Co-authored-by: Stefan Giehl <stefan@matomo.org>
Diffstat (limited to 'matomo.js')
-rw-r--r-- | matomo.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -39,8 +39,8 @@ for(du;du<dv;du+=dx){dw.push(dt.slice(du,du+dx))}return dw}function dp(du,dt){if dh[du]=(dw&&dw.enabledPlugin)?"1":"0"}}}if(!((new RegExp("Edge[ /](\\d+[\\.\\d]+)")).test(g.userAgent))&&typeof navigator.javaEnabled!=="unknown"&&M(g.javaEnabled)&&g.javaEnabled()){dh.java="1"}if(!M(W.showModalDialog)&&M(g.cookieEnabled)){dh.cookie=g.cookieEnabled?"1":"0"}else{dh.cookie=cb()}}var dv=parseInt(ab.width,10);var dt=parseInt(ab.height,10);dh.res=parseInt(dv,10)+"x"+parseInt(dt,10);return dh}function b3(){var du=aY("cvar"),dt=aH(du);if(dt&&dt.length){dt=W.JSON.parse(dt);if(Z(dt)){return dt}}return{}}function cN(){if(aV===false){aV=b3()}}function cZ(){var dt=cQ();return cd((g.userAgent||"")+(g.platform||"")+W.JSON.stringify(dt)+(new Date()).getTime()+Math.random()).slice(0,16)}function aF(){var dt=cQ();return cd((g.userAgent||"")+(g.platform||"")+W.JSON.stringify(dt)).slice(0,6)}function bl(){return Math.floor((new Date()).getTime()/1000)}function aO(){var du=bl();var dv=aF();var dt=String(du)+dv;return dt}function dc(dv){dv=String(dv);var dy=aF();var dw=dy.length;var dx=dv.substr(-1*dw,dw); var du=parseInt(dv.substr(0,dv.length-dw),10);if(du&&dx&&dx===dy){var dt=bl();if(a5<=0){return true}if(dt>=du&&dt<=(du+a5)){return true}}return false}function dr(dt){if(!cV){return""}var dx=e(dt,az);if(!dx){return""}dx=String(dx);var dv=new RegExp("^[a-zA-Z0-9]+$");if(dx.length===32&&dv.test(dx)){var du=dx.substr(16,32);if(dc(du)){var dw=dx.substr(0,16);return dw}}return""}function cW(){if(!bU){bU=dr(bT)}var dv=new Date(),dt=Math.round(dv.getTime()/1000),du=aY("id"),dy=aH(du),dx,dw;if(dy){dx=dy.split(".");dx.unshift("0");if(bU.length){dx[1]=bU}return dx}if(bU.length){dw=bU}else{if("0"===cb()){dw=""}else{dw=cZ()}}dx=["1",dw,dt];return dx}function a4(){var dw=cW(),du=dw[0],dv=dw[1],dt=dw[2];return{newVisitor:du,uuid:dv,createTs:dt}}function aL(){var dw=new Date(),du=dw.getTime(),dx=a4().createTs;var dt=parseInt(dx,10);var dv=(dt*1000)+cS-du;return dv}function aR(dt){if(!cc){return}var dv=new Date(),du=Math.round(dv.getTime()/1000);if(!M(dt)){dt=a4()}var dw=dt.uuid+"."+dt.createTs+".";dn(aY("id"),dw,aL(),bw,c7,bY,aN) }function bS(){var dt=aH(aY("ref"));if(dt.length){try{dt=W.JSON.parse(dt);if(Z(dt)){return dt}}catch(du){}}return["","",0,""]}function bD(dv){var du=bq+"testcookie_domain";var dt="testvalue";dn(du,dt,10000,null,dv,bY,aN);if(aH(du)===dt){b5(du,null,dv);return true}return false}function aJ(){var du=bs;bs=false;var dt,dv;for(dt=0;dt<bB.length;dt++){dv=aY(bB[dt]);if(dv!==cU&&dv!==bj&&0!==aH(dv)){b5(dv,bw,c7)}}bs=du}function b9(dt){cc=dt}function ds(dx){if(!dx||!Z(dx)){return}var dw=[];var dv;for(dv in dx){if(Object.prototype.hasOwnProperty.call(dx,dv)){dw.push(dv)}}var dy={};dw.sort();var dt=dw.length;var du;for(du=0;du<dt;du++){dy[dw[du]]=dx[dw[du]]}return dy}function ci(){dn(aY("ses"),"1",cu,bw,c7,bY,aN)}function bm(){var dw="";var du="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";var dv=du.length;var dt;for(dt=0;dt<6;dt++){dw+=du.charAt(Math.floor(Math.random()*dv))}return dw}function aE(du){if(ct!==""){du+=ct;bn=true;return du}if(!h){return du}var dv=(typeof h.timing==="object")&&h.timing?h.timing:undefined; -if(!dv){dv=(typeof h.getEntriesByType==="function")&&h.getEntriesByType("navigation")?h.getEntriesByType("navigation")[0]:undefined}if(!dv){return du}var dt="";if(dv.connectEnd&&dv.fetchStart){if(dv.connectEnd<dv.fetchStart){return}dt+="&pf_net="+Math.round(dv.connectEnd-dv.fetchStart)}if(dv.responseStart&&dv.requestStart){if(dv.responseStart<dv.requestStart){return}dt+="&pf_srv="+Math.round(dv.responseStart-dv.requestStart)}if(dv.responseStart&&dv.responseEnd){if(dv.responseEnd<dv.responseStart){return}dt+="&pf_tfr="+Math.round(dv.responseEnd-dv.responseStart)}if(M(dv.domLoading)){if(dv.domInteractive&&dv.domLoading){if(dv.domInteractive<dv.domLoading){return}dt+="&pf_dm1="+Math.round(dv.domInteractive-dv.domLoading)}}else{if(dv.domInteractive&&dv.responseEnd){if(dv.domInteractive<dv.responseEnd){return}dt+="&pf_dm1="+Math.round(dv.domInteractive-dv.responseEnd)}}if(dv.domComplete&&dv.domInteractive){if(dv.domComplete<dv.domInteractive){return}dt+="&pf_dm2="+Math.round(dv.domComplete-dv.domInteractive) -}if(dv.loadEventEnd&&dv.loadEventStart){if(dv.loadEventEnd<dv.loadEventStart){return}dt+="&pf_onl="+Math.round(dv.loadEventEnd-dv.loadEventStart)}return du+dt}function cy(dv,dP,dQ){var dO,du=new Date(),dC=Math.round(du.getTime()/1000),dz,dM,dw=1024,dV,dD,dL=aV,dx=aY("ses"),dJ=aY("ref"),dG=aY("cvar"),dH=aH(dx),dN=bS(),dR=ba||bT,dA,dt;if(bs){aJ()}if(cY){return""}var dI=a4();var dF=J.characterSet||J.charset;if(!dF||dF.toLowerCase()==="utf-8"){dF=null}dA=dN[0];dt=dN[1];dz=dN[2];dM=dN[3];if(!dH){if(!bC||!dA.length){for(dO in cw){if(Object.prototype.hasOwnProperty.call(cw,dO)){dA=e(dR,cw[dO]);if(dA.length){break}}}for(dO in bN){if(Object.prototype.hasOwnProperty.call(bN,dO)){dt=e(dR,bN[dO]);if(dt.length){break}}}}dV=d(bu);dD=dM.length?d(dM):"";if(dV.length&&!a1(dV)&&(!bC||!dD.length||a1(dD))){dM=bu}if(dM.length||dA.length){dz=dC;dN=[dA,dt,dz,b8(dM.slice(0,dw))];dn(dJ,W.JSON.stringify(dN),df,bw,c7,bY,aN)}}dv+="&idsite="+cc+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+du.getHours()+"&m="+du.getMinutes()+"&s="+du.getSeconds()+"&url="+t(b8(dR))+(bu.length?"&urlref="+t(b8(bu)):"")+(ac(bF)?"&uid="+t(bF):"")+"&_id="+dI.uuid+"&_idn="+dI.newVisitor+(dA.length?"&_rcn="+t(dA):"")+(dt.length?"&_rck="+t(dt):"")+"&_refts="+dz+(String(dM).length?"&_ref="+t(b8(dM.slice(0,dw))):"")+(dF?"&cs="+t(dF):"")+"&send_image=0"; +if(!dv){dv=(typeof h.getEntriesByType==="function")&&h.getEntriesByType("navigation")?h.getEntriesByType("navigation")[0]:undefined}if(!dv){return du}var dt="";if(dv.connectEnd&&dv.fetchStart){if(dv.connectEnd<dv.fetchStart){return du}dt+="&pf_net="+Math.round(dv.connectEnd-dv.fetchStart)}if(dv.responseStart&&dv.requestStart){if(dv.responseStart<dv.requestStart){return du}dt+="&pf_srv="+Math.round(dv.responseStart-dv.requestStart)}if(dv.responseStart&&dv.responseEnd){if(dv.responseEnd<dv.responseStart){return du}dt+="&pf_tfr="+Math.round(dv.responseEnd-dv.responseStart)}if(M(dv.domLoading)){if(dv.domInteractive&&dv.domLoading){if(dv.domInteractive<dv.domLoading){return du}dt+="&pf_dm1="+Math.round(dv.domInteractive-dv.domLoading)}}else{if(dv.domInteractive&&dv.responseEnd){if(dv.domInteractive<dv.responseEnd){return du}dt+="&pf_dm1="+Math.round(dv.domInteractive-dv.responseEnd)}}if(dv.domComplete&&dv.domInteractive){if(dv.domComplete<dv.domInteractive){return du}dt+="&pf_dm2="+Math.round(dv.domComplete-dv.domInteractive) +}if(dv.loadEventEnd&&dv.loadEventStart){if(dv.loadEventEnd<dv.loadEventStart){return du}dt+="&pf_onl="+Math.round(dv.loadEventEnd-dv.loadEventStart)}return du+dt}function cy(dv,dP,dQ){var dO,du=new Date(),dC=Math.round(du.getTime()/1000),dz,dM,dw=1024,dV,dD,dL=aV,dx=aY("ses"),dJ=aY("ref"),dG=aY("cvar"),dH=aH(dx),dN=bS(),dR=ba||bT,dA,dt;if(bs){aJ()}if(cY){return""}var dI=a4();var dF=J.characterSet||J.charset;if(!dF||dF.toLowerCase()==="utf-8"){dF=null}dA=dN[0];dt=dN[1];dz=dN[2];dM=dN[3];if(!dH){if(!bC||!dA.length){for(dO in cw){if(Object.prototype.hasOwnProperty.call(cw,dO)){dA=e(dR,cw[dO]);if(dA.length){break}}}for(dO in bN){if(Object.prototype.hasOwnProperty.call(bN,dO)){dt=e(dR,bN[dO]);if(dt.length){break}}}}dV=d(bu);dD=dM.length?d(dM):"";if(dV.length&&!a1(dV)&&(!bC||!dD.length||a1(dD))){dM=bu}if(dM.length||dA.length){dz=dC;dN=[dA,dt,dz,b8(dM.slice(0,dw))];dn(dJ,W.JSON.stringify(dN),df,bw,c7,bY,aN)}}dv+="&idsite="+cc+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+du.getHours()+"&m="+du.getMinutes()+"&s="+du.getSeconds()+"&url="+t(b8(dR))+(bu.length?"&urlref="+t(b8(bu)):"")+(ac(bF)?"&uid="+t(bF):"")+"&_id="+dI.uuid+"&_idn="+dI.newVisitor+(dA.length?"&_rcn="+t(dA):"")+(dt.length?"&_rck="+t(dt):"")+"&_refts="+dz+(String(dM).length?"&_ref="+t(b8(dM.slice(0,dw))):"")+(dF?"&cs="+t(dF):"")+"&send_image=0"; var dU=cQ();for(dO in dU){if(Object.prototype.hasOwnProperty.call(dU,dO)){dv+="&"+dO+"="+dU[dO]}}var dT=[];if(dP){for(dO in dP){if(Object.prototype.hasOwnProperty.call(dP,dO)&&/^dimension\d+$/.test(dO)){var dy=dO.replace("dimension","");dT.push(parseInt(dy,10));dT.push(String(dy));dv+="&"+dO+"="+t(dP[dO]);delete dP[dO]}}}if(dP&&D(dP)){dP=null}for(dO in cA){if(Object.prototype.hasOwnProperty.call(cA,dO)){dv+="&"+dO+"="+t(cA[dO])}}for(dO in bt){if(Object.prototype.hasOwnProperty.call(bt,dO)){var dE=(-1===P(dT,dO));if(dE){dv+="&dimension"+dO+"="+t(bt[dO])}}}if(dP){dv+="&data="+t(W.JSON.stringify(dP))}else{if(at){dv+="&data="+t(W.JSON.stringify(at))}}function dB(dW,dX){var dY=W.JSON.stringify(dW);if(dY.length>2){return"&"+dX+"="+t(dY)}return""}var dS=ds(b2);var dK=ds(cs);dv+=dB(dS,"cvar");dv+=dB(dK,"e_cvar");if(aV){dv+=dB(aV,"_cvar");for(dO in dL){if(Object.prototype.hasOwnProperty.call(dL,dO)){if(aV[dO][0]===""||aV[dO][1]===""){delete aV[dO]}}}if(bW){dn(dG,W.JSON.stringify(aV),cu,bw,c7,bY,aN) }}if(a8&&bL&&!bn){dv=aE(dv);bn=true}if(aQ){dv+="&pv_id="+aQ}aR(dI);ci();dv+=ag(dQ,{tracker:bP,request:dv});if(c9.length){dv+="&"+c9}if(C(ch)){dv=ch(dv)}return dv}bX=function bd(){var dt=new Date();dt=dt.getTime();if(!c8){return false}if(c8+bb<=dt){bP.ping();return true}return false};function bx(dw,dv,dA,dx,dt,dD){var dz="idgoal=0",du=new Date(),dB=[],dC,dy=String(dw).length;if(dy){dz+="&ec_id="+t(dw)}dz+="&revenue="+dv;if(String(dA).length){dz+="&ec_st="+dA}if(String(dx).length){dz+="&ec_tx="+dx}if(String(dt).length){dz+="&ec_sh="+dt}if(String(dD).length){dz+="&ec_dt="+dD}if(da){for(dC in da){if(Object.prototype.hasOwnProperty.call(da,dC)){if(!M(da[dC][1])){da[dC][1]=""}if(!M(da[dC][2])){da[dC][2]=""}if(!M(da[dC][3])||String(da[dC][3]).length===0){da[dC][3]=0}if(!M(da[dC][4])||String(da[dC][4]).length===0){da[dC][4]=1}dB.push(da[dC])}}dz+="&ec_items="+t(W.JSON.stringify(dB))}dz=cy(dz,at,"ecommerce");bM(dz,bQ);if(dy){da={}}}function b4(dt,dx,dw,dv,du,dy){if(String(dt).length&&M(dx)){bx(dt,dx,dw,dv,du,dy) }}function bz(dt){if(M(dt)){bx("",dt,"","","","")}}function b6(du,dw,dv){if(!bH){aQ=bm()}var dt=cy("action_name="+t(ap(du||bp)),dw,"log");if(a8&&!bn){dt=aE(dt)}bM(dt,bQ,dv)}function a6(dv,du){var dw,dt="(^| )(piwik[_-]"+du+"|matomo[_-]"+du;if(dv){for(dw=0;dw<dv.length;dw++){dt+="|"+dv[dw]}}dt+=")( |$)";return new RegExp(dt)}function aZ(dt){return(aI&&dt&&0===String(dt).indexOf(aI))}function cC(dx,dt,dy,du){if(aZ(dt)){return 0}var dw=a6(bR,"download"),dv=a6(be,"link"),dz=new RegExp("\\.("+dg.join("|")+")([?&#]|$)","i");if(dv.test(dx)){return"link"}if(du||dw.test(dx)||dz.test(dt)){return"download"}if(dy){return 0}return"link"}function ay(du){var dt;dt=du.parentNode;while(dt!==null&&M(dt)){if(ai.isLinkElement(du)){break}du=dt;dt=du.parentNode}return du}function dl(dy){dy=ay(dy);if(!ai.hasNodeAttribute(dy,"href")){return}if(!M(dy.href)){return}var dx=ai.getAttributeValueFromNode(dy,"href");var du=dy.pathname||cr(dy.href);var dz=dy.hostname||d(dy.href);var dA=dz.toLowerCase();var dv=dy.href.replace(dz,dA); |