Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMichaelHeerklotz <michael.heerklotz@web.de>2019-07-17 07:13:56 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-07-17 07:13:56 +0300
commit4596f59b79788993a16b1836be1881d0943cbb38 (patch)
treea4f2ed05803d2a696ecafcdb94d314e6db4f3217 /js
parent6411472b183195162d3dbfa8b7e649bcaba812ba (diff)
Fix missing 3rd party cookie when using POST requests (#14368)
* Fix missing 3rd party cookie when using POST requests * fix test * jslint fix * Update piwik.min.js * Update matomo.js * Update piwik.js
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js4
-rw-r--r--js/piwik.min.js8
2 files changed, 7 insertions, 5 deletions
diff --git a/js/piwik.js b/js/piwik.js
index c6bb15fe92..c06fc4b20c 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -1031,7 +1031,7 @@ if (typeof JSON_PIWIK !== 'object' && typeof window.JSON === 'object' && window.
"", "\b", "\t", "\n", "\f", "\r", "\"", "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace,
sort, slice, stringify, test, toJSON, toString, valueOf, objectToJSON, addTracker, removeAllAsyncTrackersButFirst,
- optUserOut, forgetUserOptOut, isUserOptedOut
+ optUserOut, forgetUserOptOut, isUserOptedOut, withCredentials
*/
/*global _paq:true */
/*members push */
@@ -3635,6 +3635,8 @@ if (typeof window.Piwik !== 'object') {
xhr.setRequestHeader('Content-Type', configRequestContentType);
+ xhr.withCredentials = true;
+
xhr.send(request);
} catch (e) {
sentViaBeacon = isPageUnloading && sendPostRequestViaSendBeacon(request, callback);
diff --git a/js/piwik.min.js b/js/piwik.min.js
index b5eb529942..4b3f5ab21e 100644
--- a/js/piwik.min.js
+++ b/js/piwik.min.js
@@ -42,9 +42,9 @@ if(ap!==String(ar)){return false}var aq=an[2],al=an[3],ao=an[4];if(!ao){ao=""}el
try{be=G.title}catch(ct){be=""}function c6(dh,df,de,dg,dd,dc){if(bg){return}var db;if(de){db=new Date();db.setTime(db.getTime()+de)}G.cookie=dh+"="+t(df)+(de?";expires="+db.toGMTString():"")+";path="+(dg||"/")+(dd?";domain="+dd:"")+(dc?";secure":"")}function az(dd){if(bg){return 0}var db=new RegExp("(^|;)[ ]*"+dd+"=([^;]*)"),dc=db.exec(G.cookie);return dc?S(dc[2]):0}bw=!az(cG);function bX(db){var dc;db=k(db,ar);if(bK){dc=new RegExp("#.*");return db.replace(dc,"")}return db}function bQ(dd,db){var de=s(db),dc;if(de){return db}if(db.slice(0,1)==="/"){return s(dd)+"://"+d(dd)+db}dd=bX(dd);dc=dd.indexOf("?");if(dc>=0){dd=dd.slice(0,dc)}dc=dd.lastIndexOf("/");if(dc!==dd.length-1){dd=dd.slice(0,dc+1)}return dd+db}function cB(dd,db){var dc;dd=String(dd).toLowerCase();db=String(db).toLowerCase();if(dd===db){return true}if(db.slice(0,1)==="."){if(dd===db.slice(1)){return true}dc=dd.length-db.length;if((dc>0)&&(dd.slice(dc)===db)){return true}}return false}function cg(db){var dc=document.createElement("a");
if(db.indexOf("//")!==0&&db.indexOf("http")!==0){if(db.indexOf("*")===0){db=db.substr(1)}if(db.indexOf(".")===0){db=db.substr(1)}db="http://"+db}dc.href=v.toAbsoluteUrl(db);if(dc.pathname){return dc.pathname}return""}function aZ(dc,db){if(!ag(db,"/")){db="/"+db}if(!ag(dc,"/")){dc="/"+dc}var dd=(db==="/"||db==="/*");if(dd){return true}if(dc===db){return true}db=String(db).toLowerCase();dc=String(dc).toLowerCase();if(R(db,"*")){db=db.slice(0,-1);dd=(!db||db==="/");if(dd){return true}if(dc===db){return true}return dc.indexOf(db)===0}if(!R(dc,"/")){dc+="/"}if(!R(db,"/")){db+="/"}return dc.indexOf(db)===0}function ao(df,dh){var dc,db,dd,de,dg;for(dc=0;dc<au.length;dc++){de=L(au[dc]);dg=cg(au[dc]);if(cB(df,de)&&aZ(dh,dg)){return true}}return false}function aR(de){var dc,db,dd;for(dc=0;dc<au.length;dc++){db=L(au[dc].toLowerCase());if(de===db){return true}if(db.slice(0,1)==="."){if(de===db.slice(1)){return true}dd=de.length-db.length;if((dd>0)&&(de.slice(dd)===db)){return true}}}return false}function cl(db,dd){db=db.replace("send_image=0","send_image=1");
var dc=new Image(1,1);dc.onload=function(){E=0;if(typeof dd==="function"){dd({request:db,trackerUrl:aA,success:true})}};dc.onerror=function(){if(typeof dd==="function"){dd({request:db,trackerUrl:aA,success:false})}};dc.src=aA+(aA.indexOf("?")<0?"?":"&")+db}function aG(){return"object"===typeof h&&"function"===typeof h.sendBeacon&&"function"===typeof Blob}function a2(de,di){var dd=aG();if(!dd){return false}var dh={type:"application/x-www-form-urlencoded; charset=UTF-8"};var dg=false;var dc=aA;try{var db=new Blob([de],dh);if(de.length<=2000){db=new Blob([],dh);dc=dc+(dc.indexOf("?")<0?"?":"&")+de}dg=h.sendBeacon(dc,db)}catch(df){return false}if(dg&&typeof di==="function"){di({request:de,trackerUrl:aA,success:true,isSendBeacon:true})}return dg}function cY(dc,dd,db){if(!J(db)||null===db){db=true}if(m&&a2(dc,dd)){return}setTimeout(function(){if(m&&a2(dc,dd)){return}var dg;try{var df=T.XMLHttpRequest?new T.XMLHttpRequest():T.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;df.open("POST",aA,true);
-df.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)){var dh=m&&a2(dc,dd);if(!dh&&db){cl(dc,dd)}else{if(typeof dd==="function"){dd({request:dc,trackerUrl:aA,success:false,xhr:this})}}}else{if(this.readyState===4&&(typeof dd==="function")){dd({request:dc,trackerUrl:aA,success:true,xhr:this})}}};df.setRequestHeader("Content-Type",cs);df.send(dc)}catch(de){dg=m&&a2(dc,dd);if(!dg&&db){cl(dc,dd)}else{if(typeof dd==="function"){dd({request:dc,trackerUrl:aA,success:false})}}}},50)}function cb(dc){var db=new Date();var dd=db.getTime()+dc;if(!r||dd>r){r=dd}}function cj(db){if(b7||!a1||!bw){return}b7=setTimeout(function dc(){b7=null;if(!a8){a8=(!G.hasFocus||G.hasFocus())}if(!a8){cj(a1);return}if(bM()){return}var dd=new Date(),de=a1-(dd.getTime()-cS);de=Math.min(a1,de);cj(de)},db||a1)}function bF(){if(!b7){return}clearTimeout(b7);b7=null}function a6(){a8=true;if(bM()){return}cj()}function av(){bF()}function c8(){if(aK||!a1){return}aK=true;ak(T,"focus",a6);ak(T,"blur",av);
-cj()}function cx(df){var dc=new Date();var db=dc.getTime();cS=db;if(cw&&db<cw){var dd=cw-db;setTimeout(df,dd);cb(dd+50);cw+=50;return}if(cw===false){var de=800;cw=db+de}df()}function bA(dc,db,dd){if(!bw){cE.push(dc);return}if(!cK&&dc){if(cv&&bw){dc+="&consent=1"}cx(function(){if(cQ&&a2(dc,dd)){cb(100);return}if(c3==="POST"||String(dc).length>2000){cY(dc,dd)}else{cl(dc,dd)}cb(db)})}if(!aK){c8()}else{cj()}}function cf(db){if(cK){return false}return(db&&db.length)}function cX(db,df){if(!df||df>=db.length){return[db]}var dc=0;var dd=db.length;var de=[];for(dc;dc<dd;dc+=df){de.push(db.slice(dc,dc+df))}return de}function c7(dc,db){if(!cf(dc)){return}if(!bw){cE.push(dc);return}cx(function(){var df=cX(dc,50);var dd=0,de;for(dd;dd<df.length;dd++){de='{"requests":["?'+df[dd].join('","?')+'"]}';cY(de,null,false)}cb(db)})}function aP(db){return bf+db+"."+b1+"."+bj}function b0(){if(bg){return"0"}if(!J(h.cookieEnabled)){var db=aP("testcookie");c6(db,"1");return az(db)==="1"?"1":"0"}return h.cookieEnabled?"1":"0"
-}function bd(){bj=b2((cR||cO)+(bk||"/")).slice(0,4)}function bS(){var dc=aP("cvar"),db=az(dc);if(db.length){db=JSON_PIWIK.parse(db);if(W(db)){return db}}return{}}function cy(){if(aM===false){aM=bS()}}function cL(){return b2((h.userAgent||"")+(h.platform||"")+JSON_PIWIK.stringify(c1)+(new Date()).getTime()+Math.random()).slice(0,16)}function aw(){return b2((h.userAgent||"")+(h.platform||"")+JSON_PIWIK.stringify(c1)).slice(0,6)}function bb(){return Math.floor((new Date()).getTime()/1000)}function aF(){var dc=bb();var dd=aw();var db=String(dc)+dd;return db}function cW(dd){dd=String(dd);var dg=aw();var de=dg.length;var df=dd.substr(-1*de,de);var dc=parseInt(dd.substr(0,dd.length-de),10);if(dc&&df&&df===dg){var db=bb();if(aV<=0){return true}if(db>=dc&&db<=(dc+aV)){return true}}return false}function c9(db){if(!cH){return""}var df=f(db,ar);if(!df){return""}df=String(df);var dd=new RegExp("^[a-zA-Z0-9]+$");if(df.length===32&&dd.test(df)){var dc=df.substr(16,32);if(cW(dc)){var de=df.substr(0,16);
+df.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)){var dh=m&&a2(dc,dd);if(!dh&&db){cl(dc,dd)}else{if(typeof dd==="function"){dd({request:dc,trackerUrl:aA,success:false,xhr:this})}}}else{if(this.readyState===4&&(typeof dd==="function")){dd({request:dc,trackerUrl:aA,success:true,xhr:this})}}};df.setRequestHeader("Content-Type",cs);df.withCredentials=true;df.send(dc)}catch(de){dg=m&&a2(dc,dd);if(!dg&&db){cl(dc,dd)}else{if(typeof dd==="function"){dd({request:dc,trackerUrl:aA,success:false})}}}},50)}function cb(dc){var db=new Date();var dd=db.getTime()+dc;if(!r||dd>r){r=dd}}function cj(db){if(b7||!a1||!bw){return}b7=setTimeout(function dc(){b7=null;if(!a8){a8=(!G.hasFocus||G.hasFocus())}if(!a8){cj(a1);return}if(bM()){return}var dd=new Date(),de=a1-(dd.getTime()-cS);de=Math.min(a1,de);cj(de)},db||a1)}function bF(){if(!b7){return}clearTimeout(b7);b7=null}function a6(){a8=true;if(bM()){return}cj()}function av(){bF()}function c8(){if(aK||!a1){return}aK=true;
+ak(T,"focus",a6);ak(T,"blur",av);cj()}function cx(df){var dc=new Date();var db=dc.getTime();cS=db;if(cw&&db<cw){var dd=cw-db;setTimeout(df,dd);cb(dd+50);cw+=50;return}if(cw===false){var de=800;cw=db+de}df()}function bA(dc,db,dd){if(!bw){cE.push(dc);return}if(!cK&&dc){if(cv&&bw){dc+="&consent=1"}cx(function(){if(cQ&&a2(dc,dd)){cb(100);return}if(c3==="POST"||String(dc).length>2000){cY(dc,dd)}else{cl(dc,dd)}cb(db)})}if(!aK){c8()}else{cj()}}function cf(db){if(cK){return false}return(db&&db.length)}function cX(db,df){if(!df||df>=db.length){return[db]}var dc=0;var dd=db.length;var de=[];for(dc;dc<dd;dc+=df){de.push(db.slice(dc,dc+df))}return de}function c7(dc,db){if(!cf(dc)){return}if(!bw){cE.push(dc);return}cx(function(){var df=cX(dc,50);var dd=0,de;for(dd;dd<df.length;dd++){de='{"requests":["?'+df[dd].join('","?')+'"]}';cY(de,null,false)}cb(db)})}function aP(db){return bf+db+"."+b1+"."+bj}function b0(){if(bg){return"0"}if(!J(h.cookieEnabled)){var db=aP("testcookie");c6(db,"1");return az(db)==="1"?"1":"0"
+}return h.cookieEnabled?"1":"0"}function bd(){bj=b2((cR||cO)+(bk||"/")).slice(0,4)}function bS(){var dc=aP("cvar"),db=az(dc);if(db.length){db=JSON_PIWIK.parse(db);if(W(db)){return db}}return{}}function cy(){if(aM===false){aM=bS()}}function cL(){return b2((h.userAgent||"")+(h.platform||"")+JSON_PIWIK.stringify(c1)+(new Date()).getTime()+Math.random()).slice(0,16)}function aw(){return b2((h.userAgent||"")+(h.platform||"")+JSON_PIWIK.stringify(c1)).slice(0,6)}function bb(){return Math.floor((new Date()).getTime()/1000)}function aF(){var dc=bb();var dd=aw();var db=String(dc)+dd;return db}function cW(dd){dd=String(dd);var dg=aw();var de=dg.length;var df=dd.substr(-1*de,de);var dc=parseInt(dd.substr(0,dd.length-de),10);if(dc&&df&&df===dg){var db=bb();if(aV<=0){return true}if(db>=dc&&db<=(dc+aV)){return true}}return false}function c9(db){if(!cH){return""}var df=f(db,ar);if(!df){return""}df=String(df);var dd=new RegExp("^[a-zA-Z0-9]+$");if(df.length===32&&dd.test(df)){var dc=df.substr(16,32);if(cW(dc)){var de=df.substr(0,16);
return de}}return""}function cI(){if(!bJ){bJ=c9(bI)}var dd=new Date(),db=Math.round(dd.getTime()/1000),dc=aP("id"),dg=az(dc),df,de;if(dg){df=dg.split(".");df.unshift("0");if(bJ.length){df[1]=bJ}return df}if(bJ.length){de=bJ}else{if("0"===b0()){de=""}else{de=cL()}}df=["1",de,db,0,db,"",""];return df}function aU(){var di=cI(),de=di[0],df=di[1],dc=di[2],db=di[3],dg=di[4],dd=di[5];if(!J(di[6])){di[6]=""}var dh=di[6];return{newVisitor:de,uuid:df,createTs:dc,visitCount:db,currentVisitTs:dg,lastVisitTs:dd,lastEcommerceOrderTs:dh}}function aD(){var de=new Date(),dc=de.getTime(),df=aU().createTs;var db=parseInt(df,10);var dd=(db*1000)+cD-dc;return dd}function aI(db){if(!b1){return}var dd=new Date(),dc=Math.round(dd.getTime()/1000);if(!J(db)){db=aU()}var de=db.uuid+"."+db.createTs+"."+db.visitCount+"."+dc+"."+db.lastVisitTs+"."+db.lastEcommerceOrderTs;c6(aP("id"),de,aD(),bk,cR,bN)}function bH(){var db=az(aP("ref"));if(db.length){try{db=JSON_PIWIK.parse(db);if(W(db)){return db}}catch(dc){}}return["","",0,""]
}function bT(dd,dc,db){c6(dd,"",-86400,dc,db)}function br(dc){var db="testvalue";c6("test",db,10000,null,dc);if(az("test")===db){bT("test",null,dc);return true}return false}function aB(){var dc=bg;bg=false;var db,dd;for(db=0;db<bp.length;db++){dd=aP(bp[db]);if(dd!==cG&&dd!==a9&&0!==az(dd)){bT(dd,bk,cR)}}bg=dc}function bY(db){b1=db;aI()}function da(df){if(!df||!W(df)){return}var de=[];var dd;for(dd in df){if(Object.prototype.hasOwnProperty.call(df,dd)){de.push(dd)}}var dg={};de.sort();var db=de.length;var dc;for(dc=0;dc<db;dc++){dg[de[dc]]=df[de[dc]]}return dg}function b8(){c6(aP("ses"),"1",ck,bk,cR,bN)}function bc(){var de="";var dc="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";var dd=dc.length;var db;for(db=0;db<6;db++){de+=dc.charAt(Math.floor(Math.random()*dd))}return de}function co(dd,dz,dA,de){var dy,dc=new Date(),dl=Math.round(dc.getTime()/1000),di,dx,df=1024,dF,dm,dv=aM,dg=aP("ses"),dt=aP("ref"),dq=aP("cvar"),dr=az(dg),dw=bH(),dC=a0||bI,dj,db;if(bg){aB()}if(cK){return""
}var ds=aU();if(!J(de)){de=""}var dp=G.characterSet||G.charset;if(!dp||dp.toLowerCase()==="utf-8"){dp=null}dj=dw[0];db=dw[1];di=dw[2];dx=dw[3];if(!dr){var dB=ck/1000;if(!ds.lastVisitTs||(dl-ds.lastVisitTs)>dB){ds.visitCount++;ds.lastVisitTs=ds.currentVisitTs}if(!bq||!dj.length){for(dy in cm){if(Object.prototype.hasOwnProperty.call(cm,dy)){dj=f(dC,cm[dy]);if(dj.length){break}}}for(dy in bB){if(Object.prototype.hasOwnProperty.call(bB,dy)){db=f(dC,bB[dy]);if(db.length){break}}}}dF=d(bi);dm=dx.length?d(dx):"";if(dF.length&&!aR(dF)&&(!bq||!dm.length||aR(dm))){dx=bi}if(dx.length||dj.length){di=dl;dw=[dj,db,di,bX(dx.slice(0,df))];c6(dt,JSON_PIWIK.stringify(dw),cZ,bk,cR)}}dd+="&idsite="+b1+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+dc.getHours()+"&m="+dc.getMinutes()+"&s="+dc.getSeconds()+"&url="+t(bX(dC))+(bi.length?"&urlref="+t(bX(bi)):"")+((bt&&bt.length)?"&uid="+t(bt):"")+"&_id="+ds.uuid+"&_idts="+ds.createTs+"&_idvc="+ds.visitCount+"&_idn="+ds.newVisitor+(dj.length?"&_rcn="+t(dj):"")+(db.length?"&_rck="+t(db):"")+"&_refts="+di+"&_viewts="+ds.lastVisitTs+(String(ds.lastEcommerceOrderTs).length?"&_ects="+ds.lastEcommerceOrderTs:"")+(String(dx).length?"&_ref="+t(bX(dx.slice(0,df))):"")+(dp?"&cs="+t(dp):"")+"&send_image=0";
@@ -76,4 +76,4 @@ for(al;al<y[an].length;al++){y[an][al].apply(am||T,ao)}},addPlugin:function(al,a
(function(){function b(){if("object"!==typeof _paq){return false
}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.piwikPluginAsyncInit&&window.piwikPluginAsyncInit.length){var a=0;for(a;a<window.piwikPluginAsyncInit.length;a++){if(typeof window.piwikPluginAsyncInit[a]==="function"){window.piwikPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(!window.Piwik.getAsyncTrackers().length){if(b()){window.Piwik.addTracker()}else{_paq={push:function(c){var d=typeof console;if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded. Make sure to configure the tracker via _paq.push before loading matomo.js. Alternatively, you can create a tracker via Matomo.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Piwik.trigger("PiwikInitialized",[]);window.Piwik.initialized=true
}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.Piwik}}());if(typeof piwik_log!=="function"){piwik_log=function(b,f,d,g){function a(h){try{if(window["piwik_"+h]){return window["piwik_"+h]}}catch(i){}return}var c,e=window.Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}}}
-/*!! @license-end */; \ No newline at end of file
+/*!! @license-end */;