From 1b5b6e523c2bc8bde56b063ef455ebd73f1484d6 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Wed, 2 Sep 2020 19:23:07 +1200 Subject: Fix Custom opt out screen should not imply tracking consent given (#16364) * Fix Custom opt out screen should not imply tracking consent given fix https://github.com/matomo-org/matomo/issues/16362 As explained in the issue. When `optUserOut` is called, it should set the `mtm_consent_removed` cookie. When calling `forgetUserOptOut` then it should only undo the previous action and remove the `mtm_consent_removed` cookie. It should not set a `consent given` cookie because the user did likely not really give proper tracking consent (they would then instead implement https://developer.matomo.org/guides/tracking-consent ). Noticed this while implementing a custom opt out screen for Matomo for WordPress * rebuilt piwik.js --- js/piwik.js | 3 +-- js/piwik.min.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/piwik.js b/js/piwik.js index 2c5438963a..101bd1060c 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -6779,8 +6779,7 @@ if (typeof window.Matomo !== 'object') { */ this.forgetUserOptOut = function () { // we can't automatically enable cookies here as we don't know if user actually gave consent for cookies - var setCookieConsent = false; - this.rememberConsentGiven(0, setCookieConsent); + this.setConsentGiven(false); }; /** diff --git a/js/piwik.min.js b/js/piwik.min.js index 984e3e8f8b..4811acb4e5 100644 --- a/js/piwik.min.js +++ b/js/piwik.min.js @@ -60,13 +60,13 @@ var dq=dl+":"+dk;if(dm){dq+=":"+dm}at(dp,dq,dn)});if(di){return di(dn,dl,dk,dm,d if(N(b6)){cg(function(){Z(aE,bI,b6)})}else{cg(function(){cp++;b0(di,dk,dj)})}};this.trackAllContentImpressions=function(){if(N(b6)){return}cg(function(){p(function(){var di=v.findContentNodes();var dj=cy(di);bD.pushMultiple(dj)})})};this.trackVisibleContentImpressions=function(di,dj){if(N(b6)){return}if(!J(di)){di=true}if(!J(dj)){dj=750}aS(di,dj,this);cg(function(){m(function(){var dk=v.findContentNodes();var dl=a9(dk);bD.pushMultiple(dl)})})};this.trackContentImpression=function(dk,di,dj){if(N(b6)){return}dk=a(dk);di=a(di);dj=a(dj);if(!dk){return}di=di||"Unknown";cg(function(){var dl=aG(dk,di,dj);bD.push(dl)})};this.trackContentImpressionsWithinNode=function(di){if(N(b6)||!di){return}cg(function(){if(ce){m(function(){var dj=v.findContentNodesWithinNode(di);var dk=a9(dj);bD.pushMultiple(dk)})}else{p(function(){var dj=v.findContentNodesWithinNode(di);var dk=cy(dj);bD.pushMultiple(dk)})}})};this.trackContentInteraction=function(dk,dl,di,dj){if(N(b6)){return}dk=a(dk);dl=a(dl);di=a(di);dj=a(dj); if(!dk||!dl){return}di=di||"Unknown";cg(function(){var dm=aP(dk,dl,di,dj);if(dm){bD.push(dm)}})};this.trackContentInteractionNode=function(dk,dj){if(N(b6)||!dk){return}var di=null;cg(function(){di=da(dk,dj);if(di){bD.push(di)}});return di};this.logAllContentBlocksOnPage=function(){var dk=v.findContentNodes();var di=v.collectContent(dk);var dj=typeof console;if(dj!=="undefined"&&console&&console.log){console.log(di)}};this.trackEvent=function(dj,dl,di,dk,dn,dm){cg(function(){at(dj,dl,di,dk,dn,dm)})};this.trackSiteSearch=function(di,dk,dj,dl){ca=[];cg(function(){b8(di,dk,dj,dl)})};this.setEcommerceView=function(dm,di,dk,dj){cr={};if(Y(dk)){dk=String(dk)}if(!J(dk)||dk===null||dk===false||!dk.length){dk=""}else{if(dk instanceof Array){dk=S.JSON.stringify(dk)}}var dl="_pkc";cr[dl]=dk;if(J(dj)&&dj!==null&&dj!==false&&String(dj).length){dl="_pkp";cr[dl]=dj}if(!Y(dm)&&!Y(di)){return}if(Y(dm)){dl="_pks";cr[dl]=dm}if(!Y(di)){di=""}dl="_pkn";cr[dl]=di};this.getEcommerceItems=function(){return JSON.parse(JSON.stringify(cZ)) };this.addEcommerceItem=function(dm,di,dk,dj,dl){if(Y(dm)){cZ[dm]=[String(dm),di,dk,dj,dl]}};this.removeEcommerceItem=function(di){if(Y(di)){di=String(di);delete cZ[di]}};this.clearEcommerceCart=function(){cZ={}};this.trackEcommerceOrder=function(di,dm,dl,dk,dj,dn){bZ(di,dm,dl,dk,dj,dn)};this.trackEcommerceCartUpdate=function(di){bt(di)};this.trackRequest=function(dj,dl,dk,di){cg(function(){var dm=cq(dj,dl,di);bG(dm,bK,dk)})};this.ping=function(){this.trackRequest("ping=1",null,null,"ping")};this.disableQueueRequest=function(){bD.enabled=false};this.setRequestQueueInterval=function(di){if(di<1000){throw new Error("Request queue interval needs to be at least 1000ms")}bD.interval=di};this.queueRequest=function(di){cg(function(){var dj=cq(di);bD.push(dj)})};this.isConsentRequired=function(){return cz};this.getRememberedConsent=function(){var di=aD(bd);if(aD(cL)){if(di){bY(bd,bq,cW)}return null}if(!di||di===0){return null}return di};this.hasRememberedConsent=function(){return !!this.getRememberedConsent() -};this.requireConsent=function(){cz=true;bC=this.hasRememberedConsent();if(!bC){bm=true}x++;b["CoreConsent"+x]={unload:function(){if(!bC){aF()}}}};this.setConsentGiven=function(dj){bC=true;bY(cL,bq,cW);var dk,di;for(dk=0;dk1&&ap!=="addTracker"){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","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setVisitorId","setSiteId","alwaysUseSendBeacon","enableLinkTracking","setCookieConsentGiven","requireConsent","setConsentGiven"];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,"message",function(au){if(!au||!au.origin){return}var aw,ar,ap;var ax=d(au.origin);var at=t.getAsyncTrackers();for(ar=0;ar1&&ap!=="addTracker"){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","setSecureCookie","setCookiePath","setCookieDomain","setDomains","setUserId","setVisitorId","setSiteId","alwaysUseSendBeacon","enableLinkTracking","setCookieConsentGiven","requireConsent","setConsentGiven"];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,"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