From 7ba181beeb3979bcf5bf7788a776886b5794ca20 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Mon, 4 Nov 2019 13:49:00 +1300 Subject: Send queued requests less often (#15048) --- matomo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'matomo.js') diff --git a/matomo.js b/matomo.js index d3d035ca2f..e7bab7b24e 100644 --- a/matomo.js +++ b/matomo.js @@ -59,7 +59,7 @@ return false}var dc=co(cJ(dd,df,db,de),dh,"event");bA(dc,bE,dg)}function b3(db,d if(!dc||aQ(dc)){return}dc=k(dc,ar);var dd=bm();dc=F(dc,ar,dd);ac.setAnyAttribute(db,"href",dc)}function ax(de){var df=ac.getAttributeValueFromNode(de,"href");if(!df){return false}df=String(df);var dc=df.indexOf("//")===0||df.indexOf("http://")===0||df.indexOf("https://")===0;if(!dc){return false}var db=de.pathname||cg(de.href);var dd=(de.hostname||d(de.href)).toLowerCase();if(ao(dd,db)){if(!cB(cO,L(dd))){return true}return false}return false}function cA(db){var dc=c5(db);if(dc&&dc.type){dc.href=p(dc.href);cV(dc.href,dc.type,undefined,null,db);return}if(cH){db=aq(db);if(ax(db)){ce(db)}}}function cr(){return G.all&&!G.addEventListener}function cP(db){var dd=db.which;var dc=(typeof db.button);if(!dd&&dc!=="undefined"){if(cr()){if(db.button&1){dd=1}else{if(db.button&2){dd=3}else{if(db.button&4){dd=2}}}}else{if(db.button===0||db.button==="0"){dd=1}else{if(db.button&1){dd=2}else{if(db.button&2){dd=3}}}}}return dd}function bO(db){switch(cP(db)){case 1:return"left";case 2:return"middle";case 3:return"right" }}function aX(db){return db.target||db.srcElement}function ay(db){return function(de){de=de||T.event;var dd=bO(de);var df=aX(de);if(de.type==="click"){var dc=false;if(db&&dd==="middle"){dc=true}if(df&&!dc){cA(df)}}else{if(de.type==="mousedown"){if(dd==="middle"&&df){aN=dd;bv=df}else{aN=bv=null}}else{if(de.type==="mouseup"){if(dd===aN&&df===bv){cA(df)}aN=bv=null}else{if(de.type==="contextmenu"){cA(df)}}}}}}function an(dd,dc){var db=typeof dc;if(db==="undefined"){dc=true}ak(dd,"click",ay(dc),false);if(dc){ak(dd,"mouseup",ay(dc),false);ak(dd,"mousedown",ay(dc),false);ak(dd,"contextmenu",ay(dc),false)}}function by(dd,df){am=true;var de,dc=aW(bu,"ignore"),dg=G.links,db=null,dh=null;if(dg){for(de=0;de0){df=parseInt(df,10);di(df)}})}function cz(){var dc,de,df={pdf:"application/pdf",qt:"video/quicktime",realp:"audio/x-pn-realaudio-plugin",wma:"application/x-mplayer2",dir:"application/x-director",fla:"application/x-shockwave-flash",java:"application/x-java-vm",gears:"application/x-googlegears",ag:"application/x-silverlight"};if(!((new RegExp("MSIE")).test(h.userAgent))){if(h.mimeTypes&&h.mimeTypes.length){for(dc in df){if(Object.prototype.hasOwnProperty.call(df,dc)){de=h.mimeTypes[df[dc]];c1[dc]=(de&&de.enabledPlugin)?"1":"0"}}}if(!((new RegExp("Edge[ /](\\d+[\\.\\d]+)")).test(h.userAgent))&&typeof navigator.javaEnabled!=="unknown"&&J(h.javaEnabled)&&h.javaEnabled()){c1.java="1" -}if(A(T.GearsFactory)){c1.gears="1"}c1.cookie=b0()}var dd=parseInt(X.width,10);var db=parseInt(X.height,10);c1.res=parseInt(dd,10)+"x"+parseInt(db,10)}var bx={enabled:true,requests:[],timeout:null,sendRequests:function(){var db=this.requests;this.requests=[];if(db.length===1){bA(db[0],bE)}else{c7(db,bE)}},push:function(db){if(!db){return}if(m||!this.enabled){bA(db,bE);return}bx.requests.push(db);if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.timeout=setTimeout(function(){bx.timeout=null;bx.sendRequests()},1750);var dc="RequestQueue"+at;if(!Object.prototype.hasOwnProperty.call(b,dc)){b[dc]={unload:function(){if(bx.timeout){clearTimeout(bx.timeout)}bx.sendRequests()}}}}};cz();bd();aI();this.getVisitorId=function(){return aU().uuid};this.getVisitorInfo=function(){return cI()};this.getAttributionInfo=function(){return bH()};this.getAttributionCampaignName=function(){return bH()[0]};this.getAttributionCampaignKeyword=function(){return bH()[1]};this.getAttributionReferrerTimestamp=function(){return bH()[2] +}if(A(T.GearsFactory)){c1.gears="1"}c1.cookie=b0()}var dd=parseInt(X.width,10);var db=parseInt(X.height,10);c1.res=parseInt(dd,10)+"x"+parseInt(db,10)}var bx={enabled:true,requests:[],timeout:null,interval:2500,sendRequests:function(){var db=this.requests;this.requests=[];if(db.length===1){bA(db[0],bE)}else{c7(db,bE)}},push:function(db){if(!db){return}if(m||!this.enabled){bA(db,bE);return}bx.requests.push(db);if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.timeout=setTimeout(function(){bx.timeout=null;bx.sendRequests()},bx.interval);var dc="RequestQueue"+at;if(!Object.prototype.hasOwnProperty.call(b,dc)){b[dc]={unload:function(){if(bx.timeout){clearTimeout(bx.timeout)}bx.sendRequests()}}}}};cz();bd();aI();this.getVisitorId=function(){return aU().uuid};this.getVisitorInfo=function(){return cI()};this.getAttributionInfo=function(){return bH()};this.getAttributionCampaignName=function(){return bH()[0]};this.getAttributionCampaignKeyword=function(){return bH()[1]};this.getAttributionReferrerTimestamp=function(){return bH()[2] };this.getAttributionReferrerUrl=function(){return bH()[3]};this.setTrackerUrl=function(db){aA=db};this.getTrackerUrl=function(){return aA};this.getPiwikUrl=function(){return O(this.getTrackerUrl(),bC)};this.addTracker=function(db,dd){if(!J(db)||null===db){db=this.getTrackerUrl()}var dc=new Q(db,dd);I.push(dc);e.trigger("TrackerAdded",[this]);return dc};this.getSiteId=function(){return b1};this.setSiteId=function(db){bY(db)};this.resetUserId=function(){bt=""};this.setUserId=function(db){if(!J(db)||!db.length){return}bt=db};this.getUserId=function(){return bt};this.setCustomData=function(db,dc){if(W(db)){al=db}else{if(!al){al={}}al[db]=dc}};this.getCustomData=function(){return al};this.setCustomRequestProcessing=function(db){b6=db};this.appendToTrackingUrl=function(db){cT=db};this.getRequest=function(db){return co(db)};this.addPlugin=function(db,dc){b[db]=dc};this.setCustomDimension=function(db,dc){db=parseInt(db,10);if(db>0){if(!J(dc)){dc=""}if(!w(dc)){dc=String(dc)}bh[db]=dc}};this.getCustomDimension=function(db){db=parseInt(db,10); if(db>0&&Object.prototype.hasOwnProperty.call(bh,db)){return bh[db]}};this.deleteCustomDimension=function(db){db=parseInt(db,10);if(db>0){delete bh[db]}};this.setCustomVariable=function(dc,db,df,dd){var de;if(!J(dd)){dd="visit"}if(!J(db)){return}if(!J(df)){df=""}if(dc>0){db=!w(db)?String(db):db;df=!w(df)?String(df):df;de=[db.slice(0,bo),df.slice(0,bo)];if(dd==="visit"||dd===2){cy();aM[dc]=de}else{if(dd==="page"||dd===3){bR[dc]=de}else{if(dd==="event"){ch[dc]=de}}}}};this.getCustomVariable=function(dc,dd){var db;if(!J(dd)){dd="visit"}if(dd==="page"||dd===3){db=bR[dc]}else{if(dd==="event"){db=ch[dc]}else{if(dd==="visit"||dd===2){cy();db=aM[dc]}}}if(!J(db)||(db&&db[0]==="")){return false}return db};this.deleteCustomVariable=function(db,dc){if(this.getCustomVariable(db,dc)){this.setCustomVariable(db,"","",dc)}};this.deleteCustomVariables=function(db){if(db==="page"||db===3){bR={}}else{if(db==="event"){ch={}}else{if(db==="visit"||db===2){aM={}}}}};this.storeCustomVariablesInCookie=function(){bL=true };this.setLinkTrackingTimer=function(db){bE=db};this.getLinkTrackingTimer=function(){return bE};this.setDownloadExtensions=function(db){if(w(db)){db=db.split("|")}c0=db};this.addDownloadExtensions=function(dc){var db;if(w(dc)){dc=dc.split("|")}for(db=0;db1&&am!=="addTracker"){ah("The method "+am+' 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') +};this.trackEcommerceCartUpdate=function(db){bn(db)};this.trackRequest=function(dc,de,dd,db){cc(function(){var df=co(dc,de,db);bA(df,bE,dd)})};this.ping=function(){this.trackRequest("ping=1",null,null,"ping")};this.disableQueueRequest=function(){bx.enabled=false};this.setRequestQueueInterval=function(db){if(db<1000){throw new Error("Request queue interval needs to be at least 1000ms")}bx.interval=db};this.queueRequest=function(db){cc(function(){var dc=co(db);bx.push(dc)})};this.getRememberedConsent=function(){var db=az(a9);if(az(cG)){if(db){bT(a9,bk,cR)}return null}if(!db||db===0){return null}return db};this.hasRememberedConsent=function(){return !!this.getRememberedConsent()};this.requireConsent=function(){cv=true;bw=this.hasRememberedConsent();x++;b["CoreConsent"+x]={unload:function(){if(!bw){aB()}}}};this.setConsentGiven=function(){bw=true;bT(cG,bk,cR);var dc,db;for(dc=0;dc1&&am!=="addTracker"){ah("The method "+am+' 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') }ar[am]++}}}}return aq}var C=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCrossDomainLinkingTimeout","setSessionCookieTimeout","setVisitorCookieTimeout","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","alwaysUseSendBeacon","enableLinkTracking","requireConsent","setConsentGiven"];function ab(al,an){var am=new Q(al,an);I.push(am);_paq=c(_paq,C);for(E=0;E<_paq.length;E++){if(_paq[E]){ad(_paq[E])}}_paq=new H();e.trigger("TrackerAdded",[am]);return am}ak(T,"beforeunload",af,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(ao,an,am,al){var ap=typeof al;if(ap==="undefined"){al=false}ak(ao,an,am,al)},onLoad:n,onReady:q,isNodeVisible:j,isOrWasNodeVisible:v.isNodeVisible},on:function(am,al){if(!y[am]){y[am]=[]}y[am].push(al)},off:function(an,am){if(!y[an]){return}var al=0;for(al;al