From 96f9c8a5c1c85b87dee250f6c957815616766ad4 Mon Sep 17 00:00:00 2001 From: Justin Velluppillai Date: Thu, 15 Jul 2021 14:55:17 +1200 Subject: 17417 cookie domain (#17744) * Handle failed promise by silently ignoring it * rebuilt piwik.js * Remove unnecessary check for .ready - if serviceWorker exists it should be there anyway * Set cookie domain even if cookies are disabled; log console errors for issues setting cookies * rebuilt piwik.js * Added tests * Fixed js tests by modifying expected number of asserts * Fixed JSLint issues * rebuilt piwik.js * Don't unset cookie domain at end of test * Reorder get and set cookie functions to fix jslint issue * rebuilt piwik.js * JSLint error from missing ; Co-authored-by: tsteur Co-authored-by: justinvelluppillai --- matomo.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'matomo.js') diff --git a/matomo.js b/matomo.js index 582d913424..8b52baecab 100644 --- a/matomo.js +++ b/matomo.js @@ -30,12 +30,12 @@ ao=ae.findFirstNodeHavingAttribute(ap,this.CONTENT_PIECE_ATTR);if(!ao){ao=ae.fin }if(0===ap.search("^[a-zA-Z]{2,11}:")){return ap}if(ap.search(/^\//)!==-1){return this.getLocation().origin+ap}var ao="(.*/)";var aq=this.getLocation().origin+this.getLocation().pathname.match(new RegExp(ao))[0];return aq+ap},isUrlToCurrentDomain:function(ap){var aq=this.toAbsoluteUrl(ap);if(!aq){return false}var ao=this.getLocation().origin;if(ao===aq){return true}if(0===String(aq).indexOf(ao)){if(":"===String(aq).substr(ao.length,1)){return false}return true}return false},setHrefAttribute:function(ap,ao){if(!ap||!ao){return}ae.setAnyAttribute(ap,"href",ao)},shouldIgnoreInteraction:function(ao){if(ae.hasNodeAttribute(ao,this.CONTENT_IGNOREINTERACTION_ATTR)){return true}if(ae.hasNodeCssClass(ao,this.CONTENT_IGNOREINTERACTION_CLASS)){return true}if(ae.hasNodeCssClass(ao,this.LEGACY_CONTENT_IGNOREINTERACTION_CLASS)){return true}return false}};function W(ap,at){if(at){return at}ap=v.toAbsoluteUrl(ap);if(z(ap,"?")){var ar=ap.indexOf("?");ap=ap.slice(0,ar)}if(Q(ap,"matomo.php")){ap=f(ap,"matomo.php".length) }else{if(Q(ap,"piwik.php")){ap=f(ap,"piwik.php".length)}else{if(Q(ap,".php")){var ao=ap.lastIndexOf("/");var aq=1;ap=ap.slice(0,ao+aq)}}}if(Q(ap,"/js/")){ap=f(ap,"js/".length)}return ap}function N(av){var ax="Matomo_Overlay";var ap=new RegExp("index\\.php\\?module=Overlay&action=startOverlaySession&idSite=([0-9]+)&period=([^&]+)&date=([^&]+)(&segment=[^&]*)?");var aq=ap.exec(G.referrer);if(aq){var at=aq[1];if(at!==String(av)){return false}var au=aq[2],ao=aq[3],ar=aq[4];if(!ar){ar=""}else{if(ar.indexOf("&segment=")===0){ar=ar.substr("&segment=".length)}}S.name=ax+"###"+au+"###"+ao+"###"+ar}var aw=S.name.split("###");return aw.length===4&&aw[0]===ax}function Z(ap,av,aq){var au=S.name.split("###"),at=au[1],ao=au[2],ar=au[3],aw=W(ap,av);n(aw+"plugins/Overlay/client/client.js?v=1",function(){Matomo_Overlay_Client.initialize(aw,aq,at,ao,ar)})}function u(){var aq;try{aq=S.frameElement}catch(ap){return true}if(J(aq)){return(aq&&String(aq.nodeName).toLowerCase()==="iframe")?true:false}try{return S.self!==S.top }catch(ao){return true}}function P(ce,ca){var bK=this,be="mtm_consent",cE="mtm_cookie_consent",cN="mtm_consent_removed",b5=aa(G.domain,S.location.href,K()),cV=L(b5[0]),bO=o(b5[1]),bp=o(b5[2]),cT=false,ci="GET",db=ci,aI="application/x-www-form-urlencoded; charset=UTF-8",cx=aI,aE=ce||"",bJ="",c1="",b7=ca||"",bA="",bP="",a5,bk="",c8=["7z","aac","apk","arc","arj","asf","asx","avi","azw3","bin","csv","deb","dmg","doc","docx","epub","exe","flv","gif","gz","gzip","hqx","ibooks","jar","jpg","jpeg","js","mobi","mp2","mp3","mp4","mpg","mpeg","mov","movie","msi","msp","odb","odf","odg","ods","odt","ogg","ogv","pdf","phps","png","ppt","pptx","qt","qtm","ra","ram","rar","rpm","rtf","sea","sit","tar","tbz","tbz2","bz","bz2","tgz","torrent","txt","wav","wma","wmv","wpd","xls","xlsx","xml","z","zip"],ay=[cV],bB=[],bM=[],a9=[],bL=500,cY=true,cK,a6,bS,bQ,ao,cp=["pk_campaign","mtm_campaign","piwik_campaign","matomo_campaign","utm_campaign","utm_source","utm_medium"],bI=["pk_kwd","mtm_kwd","piwik_kwd","matomo_kwd","utm_term"],bl="_pk_",av="pk_vid",a0=180,cZ,br,bT=false,aJ="Lax",bn=false,cR,bf,bx,cL=33955200000,cn=1800000,c7=15768000000,a3=true,bG=false,bi=false,bR=false,aR=false,cc,bX={},cm={},bo={},bv=200,ct={},c2={},c9={},cb=[],cf=false,cC=false,ap=false,da=false,cO=false,aO=false,bd=u(),cy=null,c0=null,aS,bD,b8=am,bq,aM,bC=false,cq=0,bw=["id","ses","cvar","ref"],cB=false,bE=null,cM=[],cs=[],ax=T++,aw=false; -try{bk=G.title}catch(cz){bk=""}function df(ds,dq,dp,dr,dn,dm,dl){if(bn&&ds!==cN){return}var dk;if(dp){dk=new Date();dk.setTime(dk.getTime()+dp)}if(!dl){dl="Lax"}G.cookie=ds+"="+s(dq)+(dp?";expires="+dk.toGMTString():"")+";path="+(dr||"/")+(dn?";domain="+dn:"")+(dm?";secure":"")+";SameSite="+dl}function aD(dm){if(bn){return 0}var dk=new RegExp("(^|;)[ ]*"+dm+"=([^;]*)"),dl=dk.exec(G.cookie);return dl?R(dl[2]):0}bE=!aD(cN);function b3(dk){var dl;dk=j(dk,av);if(bQ){dl=new RegExp("#.*");return dk.replace(dl,"")}return dk}function bW(dm,dk){var dn=r(dk),dl;if(dn){return dk}if(dk.slice(0,1)==="/"){return r(dm)+"://"+d(dm)+dk}dm=b3(dm);dl=dm.indexOf("?");if(dl>=0){dm=dm.slice(0,dl)}dl=dm.lastIndexOf("/");if(dl!==dm.length-1){dm=dm.slice(0,dl+1)}return dm+dk}function cI(dm,dk){var dl;dm=String(dm).toLowerCase();dk=String(dk).toLowerCase();if(dm===dk){return true}if(dk.slice(0,1)==="."){if(dm===dk.slice(1)){return true}dl=dm.length-dk.length;if((dl>0)&&(dm.slice(dl)===dk)){return true}}return false -}function cl(dk){var dl=document.createElement("a");if(dk.indexOf("//")!==0&&dk.indexOf("http")!==0){if(dk.indexOf("*")===0){dk=dk.substr(1)}if(dk.indexOf(".")===0){dk=dk.substr(1)}dk="http://"+dk}dl.href=v.toAbsoluteUrl(dk);if(dl.pathname){return dl.pathname}return""}function a4(dl,dk){if(!aj(dk,"/")){dk="/"+dk}if(!aj(dl,"/")){dl="/"+dl}var dm=(dk==="/"||dk==="/*");if(dm){return true}if(dl===dk){return true}dk=String(dk).toLowerCase();dl=String(dl).toLowerCase();if(Q(dk,"*")){dk=dk.slice(0,-1);dm=(!dk||dk==="/");if(dm){return true}if(dl===dk){return true}return dl.indexOf(dk)===0}if(!Q(dl,"/")){dl+="/"}if(!Q(dk,"/")){dk+="/"}return dl.indexOf(dk)===0}function ar(dp,dr){var dl,dk,dm,dn,dq;for(dl=0;dl0)&&(dn.slice(dm)===dk)){return true -}}}return false}function co(dk,dm){dk=dk.replace("send_image=0","send_image=1");var dl=new Image(1,1);dl.onload=function(){E=0;if(typeof dm==="function"){dm({request:dk,trackerUrl:aE,success:true})}};dl.onerror=function(){if(typeof dm==="function"){dm({request:dk,trackerUrl:aE,success:false})}};dl.src=aE+(aE.indexOf("?")<0?"?":"&")+dk}function cF(dk){if(db==="POST"){return true}return dk&&(dk.length>2000||dk.indexOf('{"requests"')===0)}function aL(){return"object"===typeof g&&"function"===typeof g.sendBeacon&&"function"===typeof Blob}function a7(dp,ds,dr){var dm=aL();if(!dm){return false}var dn={type:"application/x-www-form-urlencoded; charset=UTF-8"};var dt=false;var dl=aE;try{var dk=new Blob([dp],dn);if(dr&&!cF(dp)){dk=new Blob([],dn);dl=dl+(dl.indexOf("?")<0?"?":"&")+dp}dt=g.sendBeacon(dl,dk)}catch(dq){return false}if(dt&&typeof ds==="function"){ds({request:dp,trackerUrl:aE,success:true,isSendBeacon:true})}return dt}function c6(dl,dm,dk){if(!J(dk)||null===dk){dk=true}if(l&&a7(dl,dm,dk)){return -}setTimeout(function(){if(l&&a7(dl,dm,dk)){return}var dq;try{var dp=S.XMLHttpRequest?new S.XMLHttpRequest():S.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;dp.open("POST",aE,true);dp.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)){var dr=l&&a7(dl,dm,dk);if(!dr&&dk){co(dl,dm)}else{if(typeof dm==="function"){dm({request:dl,trackerUrl:aE,success:false,xhr:this})}}}else{if(this.readyState===4&&(typeof dm==="function")){dm({request:dl,trackerUrl:aE,success:true,xhr:this})}}};dp.setRequestHeader("Content-Type",cx);dp.withCredentials=true;dp.send(dl)}catch(dn){dq=l&&a7(dl,dm,dk);if(!dq&&dk){co(dl,dm)}else{if(typeof dm==="function"){dm({request:dl,trackerUrl:aE,success:false})}}}},50)}function cg(dl){var dk=new Date();var dm=dk.getTime()+dl;if(!q||dm>q){q=dm}}function bb(){bd=true;cy=new Date().getTime()}function de(){var dk=new Date().getTime();return !cy||(dk-cy)>a6}function az(){if(de()){bS()}}function dh(){if(aO||!a6){return}aO=true;an(S,"focus",bb); -an(S,"blur",az);ab++;t.addPlugin("HeartBeat"+ab,{unload:function(){if(aO&&de()){bS()}}})}function cD(dp){var dl=new Date();var dk=dl.getTime();c0=dk;if(cC&&dk=dk.length){return[dk]}var dl=0;var dm=dk.length;var dn=[];for(dl;dl=0){dm=dm.slice(0,dl)}dl=dm.lastIndexOf("/");if(dl!==dm.length-1){dm=dm.slice(0,dl+1)}return dm+dk}function cI(dm,dk){var dl;dm=String(dm).toLowerCase();dk=String(dk).toLowerCase();if(dm===dk){return true}if(dk.slice(0,1)==="."){if(dm===dk.slice(1)){return true +}dl=dm.length-dk.length;if((dl>0)&&(dm.slice(dl)===dk)){return true}}return false}function cl(dk){var dl=document.createElement("a");if(dk.indexOf("//")!==0&&dk.indexOf("http")!==0){if(dk.indexOf("*")===0){dk=dk.substr(1)}if(dk.indexOf(".")===0){dk=dk.substr(1)}dk="http://"+dk}dl.href=v.toAbsoluteUrl(dk);if(dl.pathname){return dl.pathname}return""}function a4(dl,dk){if(!aj(dk,"/")){dk="/"+dk}if(!aj(dl,"/")){dl="/"+dl}var dm=(dk==="/"||dk==="/*");if(dm){return true}if(dl===dk){return true}dk=String(dk).toLowerCase();dl=String(dl).toLowerCase();if(Q(dk,"*")){dk=dk.slice(0,-1);dm=(!dk||dk==="/");if(dm){return true}if(dl===dk){return true}return dl.indexOf(dk)===0}if(!Q(dl,"/")){dl+="/"}if(!Q(dk,"/")){dk+="/"}return dl.indexOf(dk)===0}function ar(dp,dr){var dl,dk,dm,dn,dq;for(dl=0;dl0)&&(dn.slice(dm)===dk)){return true}}}return false}function co(dk,dm){dk=dk.replace("send_image=0","send_image=1");var dl=new Image(1,1);dl.onload=function(){E=0;if(typeof dm==="function"){dm({request:dk,trackerUrl:aE,success:true})}};dl.onerror=function(){if(typeof dm==="function"){dm({request:dk,trackerUrl:aE,success:false})}};dl.src=aE+(aE.indexOf("?")<0?"?":"&")+dk}function cF(dk){if(db==="POST"){return true}return dk&&(dk.length>2000||dk.indexOf('{"requests"')===0)}function aL(){return"object"===typeof g&&"function"===typeof g.sendBeacon&&"function"===typeof Blob}function a7(dp,ds,dr){var dm=aL();if(!dm){return false}var dn={type:"application/x-www-form-urlencoded; charset=UTF-8"};var dt=false;var dl=aE;try{var dk=new Blob([dp],dn);if(dr&&!cF(dp)){dk=new Blob([],dn);dl=dl+(dl.indexOf("?")<0?"?":"&")+dp}dt=g.sendBeacon(dl,dk)}catch(dq){return false}if(dt&&typeof ds==="function"){ds({request:dp,trackerUrl:aE,success:true,isSendBeacon:true})}return dt}function c6(dl,dm,dk){if(!J(dk)||null===dk){dk=true +}if(l&&a7(dl,dm,dk)){return}setTimeout(function(){if(l&&a7(dl,dm,dk)){return}var dq;try{var dp=S.XMLHttpRequest?new S.XMLHttpRequest():S.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;dp.open("POST",aE,true);dp.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)){var dr=l&&a7(dl,dm,dk);if(!dr&&dk){co(dl,dm)}else{if(typeof dm==="function"){dm({request:dl,trackerUrl:aE,success:false,xhr:this})}}}else{if(this.readyState===4&&(typeof dm==="function")){dm({request:dl,trackerUrl:aE,success:true,xhr:this})}}};dp.setRequestHeader("Content-Type",cx);dp.withCredentials=true;dp.send(dl)}catch(dn){dq=l&&a7(dl,dm,dk);if(!dq&&dk){co(dl,dm)}else{if(typeof dm==="function"){dm({request:dl,trackerUrl:aE,success:false})}}}},50)}function cg(dl){var dk=new Date();var dm=dk.getTime()+dl;if(!q||dm>q){q=dm}}function bb(){bd=true;cy=new Date().getTime()}function de(){var dk=new Date().getTime();return !cy||(dk-cy)>a6}function az(){if(de()){bS()}}function dh(){if(aO||!a6){return +}aO=true;an(S,"focus",bb);an(S,"blur",az);ab++;t.addPlugin("HeartBeat"+ab,{unload:function(){if(aO&&de()){bS()}}})}function cD(dp){var dl=new Date();var dk=dl.getTime();c0=dk;if(cC&&dk=dk.length){return[dk]}var dl=0;var dm=dk.length;var dn=[];for(dl;dl=dl&&dk<=(dl+a0)){return true}}return false}function di(dk){if(!cO){return""}var dp=e(dk,av);if(!dp){return""}dp=String(dp);var dm=new RegExp("^[a-zA-Z0-9]+$"); if(dp.length===32&&dm.test(dp)){var dl=dp.substr(16,32);if(c4(dl)){var dn=dp.substr(0,16);return dn}}return""}function cP(){if(!bP){bP=di(bO)}var dm=new Date(),dk=Math.round(dm.getTime()/1000),dl=aU("id"),dq=aD(dl),dp,dn;if(dq){dp=dq.split(".");dp.unshift("0");if(bP.length){dp[1]=bP}return dp}if(bP.length){dn=bP}else{if("0"===b6()){dn=""}else{dn=cS()}}dp=["1",dn,dk];return dp}function aZ(){var dn=cP(),dl=dn[0],dm=dn[1],dk=dn[2];return{newVisitor:dl,uuid:dm,createTs:dk}}function aH(){var dn=new Date(),dl=dn.getTime(),dp=aZ().createTs;var dk=parseInt(dp,10);var dm=(dk*1000)+cL-dl;return dm}function aN(dk){if(!b7){return}var dm=new Date(),dl=Math.round(dm.getTime()/1000);if(!J(dk)){dk=aZ()}var dn=dk.uuid+"."+dk.createTs+".";df(aU("id"),dn,aH(),br,cZ,bT,aJ)}function bN(){var dk=aD(aU("ref"));if(dk.length){try{dk=S.JSON.parse(dk);if(V(dk)){return dk}}catch(dl){}}return["","",0,""]}function by(dm){var dl=bl+"testcookie_domain";var dk="testvalue";df(dl,dk,10000,null,dm,bT,aJ);if(aD(dl)===dk){bZ(dl,null,dm); return true}return false}function aF(){var dl=bn;bn=false;var dk,dm;for(dk=0;dk0){if(!J(dl)){dl=""}if(!w(dl)){dl=String(dl)}bo[dk]=dl}};this.getCustomDimension=function(dk){dk=parseInt(dk,10);if(dk>0&&Object.prototype.hasOwnProperty.call(bo,dk)){return bo[dk]}};this.deleteCustomDimension=function(dk){dk=parseInt(dk,10);if(dk>0){delete bo[dk]}};this.setCustomVariable=function(dl,dk,dp,dm){var dn;if(!J(dm)){dm="visit"}if(!J(dk)){return}if(!J(dp)){dp=""}if(dl>0){dk=!w(dk)?String(dk):dk;dp=!w(dp)?String(dp):dp;dn=[dk.slice(0,bv),dp.slice(0,bv)];if(dm==="visit"||dm===2){cG();aR[dl]=dn}else{if(dm==="page"||dm===3){bX[dl]=dn}else{if(dm==="event"){cm[dl]=dn}}}}};this.getCustomVariable=function(dl,dm){var dk;if(!J(dm)){dm="visit"}if(dm==="page"||dm===3){dk=bX[dl]}else{if(dm==="event"){dk=cm[dl]}else{if(dm==="visit"||dm===2){cG();dk=aR[dl]}}}if(!J(dk)||(dk&&dk[0]==="")){return false}return dk};this.deleteCustomVariable=function(dk,dl){if(this.getCustomVariable(dk,dl)){this.setCustomVariable(dk,"","",dl)}};this.deleteCustomVariables=function(dk){if(dk==="page"||dk===3){bX={} }else{if(dk==="event"){cm={}}else{if(dk==="visit"||dk===2){aR={}}}}};this.storeCustomVariablesInCookie=function(){bR=true};this.setLinkTrackingTimer=function(dk){bL=dk};this.getLinkTrackingTimer=function(){return bL};this.setDownloadExtensions=function(dk){if(w(dk)){dk=dk.split("|")}c8=dk};this.addDownloadExtensions=function(dl){var dk;if(w(dl)){dl=dl.split("|")}for(dk=0;dk1&&ap!=="addTracker"&&ap!=="enableLinkTracking"){ak("The method "+ap+' is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Matomo trackers documentation: https://developer.matomo.org/guides/tracking-javascript-guide#multiple-piwik-trackers')}av[ap]++}}}}return au}var C=["addTracker","forgetCookieConsentGiven","requireCookieConsent","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCrossDomainLinkingTimeout","setSessionCookieTimeout","setVisitorCookieTimeout","setCookieNamePrefix","setCookieSameSite","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setVisitorId","setSiteId","alwaysUseSendBeacon","enableLinkTracking","setCookieConsentGiven","requireConsent","setConsentGiven","disablePerformanceTracking"]; +if(!bn&&!by(dl)){ak("Can't write cookie on domain "+dk)}else{cZ=dl;bj()}};this.getCookieDomain=function(){return cZ};this.hasCookies=function(){return"1"===b6()};this.setSessionCookie=function(dm,dl,dk){if(!dm){throw new Error("Missing cookie name")}if(!J(dk)){dk=cn}bw.push(dm);df(aU(dm),dl,dk,br,cZ,bT,aJ)};this.getCookie=function(dl){var dk=aD(aU(dl));if(dk===0){return null}return dk};this.setCookiePath=function(dk){br=dk;bj()};this.getCookiePath=function(dk){return br};this.setVisitorCookieTimeout=function(dk){cL=dk*1000};this.setSessionCookieTimeout=function(dk){cn=dk*1000};this.getSessionCookieTimeout=function(){return cn};this.setReferralCookieTimeout=function(dk){c7=dk*1000};this.setConversionAttributionFirstReferrer=function(dk){bx=dk};this.setSecureCookie=function(dk){if(dk&&location.protocol!=="https:"){ak("Error in setSecureCookie: You cannot use `Secure` on http.");return}bT=dk};this.setCookieSameSite=function(dk){dk=String(dk);dk=dk.charAt(0).toUpperCase()+dk.toLowerCase().slice(1); +if(dk!=="None"&&dk!=="Lax"&&dk!=="Strict"){ak("Ignored value for sameSite. Please use either Lax, None, or Strict.");return}if(dk==="None"){if(location.protocol==="https:"){this.setSecureCookie(true)}else{ak("sameSite=None cannot be used on http, reverted to sameSite=Lax.");dk="Lax"}}aJ=dk};this.disableCookies=function(){bn=true;if(b7){aF()}};this.areCookiesEnabled=function(){return !bn};this.setCookieConsentGiven=function(){if(bn&&!cR){bn=false;if(b7&&aw){aN();var dk=cr("ping=1",null,"ping");bH(dk,bL)}}};this.requireCookieConsent=function(){if(this.getRememberedCookieConsent()){return false}this.disableCookies();return true};this.getRememberedCookieConsent=function(){return aD(cE)};this.forgetCookieConsentGiven=function(){bZ(cE,br,cZ);this.disableCookies()};this.rememberCookieConsentGiven=function(dl){if(dl){dl=dl*60*60*1000}else{dl=30*365*24*60*60*1000}this.setCookieConsentGiven();var dk=new Date().getTime();df(cE,dk,dl,br,cZ,bT,aJ)};this.deleteCookies=function(){aF()};this.setDoNotTrack=function(dl){var dk=g.doNotTrack||g.msDoNotTrack; +cR=dl&&(dk==="yes"||dk==="1");if(cR){this.disableCookies()}};this.alwaysUseSendBeacon=function(){cY=true};this.disableAlwaysUseSendBeacon=function(){cY=false};this.addListener=function(dl,dk){aq(dl,dk,false)};this.enableLinkTracking=function(dl){if(da){return}da=true;var dk=this;p(function(){ap=true;var dm=G.body;aq(dm,dl,true)})};this.enableJSErrorTracking=function(){if(cT){return}cT=true;var dk=S.onerror;S.onerror=function(dq,dn,dm,dp,dl){ch(function(){var dr="JavaScript Errors";var ds=dn+":"+dm;if(dp){ds+=":"+dp}if(M(cs,dr+ds+dq)===-1){cs.push(dr+ds+dq);at(dr,ds,dq)}});if(dk){return dk(dq,dn,dm,dp,dl)}return false}};this.disablePerformanceTracking=function(){a3=false};this.enableHeartBeatTimer=function(dk){dk=Math.max(dk||15,5);a6=dk*1000;if(c0!==null){dh()}};this.disableHeartBeatTimer=function(){if(a6||aO){if(S.removeEventListener){S.removeEventListener("focus",bb);S.removeEventListener("blur",az)}else{if(S.detachEvent){S.detachEvent("onfocus",bb);S.detachEvent("onblur",az)}}}a6=null; +aO=false};this.killFrame=function(){if(S.location!==S.top.location){S.top.location=S.location}};this.redirectFile=function(dk){if(S.location.protocol==="file:"){S.location=dk}};this.setCountPreRendered=function(dk){bf=dk};this.trackGoal=function(dk,dn,dm,dl){ch(function(){cU(dk,dn,dm,dl)})};this.trackLink=function(dl,dk,dn,dm){ch(function(){c3(dl,dk,dn,dm)})};this.getNumTrackedPageViews=function(){return cq};this.trackPageView=function(dk,dm,dl){cb=[];cM=[];cs=[];if(N(b7)){ch(function(){Z(aE,bJ,b7)})}else{ch(function(){cq++;b1(dk,dm,dl)})}};this.trackAllContentImpressions=function(){if(N(b7)){return}ch(function(){p(function(){var dk=v.findContentNodes();var dl=cA(dk);bF.pushMultiple(dl)})})};this.trackVisibleContentImpressions=function(dk,dl){if(N(b7)){return}if(!J(dk)){dk=true}if(!J(dl)){dl=750}aT(dk,dl,this);ch(function(){m(function(){var dm=v.findContentNodes();var dn=ba(dm);bF.pushMultiple(dn)})})};this.trackContentImpression=function(dm,dk,dl){if(N(b7)){return}dm=a(dm);dk=a(dk);dl=a(dl); +if(!dm){return}dk=dk||"Unknown";ch(function(){var dn=aG(dm,dk,dl);bF.push(dn)})};this.trackContentImpressionsWithinNode=function(dk){if(N(b7)||!dk){return}ch(function(){if(cf){m(function(){var dl=v.findContentNodesWithinNode(dk);var dm=ba(dl);bF.pushMultiple(dm)})}else{p(function(){var dl=v.findContentNodesWithinNode(dk);var dm=cA(dl);bF.pushMultiple(dm)})}})};this.trackContentInteraction=function(dm,dn,dk,dl){if(N(b7)){return}dm=a(dm);dn=a(dn);dk=a(dk);dl=a(dl);if(!dm||!dn){return}dk=dk||"Unknown";ch(function(){var dp=aQ(dm,dn,dk,dl);if(dp){bF.push(dp)}})};this.trackContentInteractionNode=function(dm,dl){if(N(b7)||!dm){return}var dk=null;ch(function(){dk=dc(dm,dl);if(dk){bF.push(dk)}});return dk};this.logAllContentBlocksOnPage=function(){var dm=v.findContentNodes();var dk=v.collectContent(dm);var dl=typeof console;if(dl!=="undefined"&&console&&console.log){console.log(dk)}};this.trackEvent=function(dl,dn,dk,dm,dq,dp){ch(function(){at(dl,dn,dk,dm,dq,dp)})};this.trackSiteSearch=function(dk,dm,dl,dn){cb=[]; +ch(function(){b9(dk,dm,dl,dn)})};this.setEcommerceView=function(dp,dk,dm,dl){ct={};if(Y(dm)){dm=String(dm)}if(!J(dm)||dm===null||dm===false||!dm.length){dm=""}else{if(dm instanceof Array){dm=S.JSON.stringify(dm)}}var dn="_pkc";ct[dn]=dm;if(J(dl)&&dl!==null&&dl!==false&&String(dl).length){dn="_pkp";ct[dn]=dl}if(!Y(dp)&&!Y(dk)){return}if(Y(dp)){dn="_pks";ct[dn]=dp}if(!Y(dk)){dk=""}dn="_pkn";ct[dn]=dk};this.getEcommerceItems=function(){return JSON.parse(JSON.stringify(c2))};this.addEcommerceItem=function(dp,dk,dm,dl,dn){if(Y(dp)){c2[dp]=[String(dp),dk,dm,dl,dn]}};this.removeEcommerceItem=function(dk){if(Y(dk)){dk=String(dk);delete c2[dk]}};this.clearEcommerceCart=function(){c2={}};this.trackEcommerceOrder=function(dk,dp,dn,dm,dl,dq){b0(dk,dp,dn,dm,dl,dq)};this.trackEcommerceCartUpdate=function(dk){bu(dk)};this.trackRequest=function(dl,dn,dm,dk){ch(function(){var dp=cr(dl,dn,dk);bH(dp,bL,dm)})};this.ping=function(){this.trackRequest("ping=1",null,null,"ping")};this.disableQueueRequest=function(){bF.enabled=false +};this.setRequestQueueInterval=function(dk){if(dk<1000){throw new Error("Request queue interval needs to be at least 1000ms")}bF.interval=dk};this.queueRequest=function(dk){ch(function(){var dl=cr(dk);bF.push(dl)})};this.isConsentRequired=function(){return cB};this.getRememberedConsent=function(){var dk=aD(be);if(aD(cN)){if(dk){bZ(be,br,cZ)}return null}if(!dk||dk===0){return null}return dk};this.hasRememberedConsent=function(){return !!this.getRememberedConsent()};this.requireConsent=function(){cB=true;bE=this.hasRememberedConsent();if(!bE){bn=true}x++;b["CoreConsent"+x]={unload:function(){if(!bE){aF()}}}};this.setConsentGiven=function(dl){bE=true;bZ(cN,br,cZ);var dm,dk;for(dm=0;dm1&&ap!=="addTracker"&&ap!=="enableLinkTracking"){ak("The method "+ap+' is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Matomo trackers documentation: https://developer.matomo.org/guides/tracking-javascript-guide#multiple-piwik-trackers')}av[ap]++}}}}return au}var C=["addTracker","forgetCookieConsentGiven","requireCookieConsent","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCrossDomainLinkingTimeout","setSessionCookieTimeout","setVisitorCookieTimeout","setCookieNamePrefix","setCookieSameSite","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setVisitorId","setSiteId","alwaysUseSendBeacon","enableLinkTracking","setCookieConsentGiven","requireConsent","setConsentGiven","disablePerformanceTracking"]; function ad(aq,ap){var ao=new P(aq,ap);I.push(ao);_paq=c(_paq,C);for(E=0;E<_paq.length;E++){if(_paq[E]){af(_paq[E])}}_paq=new H();t.trigger("TrackerAdded",[ao]);return ao}an(S,"beforeunload",ai,false);an(S,"online",function(){if(J(g.serviceWorker)){g.serviceWorker.ready.then(function(ao){if(ao&&ao.sync){return ao.sync.register("matomoSync")}},function(){})}},false);an(S,"message",function(au){if(!au||!au.origin){return}var aw,ar,ap;var ax=d(au.origin);var at=t.getAsyncTrackers();for(ar=0;ar