diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-12-04 06:11:45 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-12-04 06:11:45 +0300 |
commit | 66a15fd6457df333fa3e8bdd0a5c80674ca99dc4 (patch) | |
tree | 6339975433f8a86e26ba5e61443d054d7629e4f0 | |
parent | c11251c1def82c79e6ea608b57dc8898d9ffe60f (diff) |
set a cookie path automatically if a configHostAlias matches a path
-rw-r--r-- | js/piwik.js | 77 | ||||
-rw-r--r-- | piwik.js | 54 | ||||
-rw-r--r-- | tests/javascript/enable_sqlite | 0 | ||||
-rw-r--r-- | tests/javascript/index.php | 46 | ||||
-rw-r--r-- | tests/javascript/piwiktest.js | 1 |
5 files changed, 146 insertions, 32 deletions
diff --git a/js/piwik.js b/js/piwik.js index 66e5ff6b75..a2fc4c0595 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -3046,6 +3046,11 @@ if (typeof Piwik !== 'object') { return str.indexOf(suffix, str.length - suffix.length) !== -1; } + function removeCharactersFromEndOfString(str, numCharactersToRemove) { + str = String(str); + return str.substr(0, str.length - numCharactersToRemove); + } + /* * Extract pathname from URL. element.pathname is actually supported by pretty much all browsers including * IE6 apart from some rare very old ones @@ -4886,6 +4891,59 @@ if (typeof Piwik !== 'object') { }); } + /** + * Note: While we check whether the user is on a configHostAlias path we do not check whether the user is + * actually on the configHostAlias domain. This is already done where this method is called and for + * simplicity we do not check this again. + * + * Also we currently assume that all configHostAlias domains start with the same wild card of '*.', '.' or + * none. Eg either all like '*.piwik.org' or '.piwik.org' or 'piwik.org'. Piwik always adds '*.' so it + * should be fine. + */ + function findConfigCookiePathToUse(configHostAlias, currentUrl) + { + var aliasPath = getPathName(configHostAlias); + var currentPath = getPathName(currentUrl); + + if (!aliasPath || aliasPath === '/' || !currentPath || currentPath === '/') { + // no path set that would be useful for cookiePath + return; + } + + var aliasDomain = domainFixup(configHostAlias); + + if (isSiteHostPath(aliasDomain, '/')) { + // there is another configHostsAlias having same domain that allows all paths + // eg this alias is for piwik.org/support but there is another alias allowing + // piwik.org + return; + } + + if (stringEndsWith(aliasPath, '/')) { + aliasPath = removeCharactersFromEndOfString(aliasPath, 1); + } + + // eg if we're in the case of "apache.piwik/foo/bar" we check whether there is maybe + // also a config alias allowing "apache.piwik/foo". In this case we're not allowed to set + // the cookie for "/foo/bar" but "/foo" + var pathAliasParts = aliasPath.split('/'); + for (var i = 2; i < pathAliasParts.length; i++) { + var lessRestrctivePath = pathAliasParts.slice(0, i).join('/'); + if (isSiteHostPath(aliasDomain, lessRestrctivePath)) { + aliasPath = lessRestrctivePath; + break; + } + } + + if (!isSitePath(currentPath, aliasPath)) { + // current path of current URL does not match the alias + // eg user is on piwik.org/demo but configHostAlias is for piwik.org/support + return; + } + + return aliasPath; + } + /* * Browser features (plugins, resolution, cookies) */ @@ -5026,6 +5084,9 @@ if (typeof Piwik !== 'object') { getDomains: function () { return configHostsAlias; }, + getConfigCookiePath: function () { + return configCookiePath; + }, getConfigDownloadExtensions: function () { return configDownloadExtensions; }, @@ -5467,10 +5528,20 @@ if (typeof Piwik !== 'object') { var hasDomainAliasAlready = false, i; for (i in configHostsAlias) { + var configHostAliasDomain = domainFixup(String(configHostsAlias[i])); + if (Object.prototype.hasOwnProperty.call(configHostsAlias, i) - && isSameHost(domainAlias, domainFixup(configHostsAlias[i]))) { + && isSameHost(domainAlias, configHostAliasDomain)) { hasDomainAliasAlready = true; - break; + + if (!configCookiePath) { + var path = findConfigCookiePathToUse(configHostsAlias[i], locationHrefAlias); + if (path) { + this.setCookiePath(path); + } + + break; + } } } @@ -6322,7 +6393,7 @@ if (typeof Piwik !== 'object') { asyncTracker = new Tracker(); - var applyFirst = ['disableCookies', 'setTrackerUrl', 'setAPIUrl', 'setCookiePath', 'setCookieDomain', 'setUserId', 'setSiteId', 'enableLinkTracking']; + var applyFirst = ['disableCookies', 'setTrackerUrl', 'setAPIUrl', 'setCookiePath', 'setCookieDomain', 'setDomains', 'setUserId', 'setSiteId', 'enableLinkTracking']; _paq = applyMethodsInOrder(_paq, applyFirst); // apply the queue of actions @@ -35,32 +35,32 @@ return this.toAbsoluteUrl(Z)}},isSameDomain:function(Y){if(!Y||!Y.indexOf){retur }}}var ae=S.findNodesByTagName(ac,"embed");if(ae&&ae.length){return this.findMediaUrlInNode(ae[0])}}},trim:function(Y){if(Y&&String(Y)===Y){return Y.replace(/^\s+|\s+$/g,"")}return Y},isOrWasNodeInViewport:function(ad){if(!ad||!ad.getBoundingClientRect||ad.nodeType!==1){return true}var ac=ad.getBoundingClientRect();var ab=w.documentElement||{};var aa=ac.top<0;if(aa&&ad.offsetTop){aa=(ad.offsetTop+ac.height)>0}var Z=ab.clientWidth;if(I.innerWidth&&Z>I.innerWidth){Z=I.innerWidth}var Y=ab.clientHeight;if(I.innerHeight&&Y>I.innerHeight){Y=I.innerHeight}return((ac.bottom>0||aa)&&ac.right>0&&ac.left<Z&&((ac.top<Y)||aa))},isNodeVisible:function(Z){var Y=g(Z);var aa=this.isOrWasNodeInViewport(Z);return Y&&aa},buildInteractionRequestParams:function(Y,Z,aa,ab){var ac="";if(Y){ac+="c_i="+m(Y)}if(Z){if(ac){ac+="&"}ac+="c_n="+m(Z)}if(aa){if(ac){ac+="&"}ac+="c_p="+m(aa)}if(ab){if(ac){ac+="&"}ac+="c_t="+m(ab)}return ac},buildImpressionRequestParams:function(Y,Z,aa){var ab="c_n="+m(Y)+"&c_p="+m(Z);if(aa){ab+="&c_t="+m(aa) }return ab},buildContentBlock:function(aa){if(!aa){return}var Y=this.findContentName(aa);var Z=this.findContentPiece(aa);var ab=this.findContentTarget(aa);Y=this.trim(Y);Z=this.trim(Z);ab=this.trim(ab);return{name:Y||"Unknown",piece:Z||"Unknown",target:ab||""}},collectContent:function(ab){if(!ab||!ab.length){return[]}var aa=[];var Y,Z;for(Y=0;Y<ab.length;Y++){Z=this.buildContentBlock(ab[Y]);if(y(Z)){aa.push(Z)}}return aa},setLocation:function(Y){this.location=Y},getLocation:function(){var Y=this.location||I.location;if(!Y.origin){Y.origin=Y.protocol+"//"+Y.hostname+(Y.port?":"+Y.port:"")}return Y},toAbsoluteUrl:function(Z){if((!Z||String(Z)!==Z)&&Z!==""){return Z}if(""===Z){return this.getLocation().href}if(Z.search(/^\/\//)!==-1){return this.getLocation().protocol+Z}if(Z.search(/:\/\//)!==-1){return Z}if(0===Z.indexOf("#")){return this.getLocation().origin+this.getLocation().pathname+Z}if(0===Z.indexOf("?")){return this.getLocation().origin+this.getLocation().pathname+Z}if(0===Z.search("^[a-zA-Z]{2,11}:")){return Z }if(Z.search(/^\//)!==-1){return this.getLocation().origin+Z}var Y="(.*/)";var aa=this.getLocation().origin+this.getLocation().pathname.match(new RegExp(Y))[0];return aa+Z},isUrlToCurrentDomain:function(Z){var aa=this.toAbsoluteUrl(Z);if(!aa){return false}var Y=this.getLocation().origin;if(Y===aa){return true}if(0===String(aa).indexOf(Y)){if(":"===String(aa).substr(Y.length,1)){return false}return true}return false},setHrefAttribute:function(Z,Y){if(!Z||!Y){return}S.setAnyAttribute(Z,"href",Y)},shouldIgnoreInteraction:function(aa){var Z=S.hasNodeAttribute(aa,this.CONTENT_IGNOREINTERACTION_ATTR);var Y=S.hasNodeCssClass(aa,this.CONTENT_IGNOREINTERACTION_CLASS);return Z||Y}};function D(Y,Z){if(Z){return Z}if(Y.slice(-9)==="piwik.php"){Y=Y.slice(0,Y.length-9)}return Y}function C(ae){var ag="Piwik_Overlay";var Z=new RegExp("index\\.php\\?module=Overlay&action=startOverlaySession&idSite=([0-9]+)&period=([^&]+)&date=([^&]+)(&segment=.*)?$");var aa=Z.exec(w.referrer);if(aa){var ac=aa[1];if(ac!==String(ae)){return false -}var ad=aa[2],Y=aa[3],ab=aa[4];if(!ab){ab=""}else{if(ab.indexOf("&segment=")===0){ab=ab.substr("&segment=".length)}}I.name=ag+"###"+ad+"###"+Y+"###"+ab}var af=I.name.split("###");return af.length===4&&af[0]===ag}function O(Z,af,ab){var ae=I.name.split("###"),ad=ae[1],Y=ae[2],ac=ae[3],aa=D(Z,af);i(aa+"plugins/Overlay/client/client.js?v=1",function(){Piwik_Overlay_Client.initialize(aa,ab,ad,Y,ac)})}function F(bF,bz){var bv=P(w.domain,I.location.href,z()),cd=A(bv[0]),bf=j(bv[1]),aU=j(bv[2]),cb=false,bJ="GET",cq=bJ,am="application/x-www-form-urlencoded; charset=UTF-8",bV=am,ai=bF||"",ba="",ch="",bx=bz||"",a3="",bg="",aG,aQ=w.title,cn=["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","sea","sit","tar","tbz","tbz2","bz","bz2","tgz","torrent","txt","wav","wma","wmv","wpd","xls","xlsx","xml","z","zip"],ae=[cd],a4=[],bd=[],aJ=[],bb=500,b4,aH,bj,bh,Y,bR=["pk_campaign","piwik_campaign","utm_campaign","utm_source","utm_medium"],a9=["pk_kwd","piwik_kwd","utm_term"],aR="_pk_",cf,aW,aS=false,b9,aO,a0,b5=33955200000,bP=1800000,cm=15768000000,aE=true,bN=0,bi=false,at=false,bC,bn={},bM={},aT={},aZ=200,ci={},co={},bB=[],bG=false,bY=false,Z=false,cp=false,aq=false,cg=null,bD,au,a5,by=W,aV; -function ct(cD,cA,cz,cC,cy,cB){if(aS){return}var cx;if(cz){cx=new Date();cx.setTime(cx.getTime()+cz)}w.cookie=cD+"="+m(cA)+(cz?";expires="+cx.toGMTString():"")+";path="+(cC||"/")+(cy?";domain="+cy:"")+(cB?";secure":"")}function ah(cz){if(aS){return 0}var cx=new RegExp("(^|;)[ ]*"+cz+"=([^;]*)"),cy=cx.exec(w.cookie);return cy?H(cy[2]):0}function bt(cx){var cy;if(bh){cy=new RegExp("#.*");return cx.replace(cy,"")}return cx}function bm(cz,cx){var cA=l(cx),cy;if(cA){return cx}if(cx.slice(0,1)==="/"){return l(cz)+"://"+c(cz)+cx}cz=bt(cz);cy=cz.indexOf("?");if(cy>=0){cz=cz.slice(0,cy)}cy=cz.lastIndexOf("/");if(cy!==cz.length-1){cz=cz.slice(0,cy+1)}return cz+cx}function b2(cz,cx){var cy;cz=String(cz).toLowerCase();cx=String(cx).toLowerCase();if(cz===cx){return true}if(cx.slice(0,1)==="."){if(cz===cx.slice(1)){return true}cy=cz.length-cx.length;if((cy>0)&&(cz.slice(cy)===cx)){return true}}return false}function ck(cy,cx){cy=String(cy);return cy.indexOf(cx,cy.length-cx.length)!==-1}function bL(cx){var cy=document.createElement("a"); -if(cx.indexOf("//")!==0&&cx.indexOf("http")!==0){cx="http://"+cx}cy.href=n.toAbsoluteUrl(cx);if(cy.pathname){return cy.pathname}return""}function aF(cy,cx){var cz=(!cx||cx==="/");if(cz){return true}if(cy===cx){return true}if(!cy){return false}cx=String(cx).toLowerCase();cy=String(cy).toLowerCase();if(!ck(cy,"/")){cy+="/"}if(!ck(cx,"/")){cx+="/"}return cy.indexOf(cx)===0}function ab(cB,cD){var cy,cx,cz,cA,cC;for(cy=0;cy<ae.length;cy++){cA=A(ae[cy]);cC=bL(ae[cy]);if(b2(cB,cA)&&aF(cD,cC)){return true}}return false}function ay(cA){var cy,cx,cz;for(cy=0;cy<ae.length;cy++){cx=A(ae[cy].toLowerCase());if(cA===cx){return true}if(cx.slice(0,1)==="."){if(cA===cx.slice(1)){return true}cz=cA.length-cx.length;if((cz>0)&&(cA.slice(cz)===cx)){return true}}}return false}function bQ(cx,cz){var cy=new Image(1,1);cy.onload=function(){v=0;if(typeof cz==="function"){cz()}};cy.src=ai+(ai.indexOf("?")<0?"?":"&")+cx}function cl(cy,cB,cx){if(!y(cx)||null===cx){cx=true}try{var cA=I.XMLHttpRequest?new I.XMLHttpRequest():I.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null; -cA.open("POST",ai,true);cA.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)&&cx){bQ(cy,cB)}else{if(typeof cB==="function"){cB()}}};cA.setRequestHeader("Content-Type",bV);cA.send(cy)}catch(cz){if(cx){bQ(cy,cB)}}}function bH(cy){var cx=new Date();var cz=cx.getTime()+cy;if(!k||cz>k){k=cz}}function bO(cx){if(bD||!aH){return}bD=setTimeout(function cy(){bD=null;if(bj()){return}var cz=new Date(),cA=aH-(cz.getTime()-cg);cA=Math.min(aH,cA);bO(cA)},cx||aH)}function bc(){if(!bD){return}clearTimeout(bD);bD=null}function aL(){if(bj()){return}bO()}function af(){bc()}function cv(){if(aq||!aH){return}aq=true;X(I,"focus",aL);X(I,"blur",af);bO()}function bZ(cB){var cy=new Date();var cx=cy.getTime();cg=cx;if(bY&&cx<bY){var cz=bY-cx;setTimeout(cB,cz);bH(cz+50);bY+=50;return}if(bY===false){var cA=800;bY=cx+cA}cB()}function a8(cy,cx,cz){if(!b9&&cy){bZ(function(){if(cq==="POST"){cl(cy,cz)}else{bQ(cy,cz)}bH(cx)})}if(!aq){cv()}else{bO()}}function bK(cx){if(b9){return false -}return(cx&&cx.length)}function cu(cz,cx){if(!bK(cz)){return}var cy='{"requests":["?'+cz.join('","?')+'"]}';bZ(function(){cl(cy,null,false);bH(cx)})}function aw(cx){return aR+cx+"."+bx+"."+aV}function bw(){if(aS){return"0"}if(!y(e.cookieEnabled)){var cx=aw("testcookie");ct(cx,"1");return ah(cx)==="1"?"1":"0"}return e.cookieEnabled?"1":"0"}function aP(){aV=by((cf||cd)+(aW||"/")).slice(0,4)}function bo(){var cy=aw("cvar"),cx=ah(cy);if(cx.length){cx=JSON2.parse(cx);if(L(cx)){return cx}}return{}}function b0(){if(at===false){at=bo()}}function ca(){return by((e.userAgent||"")+(e.platform||"")+JSON2.stringify(co)+(new Date()).getTime()+Math.random()).slice(0,16)}function b7(){var cz=new Date(),cx=Math.round(cz.getTime()/1000),cy=aw("id"),cC=ah(cy),cB,cA;if(cC){cB=cC.split(".");cB.unshift("0");if(bg.length){cB[1]=bg}return cB}if(bg.length){cA=bg}else{if("0"===bw()){cA=""}else{cA=ca()}}cB=["1",cA,cx,0,cx,"",""];return cB}function aA(){var cE=b7(),cA=cE[0],cB=cE[1],cy=cE[2],cx=cE[3],cC=cE[4],cz=cE[5]; -if(!y(cE[6])){cE[6]=""}var cD=cE[6];return{newVisitor:cA,uuid:cB,createTs:cy,visitCount:cx,currentVisitTs:cC,lastVisitTs:cz,lastEcommerceOrderTs:cD}}function al(){var cA=new Date(),cy=cA.getTime(),cB=aA().createTs;var cx=parseInt(cB,10);var cz=(cx*1000)+b5-cy;return cz}function ao(cx){if(!bx){return}var cz=new Date(),cy=Math.round(cz.getTime()/1000);if(!y(cx)){cx=aA()}var cA=cx.uuid+"."+cx.createTs+"."+cx.visitCount+"."+cy+"."+cx.lastVisitTs+"."+cx.lastEcommerceOrderTs;ct(aw("id"),cA,al(),aW,cf)}function be(){var cx=ah(aw("ref"));if(cx.length){try{cx=JSON2.parse(cx);if(L(cx)){return cx}}catch(cy){}}return["","",0,""]}function bp(cz,cy,cx){ct(cz,"",-86400,cy,cx)}function a1(cy){var cx="testvalue";ct("test",cx,10000,null,cy);if(ah("test")===cx){bp("test",null,cy);return true}return false}function aj(){var cz=aS;aS=false;var cx=["id","ses","cvar","ref"];var cy,cA;for(cy=0;cy<cx.length;cy++){cA=aw(cx[cy]);if(0!==ah(cA)){bp(cA,aW,cf)}}aS=cz}function bu(cx){bx=cx;ao()}function cw(cB){if(!cB||!L(cB)){return -}var cA=[];var cz;for(cz in cB){if(Object.prototype.hasOwnProperty.call(cB,cz)){cA.push(cz)}}var cC={};cA.sort();var cx=cA.length;var cy;for(cy=0;cy<cx;cy++){cC[cA[cy]]=cB[cA[cy]]}return cC}function bE(){ct(aw("ses"),"*",bP,aW,cf)}function bS(cz,cU,cV,cA){var cT,cy=new Date(),cH=Math.round(cy.getTime()/1000),cE,cS,cB=1024,c0,cI,cQ=at,cC=aw("ses"),cO=aw("ref"),cL=aw("cvar"),cM=ah(cC),cR=be(),cX=aG||bf,cF,cx;if(aS){aj()}if(b9){return""}var cN=aA();if(!y(cA)){cA=""}var cK=w.characterSet||w.charset;if(!cK||cK.toLowerCase()==="utf-8"){cK=null}cF=cR[0];cx=cR[1];cE=cR[2];cS=cR[3];if(!cM){var cW=bP/1000;if(!cN.lastVisitTs||(cH-cN.lastVisitTs)>cW){cN.visitCount++;cN.lastVisitTs=cN.currentVisitTs}if(!a0||!cF.length){for(cT in bR){if(Object.prototype.hasOwnProperty.call(bR,cT)){cF=K(cX,bR[cT]);if(cF.length){break}}}for(cT in a9){if(Object.prototype.hasOwnProperty.call(a9,cT)){cx=K(cX,a9[cT]);if(cx.length){break}}}}c0=c(aU);cI=cS.length?c(cS):"";if(c0.length&&!ay(c0)&&(!a0||!cI.length||ay(cI))){cS=aU -}if(cS.length||cF.length){cE=cH;cR=[cF,cx,cE,bt(cS.slice(0,cB))];ct(cO,JSON2.stringify(cR),cm,aW,cf)}}cz+="&idsite="+bx+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+cy.getHours()+"&m="+cy.getMinutes()+"&s="+cy.getSeconds()+"&url="+m(bt(cX))+(aU.length?"&urlref="+m(bt(aU)):"")+((a3&&a3.length)?"&uid="+m(a3):"")+"&_id="+cN.uuid+"&_idts="+cN.createTs+"&_idvc="+cN.visitCount+"&_idn="+cN.newVisitor+(cF.length?"&_rcn="+m(cF):"")+(cx.length?"&_rck="+m(cx):"")+"&_refts="+cE+"&_viewts="+cN.lastVisitTs+(String(cN.lastEcommerceOrderTs).length?"&_ects="+cN.lastEcommerceOrderTs:"")+(String(cS).length?"&_ref="+m(bt(cS.slice(0,cB))):"")+(cK?"&cs="+m(cK):"")+"&send_image=0";for(cT in co){if(Object.prototype.hasOwnProperty.call(co,cT)){cz+="&"+cT+"="+co[cT]}}var cZ=[];if(cU){for(cT in cU){if(Object.prototype.hasOwnProperty.call(cU,cT)&&/^dimension\d+$/.test(cT)){var cD=cT.replace("dimension","");cZ.push(parseInt(cD,10));cZ.push(String(cD));cz+="&"+cT+"="+cU[cT];delete cU[cT]}}}if(cU&&s(cU)){cU=null -}for(cT in aT){if(Object.prototype.hasOwnProperty.call(aT,cT)){var cJ=(-1===cZ.indexOf(cT));if(cJ){cz+="&dimension"+cT+"="+aT[cT]}}}if(cU){cz+="&data="+m(JSON2.stringify(cU))}else{if(Y){cz+="&data="+m(JSON2.stringify(Y))}}function cG(c1,c2){var c3=JSON2.stringify(c1);if(c3.length>2){return"&"+c2+"="+m(c3)}return""}var cY=cw(bn);var cP=cw(bM);cz+=cG(cY,"cvar");cz+=cG(cP,"e_cvar");if(at){cz+=cG(at,"_cvar");for(cT in cQ){if(Object.prototype.hasOwnProperty.call(cQ,cT)){if(at[cT][0]===""||at[cT][1]===""){delete at[cT]}}}if(bi){ct(cL,JSON2.stringify(at),bP,aW,cf)}}if(aE){if(bN){cz+=">_ms="+bN}else{if(f&&f.timing&&f.timing.requestStart&&f.timing.responseEnd){cz+=">_ms="+(f.timing.responseEnd-f.timing.requestStart)}}}cN.lastEcommerceOrderTs=y(cA)&&String(cA).length?cA:cN.lastEcommerceOrderTs;ao(cN);bE();cz+=Q(cV);if(ch.length){cz+="&"+ch}if(r(bC)){cz=bC(cz)}return cz}bj=function aI(){var cx=new Date();if(cg+aH<=cx.getTime()){var cy=bS("ping=1",null,"ping");a8(cy,bb);return true}return false -};function aX(cA,cz,cE,cB,cx,cH){var cC="idgoal=0",cD,cy=new Date(),cF=[],cG;if(String(cA).length){cC+="&ec_id="+m(cA);cD=Math.round(cy.getTime()/1000)}cC+="&revenue="+cz;if(String(cE).length){cC+="&ec_st="+cE}if(String(cB).length){cC+="&ec_tx="+cB}if(String(cx).length){cC+="&ec_sh="+cx}if(String(cH).length){cC+="&ec_dt="+cH}if(ci){for(cG in ci){if(Object.prototype.hasOwnProperty.call(ci,cG)){if(!y(ci[cG][1])){ci[cG][1]=""}if(!y(ci[cG][2])){ci[cG][2]=""}if(!y(ci[cG][3])||String(ci[cG][3]).length===0){ci[cG][3]=0}if(!y(ci[cG][4])||String(ci[cG][4]).length===0){ci[cG][4]=1}cF.push(ci[cG])}}cC+="&ec_items="+m(JSON2.stringify(cF))}cC=bS(cC,Y,"ecommerce",cD);a8(cC,bb)}function bq(cx,cB,cA,cz,cy,cC){if(String(cx).length&&y(cB)){aX(cx,cB,cA,cz,cy,cC)}}function aY(cx){if(y(cx)){aX("",cx,"","","","")}}function br(cz,cA){var cx=new Date(),cy=bS("action_name="+m(V(cz||aQ)),cA,"log");a8(cy,bb)}function aC(cz,cy){var cA,cx="(^| )(piwik[_-]"+cy;if(cz){for(cA=0;cA<cz.length;cA++){cx+="|"+cz[cA]}}cx+=")( |$)"; -return new RegExp(cx)}function ax(cx){return(ai&&cx&&0===String(cx).indexOf(ai))}function bT(cB,cx,cC,cy){if(ax(cx)){return 0}var cA=aC(bd,"download"),cz=aC(aJ,"link"),cD=new RegExp("\\.("+cn.join("|")+")([?&#]|$)","i");if(cz.test(cB)){return"link"}if(cy||cA.test(cB)||cD.test(cx)){return"download"}if(cC){return 0}return"link"}function ac(cy){var cx;cx=cy.parentNode;while(cx!==null&&y(cx)){if(S.isLinkElement(cy)){break}cy=cx;cx=cy.parentNode}return cy}function cr(cC){cC=ac(cC);if(!S.hasNodeAttribute(cC,"href")){return}if(!y(cC.href)){return}var cB=S.getAttributeValueFromNode(cC,"href");if(ax(cB)){return}var cy=cC.pathname||bL(cC.href);var cD=cC.hostname||c(cC.href);var cE=cD.toLowerCase();var cz=cC.href.replace(cD,cE);var cA=new RegExp("^(javascript|vbscript|jscript|mocha|livescript|ecmascript|mailto):","i");if(!cA.test(cz)){var cx=bT(cC.className,cz,ab(cE,cy),S.hasNodeAttribute(cC,"download"));if(cx){return{type:cx,href:cz}}}}function ar(cx,cy,cz,cA){var cB=n.buildInteractionRequestParams(cx,cy,cz,cA); -if(!cB){return}return bS(cB,null,"contentInteraction")}function b6(cz,cA,cE,cx,cy){if(!y(cz)){return}if(ax(cz)){return cz}var cC=n.toAbsoluteUrl(cz);var cB="redirecturl="+m(cC)+"&";cB+=ar(cA,cE,cx,(cy||cz));var cD="&";if(ai.indexOf("?")<0){cD="?"}return ai+cD+cB}function aM(cx,cy){if(!cx||!cy){return false}var cz=n.findTargetNode(cx);if(n.shouldIgnoreInteraction(cz)){return false}cz=n.findTargetNodeNoDefault(cx);if(cz&&!J(cz,cy)){return false}return true}function bU(cz,cy,cB){if(!cz){return}var cx=n.findParentContentNode(cz);if(!cx){return}if(!aM(cx,cz)){return}var cA=n.buildContentBlock(cx);if(!cA){return}if(!cA.target&&cB){cA.target=cB}return n.buildInteractionRequestParams(cy,cA.name,cA.piece,cA.target)}function az(cy){if(!bB||!bB.length){return false}var cx,cz;for(cx=0;cx<bB.length;cx++){cz=bB[cx];if(cz&&cz.name===cy.name&&cz.piece===cy.piece&&cz.target===cy.target){return true}}return false}function a7(cA){if(!cA){return false}var cD=n.findTargetNode(cA);if(!cD||n.shouldIgnoreInteraction(cD)){return false -}var cE=cr(cD);if(cp&&cE&&cE.type){return false}if(S.isLinkElement(cD)&&S.hasNodeAttributeWithValue(cD,"href")){var cx=String(S.getAttributeValueFromNode(cD,"href"));if(0===cx.indexOf("#")){return false}if(ax(cx)){return true}if(!n.isUrlToCurrentDomain(cx)){return false}var cB=n.buildContentBlock(cA);if(!cB){return}var cz=cB.name;var cF=cB.piece;var cC=cB.target;if(!S.hasNodeAttributeWithValue(cD,n.CONTENT_TARGET_ATTR)||cD.wasContentTargetAttrReplaced){cD.wasContentTargetAttrReplaced=true;cC=n.toAbsoluteUrl(cx);S.setAnyAttribute(cD,n.CONTENT_TARGET_ATTR,cC)}var cy=b6(cx,"click",cz,cF,cC);n.setHrefAttribute(cD,cy);return true}return false}function ap(cy){if(!cy||!cy.length){return}var cx;for(cx=0;cx<cy.length;cx++){a7(cy[cx])}}function aB(cx){return function(cy){if(!cx){return}var cB=n.findParentContentNode(cx);var cC;if(cy){cC=cy.target||cy.srcElement}if(!cC){cC=cx}if(!aM(cB,cC)){return}bH(bb);if(S.isLinkElement(cx)&&S.hasNodeAttributeWithValue(cx,"href")&&S.hasNodeAttributeWithValue(cx,n.CONTENT_TARGET_ATTR)){var cz=S.getAttributeValueFromNode(cx,"href"); -if(!ax(cz)&&cx.wasContentTargetAttrReplaced){S.setAnyAttribute(cx,n.CONTENT_TARGET_ATTR,"")}}var cG=cr(cx);if(Z&&cG&&cG.type){return cG.type}if(a7(cB)){return"href"}var cD=n.buildContentBlock(cB);if(!cD){return}var cA=cD.name;var cH=cD.piece;var cF=cD.target;var cE=ar("click",cA,cH,cF);a8(cE,bb);return cE}}function bs(cz){if(!cz||!cz.length){return}var cx,cy;for(cx=0;cx<cz.length;cx++){cy=n.findTargetNode(cz[cx]);if(cy&&!cy.contentInteractionTrackingSetupDone){cy.contentInteractionTrackingSetupDone=true;X(cy,"click",aB(cy))}}}function a2(cz,cA){if(!cz||!cz.length){return[]}var cx,cy;for(cx=0;cx<cz.length;cx++){if(az(cz[cx])){cz.splice(cx,1);cx--}else{bB.push(cz[cx])}}if(!cz||!cz.length){return[]}ap(cA);bs(cA);var cB=[];for(cx=0;cx<cz.length;cx++){cy=bS(n.buildImpressionRequestParams(cz[cx].name,cz[cx].piece,cz[cx].target),undefined,"contentImpressions");cB.push(cy)}return cB}function bX(cy){var cx=n.collectContent(cy);return a2(cx,cy)}function aK(cy){if(!cy||!cy.length){return[]}var cx; -for(cx=0;cx<cy.length;cx++){if(!n.isNodeVisible(cy[cx])){cy.splice(cx,1);cx--}}if(!cy||!cy.length){return[]}return bX(cy)}function ak(cz,cx,cy){var cA=n.buildImpressionRequestParams(cz,cx,cy);return bS(cA,null,"contentImpression")}function cs(cA,cy){if(!cA){return}var cx=n.findParentContentNode(cA);var cz=n.buildContentBlock(cx);if(!cz){return}if(!cy){cy="Unknown"}return ar(cy,cz.name,cz.piece,cz.target)}function b8(cy,cA,cx,cz){return"e_c="+m(cy)+"&e_a="+m(cA)+(y(cx)?"&e_n="+m(cx):"")+(y(cz)?"&e_v="+m(cz):"")}function ad(cz,cB,cx,cA,cC){if(String(cz).length===0||String(cB).length===0){return false}var cy=bS(b8(cz,cB,cx,cA),cC,"event");a8(cy,bb)}function bA(cx,cA,cy,cB){var cz=bS("search="+m(cx)+(cA?"&search_cat="+m(cA):"")+(y(cy)?"&search_count="+cy:""),cB,"sitesearch");a8(cz,bb)}function cc(cx,cA,cz){var cy=bS("idgoal="+cx+(cA?"&revenue="+cA:""),cz,"goal");a8(cy,bb)}function cj(cA,cx,cE,cD,cz){var cC=cx+"="+m(bt(cA));var cy=bU(cz,"click",cA);if(cy){cC+="&"+cy}var cB=bS(cC,cE,"link");a8(cB,(cD?0:bb),cD) -}function bk(cy,cx){if(cy!==""){return cy+cx.charAt(0).toUpperCase()+cx.slice(1)}return cx}function bI(cC){var cB,cx,cA=["","webkit","ms","moz"],cz;if(!aO){for(cx=0;cx<cA.length;cx++){cz=cA[cx];if(Object.prototype.hasOwnProperty.call(w,bk(cz,"hidden"))){if(w[bk(cz,"visibilityState")]==="prerender"){cB=true}break}}}if(cB){X(w,cz+"visibilitychange",function cy(){w.removeEventListener(cz+"visibilitychange",cy,false);cC()});return}cC()}function an(cx){if(w.readyState==="complete"){cx()}else{if(I.addEventListener){I.addEventListener("load",cx)}else{if(I.attachEvent){I.attachEvent("onLoad",cx)}}}}function aN(cy){var cx=false;if(w.attachEvent){cx=w.readyState==="complete"}else{cx=w.readyState!=="loading"}if(cx){cy()}else{if(w.addEventListener){w.addEventListener("DOMContentLoaded",cy)}else{if(w.attachEvent){w.attachEvent("onreadystatechange",cy)}}}}function b3(cx){var cy=cr(cx);if(cy&&cy.type){cy.href=j(cy.href);cj(cy.href,cy.type,undefined,null,cx)}}function bW(){return w.all&&!w.addEventListener -}function ce(cx){var cz=cx.which;var cy=(typeof cx.button);if(!cz&&cy!=="undefined"){if(bW()){if(cx.button&1){cz=1}else{if(cx.button&2){cz=3}else{if(cx.button&4){cz=2}}}}else{if(cx.button===0||cx.button==="0"){cz=1}else{if(cx.button&1){cz=2}else{if(cx.button&2){cz=3}}}}}return cz}function bl(cx){switch(ce(cx)){case 1:return"left";case 2:return"middle";case 3:return"right"}}function aD(cx){return cx.target||cx.srcElement}function ag(cx){return function(cA){cA=cA||I.event;var cz=bl(cA);var cB=aD(cA);if(cA.type==="click"){var cy=false;if(cx&&cz==="middle"){cy=true}if(cB&&!cy){b3(cB)}}else{if(cA.type==="mousedown"){if(cz==="middle"&&cB){au=cz;a5=cB}else{au=a5=null}}else{if(cA.type==="mouseup"){if(cz===au&&cB===a5){b3(cB)}au=a5=null}else{if(cA.type==="contextmenu"){b3(cB)}}}}}}function aa(cy,cx){X(cy,"click",ag(cx),false);if(cx){X(cy,"mouseup",ag(cx),false);X(cy,"mousedown",ag(cx),false);X(cy,"contextmenu",ag(cx),false)}}function a6(cy){if(!Z){Z=true;var cz,cx=aC(a4,"ignore"),cA=w.links;if(cA){for(cz=0; -cz<cA.length;cz++){if(!cx.test(cA[cz].className)){aa(cA[cz],cy)}}}}}function av(cz,cB,cC){if(bG){return true}bG=true;var cD=false;var cA,cy;function cx(){cD=true}an(function(){function cE(cG){setTimeout(function(){if(!bG){return}cD=false;cC.trackVisibleContentImpressions();cE(cG)},cG)}function cF(cG){setTimeout(function(){if(!bG){return}if(cD){cD=false;cC.trackVisibleContentImpressions()}cF(cG)},cG)}if(cz){cA=["scroll","resize"];for(cy=0;cy<cA.length;cy++){if(w.addEventListener){w.addEventListener(cA[cy],cx)}else{I.attachEvent("on"+cA[cy],cx)}}cF(100)}if(cB&&cB>0){cB=parseInt(cB,10);cE(cB)}})}function b1(){var cy,cz,cA={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"},cx=I.devicePixelRatio||1;if(!((new RegExp("MSIE")).test(e.userAgent))){if(e.mimeTypes&&e.mimeTypes.length){for(cy in cA){if(Object.prototype.hasOwnProperty.call(cA,cy)){cz=e.mimeTypes[cA[cy]]; -co[cy]=(cz&&cz.enabledPlugin)?"1":"0"}}}if(typeof navigator.javaEnabled!=="unknown"&&y(e.javaEnabled)&&e.javaEnabled()){co.java="1"}if(r(I.GearsFactory)){co.gears="1"}co.cookie=bw()}co.res=M.width*cx+"x"+M.height*cx}b1();aP();ao();return{getVisitorId:function(){return aA().uuid},getVisitorInfo:function(){return b7()},getAttributionInfo:function(){return be()},getAttributionCampaignName:function(){return be()[0]},getAttributionCampaignKeyword:function(){return be()[1]},getAttributionReferrerTimestamp:function(){return be()[2]},getAttributionReferrerUrl:function(){return be()[3]},setTrackerUrl:function(cx){ai=cx},getTrackerUrl:function(){return ai},getSiteId:function(){return bx},setSiteId:function(cx){bu(cx)},setUserId:function(cx){if(!y(cx)||!cx.length){return}a3=cx;bg=by(a3).substr(0,16)},getUserId:function(){return a3},setCustomData:function(cx,cy){if(L(cx)){Y=cx}else{if(!Y){Y={}}Y[cx]=cy}},getCustomData:function(){return Y},setCustomRequestProcessing:function(cx){bC=cx},appendToTrackingUrl:function(cx){ch=cx -},getRequest:function(cx){return bS(cx)},addPlugin:function(cx,cy){a[cx]=cy},setCustomDimension:function(cx,cy){cx=parseInt(cx,10);if(cx>0){if(!y(cy)){cy=""}if(!o(cy)){cy=String(cy)}aT[cx]=cy}},getCustomDimension:function(cx){cx=parseInt(cx,10);if(cx>0&&Object.prototype.hasOwnProperty.call(aT,cx)){return aT[cx]}},deleteCustomDimension:function(cx){cx=parseInt(cx,10);if(cx>0){delete aT[cx]}},setCustomVariable:function(cy,cx,cB,cz){var cA;if(!y(cz)){cz="visit"}if(!y(cx)){return}if(!y(cB)){cB=""}if(cy>0){cx=!o(cx)?String(cx):cx;cB=!o(cB)?String(cB):cB;cA=[cx.slice(0,aZ),cB.slice(0,aZ)];if(cz==="visit"||cz===2){b0();at[cy]=cA}else{if(cz==="page"||cz===3){bn[cy]=cA}else{if(cz==="event"){bM[cy]=cA}}}}},getCustomVariable:function(cy,cz){var cx;if(!y(cz)){cz="visit"}if(cz==="page"||cz===3){cx=bn[cy]}else{if(cz==="event"){cx=bM[cy]}else{if(cz==="visit"||cz===2){b0();cx=at[cy]}}}if(!y(cx)||(cx&&cx[0]==="")){return false}return cx},deleteCustomVariable:function(cx,cy){if(this.getCustomVariable(cx,cy)){this.setCustomVariable(cx,"","",cy) -}},storeCustomVariablesInCookie:function(){bi=true},setLinkTrackingTimer:function(cx){bb=cx},setDownloadExtensions:function(cx){if(o(cx)){cx=cx.split("|")}cn=cx},addDownloadExtensions:function(cy){var cx;if(o(cy)){cy=cy.split("|")}for(cx=0;cx<cy.length;cx++){cn.push(cy[cx])}},removeDownloadExtensions:function(cz){var cy,cx=[];if(o(cz)){cz=cz.split("|")}for(cy=0;cy<cn.length;cy++){if(B(cz,cn[cy])===-1){cx.push(cn[cy])}}cn=cx},setDomains:function(cx){ae=o(cx)?[cx]:cx;var cz=false,cy;for(cy in ae){if(Object.prototype.hasOwnProperty.call(ae,cy)&&b2(cd,A(ae[cy]))){cz=true;break}}if(!cz){ae.push(cd)}},setIgnoreClasses:function(cx){a4=o(cx)?[cx]:cx},setRequestMethod:function(cx){cq=cx||bJ},setRequestContentType:function(cx){bV=cx||am},setReferrerUrl:function(cx){aU=cx},setCustomUrl:function(cx){aG=bm(bf,cx)},setDocumentTitle:function(cx){aQ=cx},setAPIUrl:function(cx){ba=cx},setDownloadClasses:function(cx){bd=o(cx)?[cx]:cx},setLinkClasses:function(cx){aJ=o(cx)?[cx]:cx},setCampaignNameKey:function(cx){bR=o(cx)?[cx]:cx -},setCampaignKeywordKey:function(cx){a9=o(cx)?[cx]:cx},discardHashTag:function(cx){bh=cx},setCookieNamePrefix:function(cx){aR=cx;at=bo()},setCookieDomain:function(cx){var cy=A(cx);if(a1(cy)){cf=cy;aP()}},setCookiePath:function(cx){aW=cx;aP()},setVisitorCookieTimeout:function(cx){b5=cx*1000},setSessionCookieTimeout:function(cx){bP=cx*1000},setReferralCookieTimeout:function(cx){cm=cx*1000},setConversionAttributionFirstReferrer:function(cx){a0=cx},disableCookies:function(){aS=true;co.cookie="0";if(bx){aj()}},deleteCookies:function(){aj()},setDoNotTrack:function(cy){var cx=e.doNotTrack||e.msDoNotTrack;b9=cy&&(cx==="yes"||cx==="1");if(b9){this.disableCookies()}},addListener:function(cy,cx){aa(cy,cx)},enableLinkTracking:function(cx){cp=true;if(q){a6(cx)}else{G.push(function(){a6(cx)})}},enableJSErrorTracking:function(){if(cb){return}cb=true;var cx=I.onerror;I.onerror=function(cC,cA,cz,cB,cy){bI(function(){var cD="JavaScript Errors";var cE=cA+":"+cz;if(cB){cE+=":"+cB}ad(cD,cE,cC)});if(cx){return cx(cC,cA,cz,cB,cy) -}return false}},disablePerformanceTracking:function(){aE=false},setGenerationTimeMs:function(cx){bN=parseInt(cx,10)},enableHeartBeatTimer:function(cx){cx=Math.max(cx,1);aH=(cx||15)*1000;if(cg!==null){cv()}},killFrame:function(){if(I.location!==I.top.location){I.top.location=I.location}},redirectFile:function(cx){if(I.location.protocol==="file:"){I.location=cx}},setCountPreRendered:function(cx){aO=cx},trackGoal:function(cx,cz,cy){bI(function(){cc(cx,cz,cy)})},trackLink:function(cy,cx,cA,cz){bI(function(){cj(cy,cx,cA,cz)})},trackPageView:function(cx,cy){bB=[];if(C(bx)){bI(function(){O(ai,ba,bx)})}else{bI(function(){br(cx,cy)})}},trackAllContentImpressions:function(){if(C(bx)){return}bI(function(){aN(function(){var cx=n.findContentNodes();var cy=bX(cx);cu(cy,bb)})})},trackVisibleContentImpressions:function(cx,cy){if(C(bx)){return}if(!y(cx)){cx=true}if(!y(cy)){cy=750}av(cx,cy,this);bI(function(){an(function(){var cz=n.findContentNodes();var cA=aK(cz);cu(cA,bb)})})},trackContentImpression:function(cz,cx,cy){if(C(bx)){return -}if(!cz){return}cx=cx||"Unknown";bI(function(){var cA=ak(cz,cx,cy);a8(cA,bb)})},trackContentImpressionsWithinNode:function(cx){if(C(bx)||!cx){return}bI(function(){if(bG){an(function(){var cy=n.findContentNodesWithinNode(cx);var cz=aK(cy);cu(cz,bb)})}else{aN(function(){var cy=n.findContentNodesWithinNode(cx);var cz=bX(cy);cu(cz,bb)})}})},trackContentInteraction:function(cz,cA,cx,cy){if(C(bx)){return}if(!cz||!cA){return}cx=cx||"Unknown";bI(function(){var cB=ar(cz,cA,cx,cy);a8(cB,bb)})},trackContentInteractionNode:function(cy,cx){if(C(bx)||!cy){return}bI(function(){var cz=cs(cy,cx);a8(cz,bb)})},logAllContentBlocksOnPage:function(){var cy=n.findContentNodes();var cx=n.collectContent(cy);if(console!==undefined&&console&&console.log){console.log(cx)}},trackEvent:function(cy,cA,cx,cz,cB){bI(function(){ad(cy,cA,cx,cz,cB)})},trackSiteSearch:function(cx,cz,cy,cA){bI(function(){bA(cx,cz,cy,cA)})},setEcommerceView:function(cA,cx,cz,cy){if(!y(cz)||!cz.length){cz=""}else{if(cz instanceof Array){cz=JSON2.stringify(cz) -}}bn[5]=["_pkc",cz];if(y(cy)&&String(cy).length){bn[2]=["_pkp",cy]}if((!y(cA)||!cA.length)&&(!y(cx)||!cx.length)){return}if(y(cA)&&cA.length){bn[3]=["_pks",cA]}if(!y(cx)||!cx.length){cx=""}bn[4]=["_pkn",cx]},addEcommerceItem:function(cB,cx,cz,cy,cA){if(cB.length){ci[cB]=[cB,cx,cz,cy,cA]}},trackEcommerceOrder:function(cx,cB,cA,cz,cy,cC){bq(cx,cB,cA,cz,cy,cC)},trackEcommerceCartUpdate:function(cx){aY(cx)}}}function x(){return{push:T}}function b(ad,ac){var ae={};var aa,ab;for(aa=0;aa<ac.length;aa++){var Y=ac[aa];ae[Y]=1;for(ab=0;ab<ad.length;ab++){if(ad[ab]&&ad[ab][0]){var Z=ad[ab][0];if(Y===Z){T(ad[ab]);delete ad[ab];if(ae[Z]>1){if(console!==undefined&&console&&console.error){console.error("The method "+Z+' 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: http://developer.piwik.org/guides/tracking-javascript-guide#multiple-piwik-trackers')}}ae[Z]++}}}}return ad}X(I,"beforeunload",U,false);p(); -Date.prototype.getTimeAlias=Date.prototype.getTime;N=new F();var t=["disableCookies","setTrackerUrl","setAPIUrl","setCookiePath","setCookieDomain","setUserId","setSiteId","enableLinkTracking"];_paq=b(_paq,t);for(v=0;v<_paq.length;v++){if(_paq[v]){T(_paq[v])}}_paq=new x();d={addPlugin:function(Y,Z){a[Y]=Z},getTracker:function(Y,Z){if(!y(Z)){Z=this.getAsyncTracker().getSiteId()}if(!y(Y)){Y=this.getAsyncTracker().getTrackerUrl()}return new F(Y,Z)},getAsyncTracker:function(){return N}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return d})}return d}())}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=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=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()}}; +}var ad=aa[2],Y=aa[3],ab=aa[4];if(!ab){ab=""}else{if(ab.indexOf("&segment=")===0){ab=ab.substr("&segment=".length)}}I.name=ag+"###"+ad+"###"+Y+"###"+ab}var af=I.name.split("###");return af.length===4&&af[0]===ag}function O(Z,af,ab){var ae=I.name.split("###"),ad=ae[1],Y=ae[2],ac=ae[3],aa=D(Z,af);i(aa+"plugins/Overlay/client/client.js?v=1",function(){Piwik_Overlay_Client.initialize(aa,ab,ad,Y,ac)})}function F(bH,bB){var bx=P(w.domain,I.location.href,z()),cf=A(bx[0]),bh=j(bx[1]),aW=j(bx[2]),cd=false,bL="GET",cs=bL,am="application/x-www-form-urlencoded; charset=UTF-8",bX=am,ai=bH||"",bc="",cj="",bz=bB||"",a5="",bi="",aG,aS=w.title,cp=["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","sea","sit","tar","tbz","tbz2","bz","bz2","tgz","torrent","txt","wav","wma","wmv","wpd","xls","xlsx","xml","z","zip"],ae=[cf],a6=[],bf=[],aJ=[],bd=500,b6,aH,bl,bj,Y,bT=["pk_campaign","piwik_campaign","utm_campaign","utm_source","utm_medium"],bb=["pk_kwd","piwik_kwd","utm_term"],aT="_pk_",ch,aY,aU=false,cb,aQ,a2,b7=33955200000,bR=1800000,co=15768000000,aE=true,bP=0,bk=false,at=false,bE,bp={},bO={},aV={},a1=200,ck={},cq={},bD=[],bI=false,b0=false,Z=false,cr=false,aq=false,ci=null,bF,au,a7,bA=W,aX; +function cv(cF,cC,cB,cE,cA,cD){if(aU){return}var cz;if(cB){cz=new Date();cz.setTime(cz.getTime()+cB)}w.cookie=cF+"="+m(cC)+(cB?";expires="+cz.toGMTString():"")+";path="+(cE||"/")+(cA?";domain="+cA:"")+(cD?";secure":"")}function ah(cB){if(aU){return 0}var cz=new RegExp("(^|;)[ ]*"+cB+"=([^;]*)"),cA=cz.exec(w.cookie);return cA?H(cA[2]):0}function bv(cz){var cA;if(bj){cA=new RegExp("#.*");return cz.replace(cA,"")}return cz}function bo(cB,cz){var cC=l(cz),cA;if(cC){return cz}if(cz.slice(0,1)==="/"){return l(cB)+"://"+c(cB)+cz}cB=bv(cB);cA=cB.indexOf("?");if(cA>=0){cB=cB.slice(0,cA)}cA=cB.lastIndexOf("/");if(cA!==cB.length-1){cB=cB.slice(0,cA+1)}return cB+cz}function b4(cB,cz){var cA;cB=String(cB).toLowerCase();cz=String(cz).toLowerCase();if(cB===cz){return true}if(cz.slice(0,1)==="."){if(cB===cz.slice(1)){return true}cA=cB.length-cz.length;if((cA>0)&&(cB.slice(cA)===cz)){return true}}return false}function cm(cA,cz){cA=String(cA);return cA.indexOf(cz,cA.length-cz.length)!==-1}function aP(cA,cz){cA=String(cA); +return cA.substr(0,cA.length-cz)}function bN(cz){var cA=document.createElement("a");if(cz.indexOf("//")!==0&&cz.indexOf("http")!==0){cz="http://"+cz}cA.href=n.toAbsoluteUrl(cz);if(cA.pathname){return cA.pathname}return""}function aF(cA,cz){var cB=(!cz||cz==="/");if(cB){return true}if(cA===cz){return true}if(!cA){return false}cz=String(cz).toLowerCase();cA=String(cA).toLowerCase();if(!cm(cA,"/")){cA+="/"}if(!cm(cz,"/")){cz+="/"}return cA.indexOf(cz)===0}function ab(cD,cF){var cA,cz,cB,cC,cE;for(cA=0;cA<ae.length;cA++){cC=A(ae[cA]);cE=bN(ae[cA]);if(b4(cD,cC)&&aF(cF,cE)){return true}}return false}function ay(cC){var cA,cz,cB;for(cA=0;cA<ae.length;cA++){cz=A(ae[cA].toLowerCase());if(cC===cz){return true}if(cz.slice(0,1)==="."){if(cC===cz.slice(1)){return true}cB=cC.length-cz.length;if((cB>0)&&(cC.slice(cB)===cz)){return true}}}return false}function bS(cz,cB){var cA=new Image(1,1);cA.onload=function(){v=0;if(typeof cB==="function"){cB()}};cA.src=ai+(ai.indexOf("?")<0?"?":"&")+cz}function cn(cA,cD,cz){if(!y(cz)||null===cz){cz=true +}try{var cC=I.XMLHttpRequest?new I.XMLHttpRequest():I.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;cC.open("POST",ai,true);cC.onreadystatechange=function(){if(this.readyState===4&&!(this.status>=200&&this.status<300)&&cz){bS(cA,cD)}else{if(typeof cD==="function"){cD()}}};cC.setRequestHeader("Content-Type",bX);cC.send(cA)}catch(cB){if(cz){bS(cA,cD)}}}function bJ(cA){var cz=new Date();var cB=cz.getTime()+cA;if(!k||cB>k){k=cB}}function bQ(cz){if(bF||!aH){return}bF=setTimeout(function cA(){bF=null;if(bl()){return}var cB=new Date(),cC=aH-(cB.getTime()-ci);cC=Math.min(aH,cC);bQ(cC)},cz||aH)}function be(){if(!bF){return}clearTimeout(bF);bF=null}function aM(){if(bl()){return}bQ()}function af(){be()}function cx(){if(aq||!aH){return}aq=true;X(I,"focus",aM);X(I,"blur",af);bQ()}function b1(cD){var cA=new Date();var cz=cA.getTime();ci=cz;if(b0&&cz<b0){var cB=b0-cz;setTimeout(cD,cB);bJ(cB+50);b0+=50;return}if(b0===false){var cC=800;b0=cz+cC}cD()}function ba(cA,cz,cB){if(!cb&&cA){b1(function(){if(cs==="POST"){cn(cA,cB) +}else{bS(cA,cB)}bJ(cz)})}if(!aq){cx()}else{bQ()}}function bM(cz){if(cb){return false}return(cz&&cz.length)}function cw(cB,cz){if(!bM(cB)){return}var cA='{"requests":["?'+cB.join('","?')+'"]}';b1(function(){cn(cA,null,false);bJ(cz)})}function aw(cz){return aT+cz+"."+bz+"."+aX}function by(){if(aU){return"0"}if(!y(e.cookieEnabled)){var cz=aw("testcookie");cv(cz,"1");return ah(cz)==="1"?"1":"0"}return e.cookieEnabled?"1":"0"}function aR(){aX=bA((ch||cf)+(aY||"/")).slice(0,4)}function bq(){var cA=aw("cvar"),cz=ah(cA);if(cz.length){cz=JSON2.parse(cz);if(L(cz)){return cz}}return{}}function b2(){if(at===false){at=bq()}}function cc(){return bA((e.userAgent||"")+(e.platform||"")+JSON2.stringify(cq)+(new Date()).getTime()+Math.random()).slice(0,16)}function b9(){var cB=new Date(),cz=Math.round(cB.getTime()/1000),cA=aw("id"),cE=ah(cA),cD,cC;if(cE){cD=cE.split(".");cD.unshift("0");if(bi.length){cD[1]=bi}return cD}if(bi.length){cC=bi}else{if("0"===by()){cC=""}else{cC=cc()}}cD=["1",cC,cz,0,cz,"",""];return cD +}function aA(){var cG=b9(),cC=cG[0],cD=cG[1],cA=cG[2],cz=cG[3],cE=cG[4],cB=cG[5];if(!y(cG[6])){cG[6]=""}var cF=cG[6];return{newVisitor:cC,uuid:cD,createTs:cA,visitCount:cz,currentVisitTs:cE,lastVisitTs:cB,lastEcommerceOrderTs:cF}}function al(){var cC=new Date(),cA=cC.getTime(),cD=aA().createTs;var cz=parseInt(cD,10);var cB=(cz*1000)+b7-cA;return cB}function ao(cz){if(!bz){return}var cB=new Date(),cA=Math.round(cB.getTime()/1000);if(!y(cz)){cz=aA()}var cC=cz.uuid+"."+cz.createTs+"."+cz.visitCount+"."+cA+"."+cz.lastVisitTs+"."+cz.lastEcommerceOrderTs;cv(aw("id"),cC,al(),aY,ch)}function bg(){var cz=ah(aw("ref"));if(cz.length){try{cz=JSON2.parse(cz);if(L(cz)){return cz}}catch(cA){}}return["","",0,""]}function br(cB,cA,cz){cv(cB,"",-86400,cA,cz)}function a3(cA){var cz="testvalue";cv("test",cz,10000,null,cA);if(ah("test")===cz){br("test",null,cA);return true}return false}function aj(){var cB=aU;aU=false;var cz=["id","ses","cvar","ref"];var cA,cC;for(cA=0;cA<cz.length;cA++){cC=aw(cz[cA]);if(0!==ah(cC)){br(cC,aY,ch) +}}aU=cB}function bw(cz){bz=cz;ao()}function cy(cD){if(!cD||!L(cD)){return}var cC=[];var cB;for(cB in cD){if(Object.prototype.hasOwnProperty.call(cD,cB)){cC.push(cB)}}var cE={};cC.sort();var cz=cC.length;var cA;for(cA=0;cA<cz;cA++){cE[cC[cA]]=cD[cC[cA]]}return cE}function bG(){cv(aw("ses"),"*",bR,aY,ch)}function bU(cB,cW,cX,cC){var cV,cA=new Date(),cJ=Math.round(cA.getTime()/1000),cG,cU,cD=1024,c2,cK,cS=at,cE=aw("ses"),cQ=aw("ref"),cN=aw("cvar"),cO=ah(cE),cT=bg(),cZ=aG||bh,cH,cz;if(aU){aj()}if(cb){return""}var cP=aA();if(!y(cC)){cC=""}var cM=w.characterSet||w.charset;if(!cM||cM.toLowerCase()==="utf-8"){cM=null}cH=cT[0];cz=cT[1];cG=cT[2];cU=cT[3];if(!cO){var cY=bR/1000;if(!cP.lastVisitTs||(cJ-cP.lastVisitTs)>cY){cP.visitCount++;cP.lastVisitTs=cP.currentVisitTs}if(!a2||!cH.length){for(cV in bT){if(Object.prototype.hasOwnProperty.call(bT,cV)){cH=K(cZ,bT[cV]);if(cH.length){break}}}for(cV in bb){if(Object.prototype.hasOwnProperty.call(bb,cV)){cz=K(cZ,bb[cV]);if(cz.length){break}}}}c2=c(aW);cK=cU.length?c(cU):""; +if(c2.length&&!ay(c2)&&(!a2||!cK.length||ay(cK))){cU=aW}if(cU.length||cH.length){cG=cJ;cT=[cH,cz,cG,bv(cU.slice(0,cD))];cv(cQ,JSON2.stringify(cT),co,aY,ch)}}cB+="&idsite="+bz+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+cA.getHours()+"&m="+cA.getMinutes()+"&s="+cA.getSeconds()+"&url="+m(bv(cZ))+(aW.length?"&urlref="+m(bv(aW)):"")+((a5&&a5.length)?"&uid="+m(a5):"")+"&_id="+cP.uuid+"&_idts="+cP.createTs+"&_idvc="+cP.visitCount+"&_idn="+cP.newVisitor+(cH.length?"&_rcn="+m(cH):"")+(cz.length?"&_rck="+m(cz):"")+"&_refts="+cG+"&_viewts="+cP.lastVisitTs+(String(cP.lastEcommerceOrderTs).length?"&_ects="+cP.lastEcommerceOrderTs:"")+(String(cU).length?"&_ref="+m(bv(cU.slice(0,cD))):"")+(cM?"&cs="+m(cM):"")+"&send_image=0";for(cV in cq){if(Object.prototype.hasOwnProperty.call(cq,cV)){cB+="&"+cV+"="+cq[cV]}}var c1=[];if(cW){for(cV in cW){if(Object.prototype.hasOwnProperty.call(cW,cV)&&/^dimension\d+$/.test(cV)){var cF=cV.replace("dimension","");c1.push(parseInt(cF,10));c1.push(String(cF));cB+="&"+cV+"="+cW[cV]; +delete cW[cV]}}}if(cW&&s(cW)){cW=null}for(cV in aV){if(Object.prototype.hasOwnProperty.call(aV,cV)){var cL=(-1===c1.indexOf(cV));if(cL){cB+="&dimension"+cV+"="+aV[cV]}}}if(cW){cB+="&data="+m(JSON2.stringify(cW))}else{if(Y){cB+="&data="+m(JSON2.stringify(Y))}}function cI(c3,c4){var c5=JSON2.stringify(c3);if(c5.length>2){return"&"+c4+"="+m(c5)}return""}var c0=cy(bp);var cR=cy(bO);cB+=cI(c0,"cvar");cB+=cI(cR,"e_cvar");if(at){cB+=cI(at,"_cvar");for(cV in cS){if(Object.prototype.hasOwnProperty.call(cS,cV)){if(at[cV][0]===""||at[cV][1]===""){delete at[cV]}}}if(bk){cv(cN,JSON2.stringify(at),bR,aY,ch)}}if(aE){if(bP){cB+=">_ms="+bP}else{if(f&&f.timing&&f.timing.requestStart&&f.timing.responseEnd){cB+=">_ms="+(f.timing.responseEnd-f.timing.requestStart)}}}cP.lastEcommerceOrderTs=y(cC)&&String(cC).length?cC:cP.lastEcommerceOrderTs;ao(cP);bG();cB+=Q(cX);if(cj.length){cB+="&"+cj}if(r(bE)){cB=bE(cB)}return cB}bl=function aI(){var cz=new Date();if(ci+aH<=cz.getTime()){var cA=bU("ping=1",null,"ping"); +ba(cA,bd);return true}return false};function aZ(cC,cB,cG,cD,cz,cJ){var cE="idgoal=0",cF,cA=new Date(),cH=[],cI;if(String(cC).length){cE+="&ec_id="+m(cC);cF=Math.round(cA.getTime()/1000)}cE+="&revenue="+cB;if(String(cG).length){cE+="&ec_st="+cG}if(String(cD).length){cE+="&ec_tx="+cD}if(String(cz).length){cE+="&ec_sh="+cz}if(String(cJ).length){cE+="&ec_dt="+cJ}if(ck){for(cI in ck){if(Object.prototype.hasOwnProperty.call(ck,cI)){if(!y(ck[cI][1])){ck[cI][1]=""}if(!y(ck[cI][2])){ck[cI][2]=""}if(!y(ck[cI][3])||String(ck[cI][3]).length===0){ck[cI][3]=0}if(!y(ck[cI][4])||String(ck[cI][4]).length===0){ck[cI][4]=1}cH.push(ck[cI])}}cE+="&ec_items="+m(JSON2.stringify(cH))}cE=bU(cE,Y,"ecommerce",cF);ba(cE,bd)}function bs(cz,cD,cC,cB,cA,cE){if(String(cz).length&&y(cD)){aZ(cz,cD,cC,cB,cA,cE)}}function a0(cz){if(y(cz)){aZ("",cz,"","","","")}}function bt(cB,cC){var cz=new Date(),cA=bU("action_name="+m(V(cB||aS)),cC,"log");ba(cA,bd)}function aC(cB,cA){var cC,cz="(^| )(piwik[_-]"+cA;if(cB){for(cC=0;cC<cB.length; +cC++){cz+="|"+cB[cC]}}cz+=")( |$)";return new RegExp(cz)}function ax(cz){return(ai&&cz&&0===String(cz).indexOf(ai))}function bV(cD,cz,cE,cA){if(ax(cz)){return 0}var cC=aC(bf,"download"),cB=aC(aJ,"link"),cF=new RegExp("\\.("+cp.join("|")+")([?&#]|$)","i");if(cB.test(cD)){return"link"}if(cA||cC.test(cD)||cF.test(cz)){return"download"}if(cE){return 0}return"link"}function ac(cA){var cz;cz=cA.parentNode;while(cz!==null&&y(cz)){if(S.isLinkElement(cA)){break}cA=cz;cz=cA.parentNode}return cA}function ct(cE){cE=ac(cE);if(!S.hasNodeAttribute(cE,"href")){return}if(!y(cE.href)){return}var cD=S.getAttributeValueFromNode(cE,"href");if(ax(cD)){return}var cA=cE.pathname||bN(cE.href);var cF=cE.hostname||c(cE.href);var cG=cF.toLowerCase();var cB=cE.href.replace(cF,cG);var cC=new RegExp("^(javascript|vbscript|jscript|mocha|livescript|ecmascript|mailto):","i");if(!cC.test(cB)){var cz=bV(cE.className,cB,ab(cG,cA),S.hasNodeAttribute(cE,"download"));if(cz){return{type:cz,href:cB}}}}function ar(cz,cA,cB,cC){var cD=n.buildInteractionRequestParams(cz,cA,cB,cC); +if(!cD){return}return bU(cD,null,"contentInteraction")}function b8(cB,cC,cG,cz,cA){if(!y(cB)){return}if(ax(cB)){return cB}var cE=n.toAbsoluteUrl(cB);var cD="redirecturl="+m(cE)+"&";cD+=ar(cC,cG,cz,(cA||cB));var cF="&";if(ai.indexOf("?")<0){cF="?"}return ai+cF+cD}function aN(cz,cA){if(!cz||!cA){return false}var cB=n.findTargetNode(cz);if(n.shouldIgnoreInteraction(cB)){return false}cB=n.findTargetNodeNoDefault(cz);if(cB&&!J(cB,cA)){return false}return true}function bW(cB,cA,cD){if(!cB){return}var cz=n.findParentContentNode(cB);if(!cz){return}if(!aN(cz,cB)){return}var cC=n.buildContentBlock(cz);if(!cC){return}if(!cC.target&&cD){cC.target=cD}return n.buildInteractionRequestParams(cA,cC.name,cC.piece,cC.target)}function az(cA){if(!bD||!bD.length){return false}var cz,cB;for(cz=0;cz<bD.length;cz++){cB=bD[cz];if(cB&&cB.name===cA.name&&cB.piece===cA.piece&&cB.target===cA.target){return true}}return false}function a9(cC){if(!cC){return false}var cF=n.findTargetNode(cC);if(!cF||n.shouldIgnoreInteraction(cF)){return false +}var cG=ct(cF);if(cr&&cG&&cG.type){return false}if(S.isLinkElement(cF)&&S.hasNodeAttributeWithValue(cF,"href")){var cz=String(S.getAttributeValueFromNode(cF,"href"));if(0===cz.indexOf("#")){return false}if(ax(cz)){return true}if(!n.isUrlToCurrentDomain(cz)){return false}var cD=n.buildContentBlock(cC);if(!cD){return}var cB=cD.name;var cH=cD.piece;var cE=cD.target;if(!S.hasNodeAttributeWithValue(cF,n.CONTENT_TARGET_ATTR)||cF.wasContentTargetAttrReplaced){cF.wasContentTargetAttrReplaced=true;cE=n.toAbsoluteUrl(cz);S.setAnyAttribute(cF,n.CONTENT_TARGET_ATTR,cE)}var cA=b8(cz,"click",cB,cH,cE);n.setHrefAttribute(cF,cA);return true}return false}function ap(cA){if(!cA||!cA.length){return}var cz;for(cz=0;cz<cA.length;cz++){a9(cA[cz])}}function aB(cz){return function(cA){if(!cz){return}var cD=n.findParentContentNode(cz);var cE;if(cA){cE=cA.target||cA.srcElement}if(!cE){cE=cz}if(!aN(cD,cE)){return}bJ(bd);if(S.isLinkElement(cz)&&S.hasNodeAttributeWithValue(cz,"href")&&S.hasNodeAttributeWithValue(cz,n.CONTENT_TARGET_ATTR)){var cB=S.getAttributeValueFromNode(cz,"href"); +if(!ax(cB)&&cz.wasContentTargetAttrReplaced){S.setAnyAttribute(cz,n.CONTENT_TARGET_ATTR,"")}}var cI=ct(cz);if(Z&&cI&&cI.type){return cI.type}if(a9(cD)){return"href"}var cF=n.buildContentBlock(cD);if(!cF){return}var cC=cF.name;var cJ=cF.piece;var cH=cF.target;var cG=ar("click",cC,cJ,cH);ba(cG,bd);return cG}}function bu(cB){if(!cB||!cB.length){return}var cz,cA;for(cz=0;cz<cB.length;cz++){cA=n.findTargetNode(cB[cz]);if(cA&&!cA.contentInteractionTrackingSetupDone){cA.contentInteractionTrackingSetupDone=true;X(cA,"click",aB(cA))}}}function a4(cB,cC){if(!cB||!cB.length){return[]}var cz,cA;for(cz=0;cz<cB.length;cz++){if(az(cB[cz])){cB.splice(cz,1);cz--}else{bD.push(cB[cz])}}if(!cB||!cB.length){return[]}ap(cC);bu(cC);var cD=[];for(cz=0;cz<cB.length;cz++){cA=bU(n.buildImpressionRequestParams(cB[cz].name,cB[cz].piece,cB[cz].target),undefined,"contentImpressions");cD.push(cA)}return cD}function bZ(cA){var cz=n.collectContent(cA);return a4(cz,cA)}function aL(cA){if(!cA||!cA.length){return[]}var cz; +for(cz=0;cz<cA.length;cz++){if(!n.isNodeVisible(cA[cz])){cA.splice(cz,1);cz--}}if(!cA||!cA.length){return[]}return bZ(cA)}function ak(cB,cz,cA){var cC=n.buildImpressionRequestParams(cB,cz,cA);return bU(cC,null,"contentImpression")}function cu(cC,cA){if(!cC){return}var cz=n.findParentContentNode(cC);var cB=n.buildContentBlock(cz);if(!cB){return}if(!cA){cA="Unknown"}return ar(cA,cB.name,cB.piece,cB.target)}function ca(cA,cC,cz,cB){return"e_c="+m(cA)+"&e_a="+m(cC)+(y(cz)?"&e_n="+m(cz):"")+(y(cB)?"&e_v="+m(cB):"")}function ad(cB,cD,cz,cC,cE){if(String(cB).length===0||String(cD).length===0){return false}var cA=bU(ca(cB,cD,cz,cC),cE,"event");ba(cA,bd)}function bC(cz,cC,cA,cD){var cB=bU("search="+m(cz)+(cC?"&search_cat="+m(cC):"")+(y(cA)?"&search_count="+cA:""),cD,"sitesearch");ba(cB,bd)}function ce(cz,cC,cB){var cA=bU("idgoal="+cz+(cC?"&revenue="+cC:""),cB,"goal");ba(cA,bd)}function cl(cC,cz,cG,cF,cB){var cE=cz+"="+m(bv(cC));var cA=bW(cB,"click",cC);if(cA){cE+="&"+cA}var cD=bU(cE,cG,"link");ba(cD,(cF?0:bd),cF) +}function bm(cA,cz){if(cA!==""){return cA+cz.charAt(0).toUpperCase()+cz.slice(1)}return cz}function bK(cE){var cD,cz,cC=["","webkit","ms","moz"],cB;if(!aQ){for(cz=0;cz<cC.length;cz++){cB=cC[cz];if(Object.prototype.hasOwnProperty.call(w,bm(cB,"hidden"))){if(w[bm(cB,"visibilityState")]==="prerender"){cD=true}break}}}if(cD){X(w,cB+"visibilitychange",function cA(){w.removeEventListener(cB+"visibilitychange",cA,false);cE()});return}cE()}function an(cz){if(w.readyState==="complete"){cz()}else{if(I.addEventListener){I.addEventListener("load",cz)}else{if(I.attachEvent){I.attachEvent("onLoad",cz)}}}}function aO(cA){var cz=false;if(w.attachEvent){cz=w.readyState==="complete"}else{cz=w.readyState!=="loading"}if(cz){cA()}else{if(w.addEventListener){w.addEventListener("DOMContentLoaded",cA)}else{if(w.attachEvent){w.attachEvent("onreadystatechange",cA)}}}}function b5(cz){var cA=ct(cz);if(cA&&cA.type){cA.href=j(cA.href);cl(cA.href,cA.type,undefined,null,cz)}}function bY(){return w.all&&!w.addEventListener +}function cg(cz){var cB=cz.which;var cA=(typeof cz.button);if(!cB&&cA!=="undefined"){if(bY()){if(cz.button&1){cB=1}else{if(cz.button&2){cB=3}else{if(cz.button&4){cB=2}}}}else{if(cz.button===0||cz.button==="0"){cB=1}else{if(cz.button&1){cB=2}else{if(cz.button&2){cB=3}}}}}return cB}function bn(cz){switch(cg(cz)){case 1:return"left";case 2:return"middle";case 3:return"right"}}function aD(cz){return cz.target||cz.srcElement}function ag(cz){return function(cC){cC=cC||I.event;var cB=bn(cC);var cD=aD(cC);if(cC.type==="click"){var cA=false;if(cz&&cB==="middle"){cA=true}if(cD&&!cA){b5(cD)}}else{if(cC.type==="mousedown"){if(cB==="middle"&&cD){au=cB;a7=cD}else{au=a7=null}}else{if(cC.type==="mouseup"){if(cB===au&&cD===a7){b5(cD)}au=a7=null}else{if(cC.type==="contextmenu"){b5(cD)}}}}}}function aa(cA,cz){X(cA,"click",ag(cz),false);if(cz){X(cA,"mouseup",ag(cz),false);X(cA,"mousedown",ag(cz),false);X(cA,"contextmenu",ag(cz),false)}}function a8(cA){if(!Z){Z=true;var cB,cz=aC(a6,"ignore"),cC=w.links;if(cC){for(cB=0; +cB<cC.length;cB++){if(!cz.test(cC[cB].className)){aa(cC[cB],cA)}}}}}function av(cB,cD,cE){if(bI){return true}bI=true;var cF=false;var cC,cA;function cz(){cF=true}an(function(){function cG(cI){setTimeout(function(){if(!bI){return}cF=false;cE.trackVisibleContentImpressions();cG(cI)},cI)}function cH(cI){setTimeout(function(){if(!bI){return}if(cF){cF=false;cE.trackVisibleContentImpressions()}cH(cI)},cI)}if(cB){cC=["scroll","resize"];for(cA=0;cA<cC.length;cA++){if(w.addEventListener){w.addEventListener(cC[cA],cz)}else{I.attachEvent("on"+cC[cA],cz)}}cH(100)}if(cD&&cD>0){cD=parseInt(cD,10);cG(cD)}})}function aK(cD,cF){var cE=bN(cD);var cC=bN(cF);if(!cE||cE==="/"||!cC||cC==="/"){return}var cB=A(cD);if(ab(cB,"/")){return}if(cm(cE,"/")){cE=aP(cE,1)}var cG=cE.split("/");for(var cA=2;cA<cG.length;cA++){var cz=cG.slice(0,cA).join("/");if(ab(cB,cz)){cE=cz;break}}if(!aF(cC,cE)){return}return cE}function b3(){var cA,cB,cC={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"},cz=I.devicePixelRatio||1; +if(!((new RegExp("MSIE")).test(e.userAgent))){if(e.mimeTypes&&e.mimeTypes.length){for(cA in cC){if(Object.prototype.hasOwnProperty.call(cC,cA)){cB=e.mimeTypes[cC[cA]];cq[cA]=(cB&&cB.enabledPlugin)?"1":"0"}}}if(typeof navigator.javaEnabled!=="unknown"&&y(e.javaEnabled)&&e.javaEnabled()){cq.java="1"}if(r(I.GearsFactory)){cq.gears="1"}cq.cookie=by()}cq.res=M.width*cz+"x"+M.height*cz}b3();aR();ao();return{getVisitorId:function(){return aA().uuid},getVisitorInfo:function(){return b9()},getAttributionInfo:function(){return bg()},getAttributionCampaignName:function(){return bg()[0]},getAttributionCampaignKeyword:function(){return bg()[1]},getAttributionReferrerTimestamp:function(){return bg()[2]},getAttributionReferrerUrl:function(){return bg()[3]},setTrackerUrl:function(cz){ai=cz},getTrackerUrl:function(){return ai},getSiteId:function(){return bz},setSiteId:function(cz){bw(cz)},setUserId:function(cz){if(!y(cz)||!cz.length){return}a5=cz;bi=bA(a5).substr(0,16)},getUserId:function(){return a5},setCustomData:function(cz,cA){if(L(cz)){Y=cz +}else{if(!Y){Y={}}Y[cz]=cA}},getCustomData:function(){return Y},setCustomRequestProcessing:function(cz){bE=cz},appendToTrackingUrl:function(cz){cj=cz},getRequest:function(cz){return bU(cz)},addPlugin:function(cz,cA){a[cz]=cA},setCustomDimension:function(cz,cA){cz=parseInt(cz,10);if(cz>0){if(!y(cA)){cA=""}if(!o(cA)){cA=String(cA)}aV[cz]=cA}},getCustomDimension:function(cz){cz=parseInt(cz,10);if(cz>0&&Object.prototype.hasOwnProperty.call(aV,cz)){return aV[cz]}},deleteCustomDimension:function(cz){cz=parseInt(cz,10);if(cz>0){delete aV[cz]}},setCustomVariable:function(cA,cz,cD,cB){var cC;if(!y(cB)){cB="visit"}if(!y(cz)){return}if(!y(cD)){cD=""}if(cA>0){cz=!o(cz)?String(cz):cz;cD=!o(cD)?String(cD):cD;cC=[cz.slice(0,a1),cD.slice(0,a1)];if(cB==="visit"||cB===2){b2();at[cA]=cC}else{if(cB==="page"||cB===3){bp[cA]=cC}else{if(cB==="event"){bO[cA]=cC}}}}},getCustomVariable:function(cA,cB){var cz;if(!y(cB)){cB="visit"}if(cB==="page"||cB===3){cz=bp[cA]}else{if(cB==="event"){cz=bO[cA]}else{if(cB==="visit"||cB===2){b2(); +cz=at[cA]}}}if(!y(cz)||(cz&&cz[0]==="")){return false}return cz},deleteCustomVariable:function(cz,cA){if(this.getCustomVariable(cz,cA)){this.setCustomVariable(cz,"","",cA)}},storeCustomVariablesInCookie:function(){bk=true},setLinkTrackingTimer:function(cz){bd=cz},setDownloadExtensions:function(cz){if(o(cz)){cz=cz.split("|")}cp=cz},addDownloadExtensions:function(cA){var cz;if(o(cA)){cA=cA.split("|")}for(cz=0;cz<cA.length;cz++){cp.push(cA[cz])}},removeDownloadExtensions:function(cB){var cA,cz=[];if(o(cB)){cB=cB.split("|")}for(cA=0;cA<cp.length;cA++){if(B(cB,cp[cA])===-1){cz.push(cp[cA])}}cp=cz},setDomains:function(cz){ae=o(cz)?[cz]:cz;var cC=false,cA;for(cA in ae){var cB=A(String(ae[cA]));if(Object.prototype.hasOwnProperty.call(ae,cA)&&b4(cf,cB)){cC=true;if(!aY){var cD=aK(ae[cA],bh);if(cD){this.setCookiePath(cD)}break}}}if(!cC){ae.push(cf)}},setIgnoreClasses:function(cz){a6=o(cz)?[cz]:cz},setRequestMethod:function(cz){cs=cz||bL},setRequestContentType:function(cz){bX=cz||am},setReferrerUrl:function(cz){aW=cz +},setCustomUrl:function(cz){aG=bo(bh,cz)},setDocumentTitle:function(cz){aS=cz},setAPIUrl:function(cz){bc=cz},setDownloadClasses:function(cz){bf=o(cz)?[cz]:cz},setLinkClasses:function(cz){aJ=o(cz)?[cz]:cz},setCampaignNameKey:function(cz){bT=o(cz)?[cz]:cz},setCampaignKeywordKey:function(cz){bb=o(cz)?[cz]:cz},discardHashTag:function(cz){bj=cz},setCookieNamePrefix:function(cz){aT=cz;at=bq()},setCookieDomain:function(cz){var cA=A(cz);if(a3(cA)){ch=cA;aR()}},setCookiePath:function(cz){aY=cz;aR()},setVisitorCookieTimeout:function(cz){b7=cz*1000},setSessionCookieTimeout:function(cz){bR=cz*1000},setReferralCookieTimeout:function(cz){co=cz*1000},setConversionAttributionFirstReferrer:function(cz){a2=cz},disableCookies:function(){aU=true;cq.cookie="0";if(bz){aj()}},deleteCookies:function(){aj()},setDoNotTrack:function(cA){var cz=e.doNotTrack||e.msDoNotTrack;cb=cA&&(cz==="yes"||cz==="1");if(cb){this.disableCookies()}},addListener:function(cA,cz){aa(cA,cz)},enableLinkTracking:function(cz){cr=true;if(q){a8(cz) +}else{G.push(function(){a8(cz)})}},enableJSErrorTracking:function(){if(cd){return}cd=true;var cz=I.onerror;I.onerror=function(cE,cC,cB,cD,cA){bK(function(){var cF="JavaScript Errors";var cG=cC+":"+cB;if(cD){cG+=":"+cD}ad(cF,cG,cE)});if(cz){return cz(cE,cC,cB,cD,cA)}return false}},disablePerformanceTracking:function(){aE=false},setGenerationTimeMs:function(cz){bP=parseInt(cz,10)},enableHeartBeatTimer:function(cz){cz=Math.max(cz,1);aH=(cz||15)*1000;if(ci!==null){cx()}},killFrame:function(){if(I.location!==I.top.location){I.top.location=I.location}},redirectFile:function(cz){if(I.location.protocol==="file:"){I.location=cz}},setCountPreRendered:function(cz){aQ=cz},trackGoal:function(cz,cB,cA){bK(function(){ce(cz,cB,cA)})},trackLink:function(cA,cz,cC,cB){bK(function(){cl(cA,cz,cC,cB)})},trackPageView:function(cz,cA){bD=[];if(C(bz)){bK(function(){O(ai,bc,bz)})}else{bK(function(){bt(cz,cA)})}},trackAllContentImpressions:function(){if(C(bz)){return}bK(function(){aO(function(){var cz=n.findContentNodes(); +var cA=bZ(cz);cw(cA,bd)})})},trackVisibleContentImpressions:function(cz,cA){if(C(bz)){return}if(!y(cz)){cz=true}if(!y(cA)){cA=750}av(cz,cA,this);bK(function(){an(function(){var cB=n.findContentNodes();var cC=aL(cB);cw(cC,bd)})})},trackContentImpression:function(cB,cz,cA){if(C(bz)){return}if(!cB){return}cz=cz||"Unknown";bK(function(){var cC=ak(cB,cz,cA);ba(cC,bd)})},trackContentImpressionsWithinNode:function(cz){if(C(bz)||!cz){return}bK(function(){if(bI){an(function(){var cA=n.findContentNodesWithinNode(cz);var cB=aL(cA);cw(cB,bd)})}else{aO(function(){var cA=n.findContentNodesWithinNode(cz);var cB=bZ(cA);cw(cB,bd)})}})},trackContentInteraction:function(cB,cC,cz,cA){if(C(bz)){return}if(!cB||!cC){return}cz=cz||"Unknown";bK(function(){var cD=ar(cB,cC,cz,cA);ba(cD,bd)})},trackContentInteractionNode:function(cA,cz){if(C(bz)||!cA){return}bK(function(){var cB=cu(cA,cz);ba(cB,bd)})},logAllContentBlocksOnPage:function(){var cA=n.findContentNodes();var cz=n.collectContent(cA);if(console!==undefined&&console&&console.log){console.log(cz) +}},trackEvent:function(cA,cC,cz,cB,cD){bK(function(){ad(cA,cC,cz,cB,cD)})},trackSiteSearch:function(cz,cB,cA,cC){bK(function(){bC(cz,cB,cA,cC)})},setEcommerceView:function(cC,cz,cB,cA){if(!y(cB)||!cB.length){cB=""}else{if(cB instanceof Array){cB=JSON2.stringify(cB)}}bp[5]=["_pkc",cB];if(y(cA)&&String(cA).length){bp[2]=["_pkp",cA]}if((!y(cC)||!cC.length)&&(!y(cz)||!cz.length)){return}if(y(cC)&&cC.length){bp[3]=["_pks",cC]}if(!y(cz)||!cz.length){cz=""}bp[4]=["_pkn",cz]},addEcommerceItem:function(cD,cz,cB,cA,cC){if(cD.length){ck[cD]=[cD,cz,cB,cA,cC]}},trackEcommerceOrder:function(cz,cD,cC,cB,cA,cE){bs(cz,cD,cC,cB,cA,cE)},trackEcommerceCartUpdate:function(cz){a0(cz)}}}function x(){return{push:T}}function b(ad,ac){var ae={};var aa,ab;for(aa=0;aa<ac.length;aa++){var Y=ac[aa];ae[Y]=1;for(ab=0;ab<ad.length;ab++){if(ad[ab]&&ad[ab][0]){var Z=ad[ab][0];if(Y===Z){T(ad[ab]);delete ad[ab];if(ae[Z]>1){if(console!==undefined&&console&&console.error){console.error("The method "+Z+' 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: http://developer.piwik.org/guides/tracking-javascript-guide#multiple-piwik-trackers') +}}ae[Z]++}}}}return ad}X(I,"beforeunload",U,false);p();Date.prototype.getTimeAlias=Date.prototype.getTime;N=new F();var t=["disableCookies","setTrackerUrl","setAPIUrl","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking"];_paq=b(_paq,t);for(v=0;v<_paq.length;v++){if(_paq[v]){T(_paq[v])}}_paq=new x();d={addPlugin:function(Y,Z){a[Y]=Z},getTracker:function(Y,Z){if(!y(Z)){Z=this.getAsyncTracker().getSiteId()}if(!y(Y)){Y=this.getAsyncTracker().getTrackerUrl()}return new F(Y,Z)},getAsyncTracker:function(){return N}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return d})}return d}())}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=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=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 diff --git a/tests/javascript/enable_sqlite b/tests/javascript/enable_sqlite new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/javascript/enable_sqlite diff --git a/tests/javascript/index.php b/tests/javascript/index.php index dfcf7ec831..0cb1d002b1 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2242,8 +2242,8 @@ function PiwikTest() { } }); - test("Tracker setDomains(), isSiteHostName(), isSiteHostPath() and getLinkIfShouldBeProcessed()", function() { - expect(102); + test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), findConfigCookiePathToUse() and getLinkIfShouldBeProcessed()", function() { + expect(117); var tracker = Piwik.getTracker(); var initialDomains = tracker.getDomains(); @@ -2252,10 +2252,12 @@ function PiwikTest() { equal( typeof tracker.hook.test._isSiteHostName, 'function', "isSiteHostName" ); equal( typeof tracker.hook.test._isSiteHostPath, 'function', "isSiteHostPath" ); equal( typeof tracker.hook.test._getLinkIfShouldBeProcessed, 'function', "getLinkIfShouldBeProcessed" ); + equal( typeof tracker.hook.test._findConfigCookiePathToUse, 'function', "findConfigCookiePathToUse" ); var isSiteHostName = tracker.hook.test._isSiteHostName; var isSiteHostPath = tracker.hook.test._isSiteHostPath; var getLinkIfShouldBeProcessed = tracker.hook.test._getLinkIfShouldBeProcessed; + var findConfigCookiePathToUse = tracker.hook.test._findConfigCookiePathToUse; // tracker.setDomain() @@ -2412,6 +2414,46 @@ function PiwikTest() { "href": "http://www.piwik.org/footer", "type": "link" }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/footer')), 'getLinkIfShouldBeProcessed http://www.piwik.org/footer and there is domain piwik.org/foo but it should be outlink as path is different') + + + /** + * findConfigCookiePathToUse () + */ + + tracker.setDomains( ['.piwik.org', '.piwik.pro/foo/bar', '.piwik.pro/foo', '.piwik.com/test/foo', 'example.com/foo'] ); + + equal(null, findConfigCookiePathToUse('.piwik.org/test', 'http://piwik.org/test/two'), 'findConfigCookiePathToUse no cookiePath because there is a domain alias given allowing them all'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a match'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); + equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo'), 'findConfigCookiePathToUse should find a less restrictive path automatically, urlPath===domainPath'); + equal('/test/bar/test', findConfigCookiePathToUse('.piwik.com/test/bar/test', 'http://piwik.com/test/bar/test/'), 'findConfigCookiePathToUse should use exactly given path if no less restrictive version is available'); + equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo/test', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically, configAlias === currentUrl'); + equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); + equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/test'), 'findConfigCookiePathToUse should not return a path when user is actually not on that path'); + equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro'), 'findConfigCookiePathToUse when there is no path set we cannot use a configPath'); + + /** + * Test sets a good cookie path automatically + */ + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests'] ); + equal('/tests', tracker.getConfigCookiePath()), 'should set a cookie path automatically'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript'] ); + equal('/tests/javascript', tracker.getConfigCookiePath()), 'should set a cookie path automatically, multiple directories'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.' + domainAlias + '/tests'] ); + equal('/tests', tracker.getConfigCookiePath()), 'should find shortest path for possible cookie path'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.example.com/tests'] ); + equal('/tests/javascript', tracker.getConfigCookiePath()), 'should not find a shorter path when no other domain matches'; + + tracker.setCookiePath(null); + tracker.setDomains( ['.' + domainAlias + '/another/one', '.example.org/tests/javascript', '.example.com/tests'] ); + equal(null, tracker.getConfigCookiePath()), 'should not set a path when no domain and no path matches'; }); test("Tracker getClassesRegExp()", function() { diff --git a/tests/javascript/piwiktest.js b/tests/javascript/piwiktest.js index 36cccc66a1..67157c6d96 100644 --- a/tests/javascript/piwiktest.js +++ b/tests/javascript/piwiktest.js @@ -27,6 +27,7 @@ Piwik.addPlugin('testPlugin', { '_getCookieName : getCookieName,' + '_setCookie : setCookie,' + '_getLinkIfShouldBeProcessed : getLinkIfShouldBeProcessed,' + + '_findConfigCookiePathToUse : findConfigCookiePathToUse,' + '_encode : encodeWrapper,' + '_decode : decodeWrapper,' + '_urldecode : urldecode,' + |