From fdb161b4d2a423a092dd4144b3cc1026bdd930ad Mon Sep 17 00:00:00 2001 From: Matthieu Aubry Date: Mon, 23 Apr 2018 16:28:58 +1200 Subject: When setting or resetting User ID, do not update the Visitor ID in the first party cookie (#12742) * When setting or resetting User ID, do not update the Visitor ID in the first party cookie * Forgot a file * Fix the JS tracker tests --- piwik.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'piwik.js') diff --git a/piwik.js b/piwik.js index e7624d6f7e..92b39626d4 100644 --- a/piwik.js +++ b/piwik.js @@ -58,10 +58,10 @@ return false}var c0=ch(cz(c1,c3,cZ,c2),c5,"event");bt(c0,bx,c4)}function bW(cZ,c if(!c0||aM(c0)){return}c0=k(c0,ap);if(c0.indexOf("?")>0){c0+="&"}else{c0+="?"}var c1=bh();c0=E(c0,ap,c1);aa.setAnyAttribute(cZ,"href",c0)}function au(c2){var c3=aa.getAttributeValueFromNode(c2,"href");if(!c3){return false}c3=String(c3);var c0=c3.indexOf("//")===0||c3.indexOf("http://")===0||c3.indexOf("https://")===0;if(!c0){return false}var cZ=c2.pathname||b9(c2.href);var c1=(c2.hostname||d(c2.href)).toLowerCase();if(am(c1,cZ)){if(!ct(cE,K(c1))){return true}return false}return false}function cs(cZ){var c0=cT(cZ);if(c0&&c0.type){c0.href=p(c0.href);cK(c0.href,c0.type,undefined,null,cZ);return}if(cx){cZ=ao(cZ);if(au(cZ)){b7(cZ)}}}function ck(){return F.all&&!F.addEventListener}function cF(cZ){var c1=cZ.which;var c0=(typeof cZ.button);if(!c1&&c0!=="undefined"){if(ck()){if(cZ.button&1){c1=1}else{if(cZ.button&2){c1=3}else{if(cZ.button&4){c1=2}}}}else{if(cZ.button===0||cZ.button==="0"){c1=1}else{if(cZ.button&1){c1=2}else{if(cZ.button&2){c1=3}}}}}return c1}function bH(cZ){switch(cF(cZ)){case 1:return"left"; case 2:return"middle";case 3:return"right"}}function aT(cZ){return cZ.target||cZ.srcElement}function av(cZ){return function(c2){c2=c2||S.event;var c1=bH(c2);var c3=aT(c2);if(c2.type==="click"){var c0=false;if(cZ&&c1==="middle"){c0=true}if(c3&&!c0){cs(c3)}}else{if(c2.type==="mousedown"){if(c1==="middle"&&c3){aJ=c1;bq=c3}else{aJ=bq=null}}else{if(c2.type==="mouseup"){if(c1===aJ&&c3===bq){cs(c3)}aJ=bq=null}else{if(c2.type==="contextmenu"){cs(c3)}}}}}}function al(c1,c0){var cZ=typeof c0;if(cZ==="undefined"){c0=true}ai(c1,"click",av(c0),false);if(c0){ai(c1,"mouseup",av(c0),false);ai(c1,"mousedown",av(c0),false);ai(c1,"contextmenu",av(c0),false)}}function br(c1,c3){ak=true;var c2,c0=aS(bp,"ignore"),c4=F.links,cZ=null,c5=null;if(c4){for(c2=0;c20){c3=parseInt(c3,10);c6(c3)}})}function cr(){var c0,c2,c3={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(c0 in c3){if(Object.prototype.hasOwnProperty.call(c3,c0)){c2=h.mimeTypes[c3[c0]];cP[c0]=(c2&&c2.enabledPlugin)?"1":"0"}}}if(!((new RegExp("Edge[ /](\\d+[\\.\\d]+)")).test(h.userAgent))&&typeof navigator.javaEnabled!=="unknown"&&I(h.javaEnabled)&&h.javaEnabled()){cP.java="1" -}if(z(S.GearsFactory)){cP.gears="1"}cP.cookie=bT()}var c1=parseInt(V.width,10);var cZ=parseInt(V.height,10);cP.res=parseInt(c1,10)+"x"+parseInt(cZ,10)}cr();a8();aE();this.getVisitorId=function(){return aP().uuid};this.getVisitorInfo=function(){return cy()};this.getAttributionInfo=function(){return bA()};this.getAttributionCampaignName=function(){return bA()[0]};this.getAttributionCampaignKeyword=function(){return bA()[1]};this.getAttributionReferrerTimestamp=function(){return bA()[2]};this.getAttributionReferrerUrl=function(){return bA()[3]};this.setTrackerUrl=function(cZ){ax=cZ};this.getTrackerUrl=function(){return ax};this.getPiwikUrl=function(){return N(this.getTrackerUrl(),bv)};this.addTracker=function(cZ,c1){if(!c1){throw new Error("A siteId must be given to add a new tracker")}if(!I(cZ)||null===cZ){cZ=this.getTrackerUrl()}var c0=new P(cZ,c1);H.push(c0);return c0};this.getSiteId=function(){return bU};this.setSiteId=function(cZ){bR(cZ)};this.resetUserId=function(){bo="";bC=cB()};this.setUserId=function(cZ){if(!I(cZ)||!cZ.length){return -}bo=cZ;bC=bV(bo).substr(0,16)};this.getUserId=function(){return bo};this.setCustomData=function(cZ,c0){if(U(cZ)){aj=cZ}else{if(!aj){aj={}}aj[cZ]=c0}};this.getCustomData=function(){return aj};this.setCustomRequestProcessing=function(cZ){bZ=cZ};this.appendToTrackingUrl=function(cZ){cI=cZ};this.getRequest=function(cZ){return ch(cZ)};this.addPlugin=function(cZ,c0){b[cZ]=c0};this.setCustomDimension=function(cZ,c0){cZ=parseInt(cZ,10);if(cZ>0){if(!I(c0)){c0=""}if(!w(c0)){c0=String(c0)}bc[cZ]=c0}};this.getCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0&&Object.prototype.hasOwnProperty.call(bc,cZ)){return bc[cZ]}};this.deleteCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0){delete bc[cZ]}};this.setCustomVariable=function(c0,cZ,c3,c1){var c2;if(!I(c1)){c1="visit"}if(!I(cZ)){return}if(!I(c3)){c3=""}if(c0>0){cZ=!w(cZ)?String(cZ):cZ;c3=!w(c3)?String(c3):c3;c2=[cZ.slice(0,bj),c3.slice(0,bj)];if(c1==="visit"||c1===2){cq();aI[c0]=c2}else{if(c1==="page"||c1===3){bK[c0]=c2}else{if(c1==="event"){ca[c0]=c2 -}}}}};this.getCustomVariable=function(c0,c1){var cZ;if(!I(c1)){c1="visit"}if(c1==="page"||c1===3){cZ=bK[c0]}else{if(c1==="event"){cZ=ca[c0]}else{if(c1==="visit"||c1===2){cq();cZ=aI[c0]}}}if(!I(cZ)||(cZ&&cZ[0]==="")){return false}return cZ};this.deleteCustomVariable=function(cZ,c0){if(this.getCustomVariable(cZ,c0)){this.setCustomVariable(cZ,"","",c0)}};this.deleteCustomVariables=function(cZ){if(cZ==="page"||cZ===3){bK={}}else{if(cZ==="event"){ca={}}else{if(cZ==="visit"||cZ===2){aI={}}}}};this.storeCustomVariablesInCookie=function(){bE=true};this.setLinkTrackingTimer=function(cZ){bx=cZ};this.getLinkTrackingTimer=function(){return bx};this.setDownloadExtensions=function(cZ){if(w(cZ)){cZ=cZ.split("|")}cO=cZ};this.addDownloadExtensions=function(c0){var cZ;if(w(c0)){c0=c0.split("|")}for(cZ=0;cZ0){if(!I(c0)){c0=""}if(!w(c0)){c0=String(c0)}bc[cZ]=c0}};this.getCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0&&Object.prototype.hasOwnProperty.call(bc,cZ)){return bc[cZ]}};this.deleteCustomDimension=function(cZ){cZ=parseInt(cZ,10);if(cZ>0){delete bc[cZ]}};this.setCustomVariable=function(c0,cZ,c3,c1){var c2;if(!I(c1)){c1="visit"}if(!I(cZ)){return}if(!I(c3)){c3=""}if(c0>0){cZ=!w(cZ)?String(cZ):cZ;c3=!w(c3)?String(c3):c3;c2=[cZ.slice(0,bj),c3.slice(0,bj)];if(c1==="visit"||c1===2){cq();aI[c0]=c2}else{if(c1==="page"||c1===3){bK[c0]=c2}else{if(c1==="event"){ca[c0]=c2}}}}};this.getCustomVariable=function(c0,c1){var cZ; +if(!I(c1)){c1="visit"}if(c1==="page"||c1===3){cZ=bK[c0]}else{if(c1==="event"){cZ=ca[c0]}else{if(c1==="visit"||c1===2){cq();cZ=aI[c0]}}}if(!I(cZ)||(cZ&&cZ[0]==="")){return false}return cZ};this.deleteCustomVariable=function(cZ,c0){if(this.getCustomVariable(cZ,c0)){this.setCustomVariable(cZ,"","",c0)}};this.deleteCustomVariables=function(cZ){if(cZ==="page"||cZ===3){bK={}}else{if(cZ==="event"){ca={}}else{if(cZ==="visit"||cZ===2){aI={}}}}};this.storeCustomVariablesInCookie=function(){bE=true};this.setLinkTrackingTimer=function(cZ){bx=cZ};this.getLinkTrackingTimer=function(){return bx};this.setDownloadExtensions=function(cZ){if(w(cZ)){cZ=cZ.split("|")}cO=cZ};this.addDownloadExtensions=function(c0){var cZ;if(w(c0)){c0=c0.split("|")}for(cZ=0;cZ