diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-07-07 13:16:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 13:16:14 +0300 |
commit | 427b25aabd382a7d41b86db6f8982b07c73b32f9 (patch) | |
tree | e6f52fbda8e1c6f5621e74386ec174ea43ba40f0 | |
parent | 08098d90b920073d831dc984de898a6ddb109fe8 (diff) |
Disallow empty values when tracking content actions (#11844)
* trim content values before tracking
* fix archiving for invalid content entries
* rebuilt piwik.js
* ensure content values are correct
-rw-r--r-- | js/piwik.js | 9 | ||||
-rw-r--r-- | js/piwik.min.js | 16 | ||||
-rw-r--r-- | piwik.js | 16 | ||||
-rw-r--r-- | plugins/Actions/ArchivingHelper.php | 2 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentInteraction.php | 6 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentName.php | 9 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentPiece.php | 6 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentTarget.php | 5 |
8 files changed, 42 insertions, 27 deletions
diff --git a/js/piwik.js b/js/piwik.js index 70356cab18..45a07ba572 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -6746,6 +6746,10 @@ if (typeof window.Piwik !== 'object') { return; } + contentName = trim(contentName); + contentPiece = trim(contentPiece); + contentTarget = trim(contentTarget); + if (!contentName) { return; } @@ -6807,6 +6811,11 @@ if (typeof window.Piwik !== 'object') { return; } + contentInteraction = trim(contentInteraction); + contentName = trim(contentName); + contentPiece = trim(contentPiece); + contentTarget = trim(contentTarget); + if (!contentInteraction || !contentName) { return; } diff --git a/js/piwik.min.js b/js/piwik.min.js index 4e9422f670..2791267342 100644 --- a/js/piwik.min.js +++ b/js/piwik.min.js @@ -64,14 +64,14 @@ if(cU&&cW==="middle"){cV=true}if(cY&&!cV){cn(cY)}}else{if(cX.type==="mousedown") if(cX&&cX!=="/"&&cX!=="/*"){cY=true;break}}if(!cY){ap.push(cz)}};this.enableCrossDomainLinking=function(){cs=true};this.disableCrossDomainLinking=function(){cs=false};this.isCrossDomainLinkingEnabled=function(){return cs};this.setIgnoreClasses=function(cU){bl=v(cU)?[cU]:cU};this.setRequestMethod=function(cU){cM=cU||b1};this.setRequestContentType=function(cU){cg=cU||aA};this.setReferrerUrl=function(cU){ba=cU};this.setCustomUrl=function(cU){aU=bE(bx,cU)};this.getCurrentUrl=function(){return aU||bx};this.setDocumentTitle=function(cU){a6=cU};this.setAPIUrl=function(cU){br=cU};this.setDownloadClasses=function(cU){bv=v(cU)?[cU]:cU};this.setLinkClasses=function(cU){aX=v(cU)?[cU]:cU};this.setCampaignNameKey=function(cU){ca=v(cU)?[cU]:cU};this.setCampaignKeywordKey=function(cU){bq=v(cU)?[cU]:cU};this.discardHashTag=function(cU){bz=cU};this.setCookieNamePrefix=function(cU){a7=cU;aH=bG()};this.setCookieDomain=function(cU){var cV=J(cU);if(bi(cV)){cB=cV;a5()}};this.getCookieDomain=function(){return cB };this.hasCookies=function(){return"1"===bO()};this.setSessionCookie=function(cW,cV,cU){if(!cW){throw new Error("Missing cookie name")}if(!H(cU)){cU=b8}bg.push(cW);cP(aK(cW),cV,cU,bc,cB)};this.getCookie=function(cV){var cU=av(aK(cV));if(cU===0){return null}return cU};this.setCookiePath=function(cU){bc=cU;a5()};this.getCookiePath=function(cU){return bc};this.setVisitorCookieTimeout=function(cU){cq=cU*1000};this.setSessionCookieTimeout=function(cU){b8=cU*1000};this.getSessionCookieTimeout=function(){return b8};this.setReferralCookieTimeout=function(cU){cI=cU*1000};this.setConversionAttributionFirstReferrer=function(cU){bh=cU};this.disableCookies=function(){a8=true;cK.cookie="0";if(bP){ax()}};this.deleteCookies=function(){ax()};this.setDoNotTrack=function(cV){var cU=h.doNotTrack||h.msDoNotTrack;cv=cV&&(cU==="yes"||cU==="1");if(cv){this.disableCookies()}};this.addListener=function(cV,cU){ak(cV,cU)};this.enableLinkTracking=function(cV){cL=true;var cU=this;b0(function(){p(function(){bn(cV,cU) })})};this.enableJSErrorTracking=function(){if(cx){return}cx=true;var cU=R.onerror;R.onerror=function(cZ,cX,cW,cY,cV){b0(function(){var c0="JavaScript Errors";var c1=cX+":"+cW;if(cY){c1+=":"+cY}am(c0,c1,cZ)});if(cU){return cU(cZ,cX,cW,cY,cV)}return false}};this.disablePerformanceTracking=function(){aS=false};this.setGenerationTimeMs=function(cU){b6=parseInt(cU,10)};this.enableHeartBeatTimer=function(cU){cU=Math.max(cU,1);aV=(cU||15)*1000;if(cC!==null){cR()}};this.disableHeartBeatTimer=function(){bu();if(aV||aF){if(R.removeEventListener){R.removeEventListener("focus",aZ,true);R.removeEventListener("blur",aq,true)}else{if(R.detachEvent){R.detachEvent("onfocus",aZ);R.detachEvent("onblur",aq)}}}aV=null;aF=false};this.killFrame=function(){if(R.location!==R.top.location){R.top.location=R.location}};this.redirectFile=function(cU){if(R.location.protocol==="file:"){R.location=cU}};this.setCountPreRendered=function(cU){a2=cU};this.trackGoal=function(cU,cW,cV){b0(function(){cy(cU,cW,cV)})};this.trackLink=function(cV,cU,cX,cW){b0(function(){cF(cV,cU,cX,cW) -})};this.getNumTrackedPageViews=function(){return cb};this.trackPageView=function(cU,cW,cV){bT=[];if(L(bP)){b0(function(){V(aw,br,bP)})}else{b0(function(){cb++;bJ(cU,cW,cV)})}};this.trackAllContentImpressions=function(){if(L(bP)){return}b0(function(){p(function(){var cU=u.findContentNodes();var cV=ci(cU);cQ(cV,bt)})})};this.trackVisibleContentImpressions=function(cU,cV){if(L(bP)){return}if(!H(cU)){cU=true}if(!H(cV)){cV=750}aJ(cU,cV,this);b0(function(){m(function(){var cW=u.findContentNodes();var cX=aY(cW);cQ(cX,bt)})})};this.trackContentImpression=function(cW,cU,cV){if(L(bP)){return}if(!cW){return}cU=cU||"Unknown";b0(function(){var cX=ay(cW,cU,cV);bp(cX,bt)})};this.trackContentImpressionsWithinNode=function(cU){if(L(bP)||!cU){return}b0(function(){if(bY){m(function(){var cV=u.findContentNodesWithinNode(cU);var cW=aY(cV);cQ(cW,bt)})}else{p(function(){var cV=u.findContentNodesWithinNode(cU);var cW=ci(cV);cQ(cW,bt)})}})};this.trackContentInteraction=function(cW,cX,cU,cV){if(L(bP)){return}if(!cW||!cX){return -}cU=cU||"Unknown";b0(function(){var cY=aG(cW,cX,cU,cV);bp(cY,bt)})};this.trackContentInteractionNode=function(cV,cU){if(L(bP)||!cV){return}b0(function(){var cW=cO(cV,cU);bp(cW,bt)})};this.logAllContentBlocksOnPage=function(){var cW=u.findContentNodes();var cU=u.collectContent(cW);var cV=typeof console;if(cV!=="undefined"&&console&&console.log){console.log(cU)}};this.trackEvent=function(cV,cX,cU,cW,cZ,cY){b0(function(){am(cV,cX,cU,cW,cZ,cY)})};this.trackSiteSearch=function(cU,cW,cV,cX){b0(function(){bR(cU,cW,cV,cX)})};this.setEcommerceView=function(cX,cU,cW,cV){if(!H(cW)||!cW.length){cW=""}else{if(cW instanceof Array){cW=JSON_PIWIK.stringify(cW)}}bF[5]=["_pkc",cW];if(H(cV)&&String(cV).length){bF[2]=["_pkp",cV]}if((!H(cX)||!cX.length)&&(!H(cU)||!cU.length)){return}if(H(cX)&&cX.length){bF[3]=["_pks",cX]}if(!H(cU)||!cU.length){cU=""}bF[4]=["_pkn",cU]};this.addEcommerceItem=function(cY,cU,cW,cV,cX){if(cY.length){cE[cY]=[cY,cU,cW,cV,cX]}};this.trackEcommerceOrder=function(cU,cY,cX,cW,cV,cZ){bI(cU,cY,cX,cW,cV,cZ) -};this.trackEcommerceCartUpdate=function(cU){be(cU)};this.trackRequest=function(cV,cX,cW,cU){b0(function(){var cY=cc(cV,cX,cU);bp(cY,bt,cW)})};e.trigger("TrackerSetup",[this])}function F(){return{push:aa}}function c(an,am){var ao={};var ak,al;for(ak=0;ak<am.length;ak++){var ai=am[ak];ao[ai]=1;for(al=0;al<an.length;al++){if(an[al]&&an[al][0]){var aj=an[al][0];if(ai===aj){aa(an[al]);delete an[al];if(ao[aj]>1){ae("The method "+aj+' 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')}ao[aj]++}}}}return an}var A=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking"];function Y(ai,ak){var aj=new O(ai,ak);G.push(aj);_paq=c(_paq,A);for(C=0;C<_paq.length;C++){if(_paq[C]){aa(_paq[C])}}_paq=new F(); -return aj}ah(R,"beforeunload",ac,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(al,ak,aj,ai){var am=typeof ai;if(am==="undefined"){ai=false}ah(al,ak,aj,ai)},onLoad:m,onReady:p,isNodeVisible:j,isOrWasNodeVisible:u.isNodeVisible},on:function(aj,ai){if(!w[aj]){w[aj]=[]}w[aj].push(ai)},off:function(ak,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){if(w[ak][ai]===aj){w[ak].splice(ai,1)}}},trigger:function(ak,al,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){w[ak][ai].apply(aj||R,al)}},addPlugin:function(ai,aj){b[ai]=aj},getTracker:function(ai,aj){if(!H(aj)){aj=this.getAsyncTracker().getSiteId()}if(!H(ai)){ai=this.getAsyncTracker().getTrackerUrl()}return new O(ai,aj)},getAsyncTrackers:function(){return G},addTracker:function(ai,aj){if(!G.length){Y(ai,aj)}else{G[0].addTracker(ai,aj)}},getAsyncTracker:function(aj,am){var al;if(G&&G.length&&G[0]){al=G[0]}else{return Y(aj,am)}if(!am&&!aj){return al -}if((!H(am)||null===am)&&al){am=al.getSiteId()}if((!H(aj)||null===aj)&&al){aj=al.getTrackerUrl()}var ak,ai=0;for(ai;ai<G.length;ai++){ak=G[ai];if(ak&&String(ak.getSiteId())===String(am)&&ak.getTrackerUrl()===aj){return ak}}},retryMissedPluginCalls:function(){var aj=ab;ab=[];var ai=0;for(ai;ai<aj.length;ai++){aa(aj[ai])}}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return e})}return e}()); +})};this.getNumTrackedPageViews=function(){return cb};this.trackPageView=function(cU,cW,cV){bT=[];if(L(bP)){b0(function(){V(aw,br,bP)})}else{b0(function(){cb++;bJ(cU,cW,cV)})}};this.trackAllContentImpressions=function(){if(L(bP)){return}b0(function(){p(function(){var cU=u.findContentNodes();var cV=ci(cU);cQ(cV,bt)})})};this.trackVisibleContentImpressions=function(cU,cV){if(L(bP)){return}if(!H(cU)){cU=true}if(!H(cV)){cV=750}aJ(cU,cV,this);b0(function(){m(function(){var cW=u.findContentNodes();var cX=aY(cW);cQ(cX,bt)})})};this.trackContentImpression=function(cW,cU,cV){if(L(bP)){return}cW=a(cW);cU=a(cU);cV=a(cV);if(!cW){return}cU=cU||"Unknown";b0(function(){var cX=ay(cW,cU,cV);bp(cX,bt)})};this.trackContentImpressionsWithinNode=function(cU){if(L(bP)||!cU){return}b0(function(){if(bY){m(function(){var cV=u.findContentNodesWithinNode(cU);var cW=aY(cV);cQ(cW,bt)})}else{p(function(){var cV=u.findContentNodesWithinNode(cU);var cW=ci(cV);cQ(cW,bt)})}})};this.trackContentInteraction=function(cW,cX,cU,cV){if(L(bP)){return +}cW=a(cW);cX=a(cX);cU=a(cU);cV=a(cV);if(!cW||!cX){return}cU=cU||"Unknown";b0(function(){var cY=aG(cW,cX,cU,cV);bp(cY,bt)})};this.trackContentInteractionNode=function(cV,cU){if(L(bP)||!cV){return}b0(function(){var cW=cO(cV,cU);bp(cW,bt)})};this.logAllContentBlocksOnPage=function(){var cW=u.findContentNodes();var cU=u.collectContent(cW);var cV=typeof console;if(cV!=="undefined"&&console&&console.log){console.log(cU)}};this.trackEvent=function(cV,cX,cU,cW,cZ,cY){b0(function(){am(cV,cX,cU,cW,cZ,cY)})};this.trackSiteSearch=function(cU,cW,cV,cX){b0(function(){bR(cU,cW,cV,cX)})};this.setEcommerceView=function(cX,cU,cW,cV){if(!H(cW)||!cW.length){cW=""}else{if(cW instanceof Array){cW=JSON_PIWIK.stringify(cW)}}bF[5]=["_pkc",cW];if(H(cV)&&String(cV).length){bF[2]=["_pkp",cV]}if((!H(cX)||!cX.length)&&(!H(cU)||!cU.length)){return}if(H(cX)&&cX.length){bF[3]=["_pks",cX]}if(!H(cU)||!cU.length){cU=""}bF[4]=["_pkn",cU]};this.addEcommerceItem=function(cY,cU,cW,cV,cX){if(cY.length){cE[cY]=[cY,cU,cW,cV,cX]}}; +this.trackEcommerceOrder=function(cU,cY,cX,cW,cV,cZ){bI(cU,cY,cX,cW,cV,cZ)};this.trackEcommerceCartUpdate=function(cU){be(cU)};this.trackRequest=function(cV,cX,cW,cU){b0(function(){var cY=cc(cV,cX,cU);bp(cY,bt,cW)})};e.trigger("TrackerSetup",[this])}function F(){return{push:aa}}function c(an,am){var ao={};var ak,al;for(ak=0;ak<am.length;ak++){var ai=am[ak];ao[ai]=1;for(al=0;al<an.length;al++){if(an[al]&&an[al][0]){var aj=an[al][0];if(ai===aj){aa(an[al]);delete an[al];if(ao[aj]>1){ae("The method "+aj+' 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')}ao[aj]++}}}}return an}var A=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking"];function Y(ai,ak){var aj=new O(ai,ak);G.push(aj);_paq=c(_paq,A); +for(C=0;C<_paq.length;C++){if(_paq[C]){aa(_paq[C])}}_paq=new F();return aj}ah(R,"beforeunload",ac,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(al,ak,aj,ai){var am=typeof ai;if(am==="undefined"){ai=false}ah(al,ak,aj,ai)},onLoad:m,onReady:p,isNodeVisible:j,isOrWasNodeVisible:u.isNodeVisible},on:function(aj,ai){if(!w[aj]){w[aj]=[]}w[aj].push(ai)},off:function(ak,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){if(w[ak][ai]===aj){w[ak].splice(ai,1)}}},trigger:function(ak,al,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){w[ak][ai].apply(aj||R,al)}},addPlugin:function(ai,aj){b[ai]=aj},getTracker:function(ai,aj){if(!H(aj)){aj=this.getAsyncTracker().getSiteId()}if(!H(ai)){ai=this.getAsyncTracker().getTrackerUrl()}return new O(ai,aj)},getAsyncTrackers:function(){return G},addTracker:function(ai,aj){if(!G.length){Y(ai,aj)}else{G[0].addTracker(ai,aj)}},getAsyncTracker:function(aj,am){var al;if(G&&G.length&&G[0]){al=G[0] +}else{return Y(aj,am)}if(!am&&!aj){return al}if((!H(am)||null===am)&&al){am=al.getSiteId()}if((!H(aj)||null===aj)&&al){aj=al.getTrackerUrl()}var ak,ai=0;for(ai;ai<G.length;ai++){ak=G[ai];if(ak&&String(ak.getSiteId())===String(am)&&ak.getTrackerUrl()===aj){return ak}}},retryMissedPluginCalls:function(){var aj=ab;ab=[];var ai=0;for(ai;ai<aj.length;ai++){aa(aj[ai])}}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return e})}return e}()); /*!!! pluginTrackerHook */ -}(function(){function b(){if("object"!==typeof _paq){return false}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.piwikPluginAsyncInit&&window.piwikPluginAsyncInit.length){var a=0;for(a;a<window.piwikPluginAsyncInit.length;a++){if(typeof window.piwikPluginAsyncInit[a]==="function"){window.piwikPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(!window.Piwik.getAsyncTrackers().length){if(b()){window.Piwik.addTracker()}else{_paq={push:function(c){var d=typeof console; -if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Piwik.trigger("PiwikInitialized",[]);window.Piwik.initialized=true}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.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=window.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()}}; +}(function(){function b(){if("object"!==typeof _paq){return false}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.piwikPluginAsyncInit&&window.piwikPluginAsyncInit.length){var a=0;for(a;a<window.piwikPluginAsyncInit.length;a++){if(typeof window.piwikPluginAsyncInit[a]==="function"){window.piwikPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(!window.Piwik.getAsyncTrackers().length){if(b()){window.Piwik.addTracker() +}else{_paq={push:function(c){var d=typeof console;if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Piwik.trigger("PiwikInitialized",[]);window.Piwik.initialized=true}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.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=window.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 @@ -64,14 +64,14 @@ if(cU&&cW==="middle"){cV=true}if(cY&&!cV){cn(cY)}}else{if(cX.type==="mousedown") if(cX&&cX!=="/"&&cX!=="/*"){cY=true;break}}if(!cY){ap.push(cz)}};this.enableCrossDomainLinking=function(){cs=true};this.disableCrossDomainLinking=function(){cs=false};this.isCrossDomainLinkingEnabled=function(){return cs};this.setIgnoreClasses=function(cU){bl=v(cU)?[cU]:cU};this.setRequestMethod=function(cU){cM=cU||b1};this.setRequestContentType=function(cU){cg=cU||aA};this.setReferrerUrl=function(cU){ba=cU};this.setCustomUrl=function(cU){aU=bE(bx,cU)};this.getCurrentUrl=function(){return aU||bx};this.setDocumentTitle=function(cU){a6=cU};this.setAPIUrl=function(cU){br=cU};this.setDownloadClasses=function(cU){bv=v(cU)?[cU]:cU};this.setLinkClasses=function(cU){aX=v(cU)?[cU]:cU};this.setCampaignNameKey=function(cU){ca=v(cU)?[cU]:cU};this.setCampaignKeywordKey=function(cU){bq=v(cU)?[cU]:cU};this.discardHashTag=function(cU){bz=cU};this.setCookieNamePrefix=function(cU){a7=cU;aH=bG()};this.setCookieDomain=function(cU){var cV=J(cU);if(bi(cV)){cB=cV;a5()}};this.getCookieDomain=function(){return cB };this.hasCookies=function(){return"1"===bO()};this.setSessionCookie=function(cW,cV,cU){if(!cW){throw new Error("Missing cookie name")}if(!H(cU)){cU=b8}bg.push(cW);cP(aK(cW),cV,cU,bc,cB)};this.getCookie=function(cV){var cU=av(aK(cV));if(cU===0){return null}return cU};this.setCookiePath=function(cU){bc=cU;a5()};this.getCookiePath=function(cU){return bc};this.setVisitorCookieTimeout=function(cU){cq=cU*1000};this.setSessionCookieTimeout=function(cU){b8=cU*1000};this.getSessionCookieTimeout=function(){return b8};this.setReferralCookieTimeout=function(cU){cI=cU*1000};this.setConversionAttributionFirstReferrer=function(cU){bh=cU};this.disableCookies=function(){a8=true;cK.cookie="0";if(bP){ax()}};this.deleteCookies=function(){ax()};this.setDoNotTrack=function(cV){var cU=h.doNotTrack||h.msDoNotTrack;cv=cV&&(cU==="yes"||cU==="1");if(cv){this.disableCookies()}};this.addListener=function(cV,cU){ak(cV,cU)};this.enableLinkTracking=function(cV){cL=true;var cU=this;b0(function(){p(function(){bn(cV,cU) })})};this.enableJSErrorTracking=function(){if(cx){return}cx=true;var cU=R.onerror;R.onerror=function(cZ,cX,cW,cY,cV){b0(function(){var c0="JavaScript Errors";var c1=cX+":"+cW;if(cY){c1+=":"+cY}am(c0,c1,cZ)});if(cU){return cU(cZ,cX,cW,cY,cV)}return false}};this.disablePerformanceTracking=function(){aS=false};this.setGenerationTimeMs=function(cU){b6=parseInt(cU,10)};this.enableHeartBeatTimer=function(cU){cU=Math.max(cU,1);aV=(cU||15)*1000;if(cC!==null){cR()}};this.disableHeartBeatTimer=function(){bu();if(aV||aF){if(R.removeEventListener){R.removeEventListener("focus",aZ,true);R.removeEventListener("blur",aq,true)}else{if(R.detachEvent){R.detachEvent("onfocus",aZ);R.detachEvent("onblur",aq)}}}aV=null;aF=false};this.killFrame=function(){if(R.location!==R.top.location){R.top.location=R.location}};this.redirectFile=function(cU){if(R.location.protocol==="file:"){R.location=cU}};this.setCountPreRendered=function(cU){a2=cU};this.trackGoal=function(cU,cW,cV){b0(function(){cy(cU,cW,cV)})};this.trackLink=function(cV,cU,cX,cW){b0(function(){cF(cV,cU,cX,cW) -})};this.getNumTrackedPageViews=function(){return cb};this.trackPageView=function(cU,cW,cV){bT=[];if(L(bP)){b0(function(){V(aw,br,bP)})}else{b0(function(){cb++;bJ(cU,cW,cV)})}};this.trackAllContentImpressions=function(){if(L(bP)){return}b0(function(){p(function(){var cU=u.findContentNodes();var cV=ci(cU);cQ(cV,bt)})})};this.trackVisibleContentImpressions=function(cU,cV){if(L(bP)){return}if(!H(cU)){cU=true}if(!H(cV)){cV=750}aJ(cU,cV,this);b0(function(){m(function(){var cW=u.findContentNodes();var cX=aY(cW);cQ(cX,bt)})})};this.trackContentImpression=function(cW,cU,cV){if(L(bP)){return}if(!cW){return}cU=cU||"Unknown";b0(function(){var cX=ay(cW,cU,cV);bp(cX,bt)})};this.trackContentImpressionsWithinNode=function(cU){if(L(bP)||!cU){return}b0(function(){if(bY){m(function(){var cV=u.findContentNodesWithinNode(cU);var cW=aY(cV);cQ(cW,bt)})}else{p(function(){var cV=u.findContentNodesWithinNode(cU);var cW=ci(cV);cQ(cW,bt)})}})};this.trackContentInteraction=function(cW,cX,cU,cV){if(L(bP)){return}if(!cW||!cX){return -}cU=cU||"Unknown";b0(function(){var cY=aG(cW,cX,cU,cV);bp(cY,bt)})};this.trackContentInteractionNode=function(cV,cU){if(L(bP)||!cV){return}b0(function(){var cW=cO(cV,cU);bp(cW,bt)})};this.logAllContentBlocksOnPage=function(){var cW=u.findContentNodes();var cU=u.collectContent(cW);var cV=typeof console;if(cV!=="undefined"&&console&&console.log){console.log(cU)}};this.trackEvent=function(cV,cX,cU,cW,cZ,cY){b0(function(){am(cV,cX,cU,cW,cZ,cY)})};this.trackSiteSearch=function(cU,cW,cV,cX){b0(function(){bR(cU,cW,cV,cX)})};this.setEcommerceView=function(cX,cU,cW,cV){if(!H(cW)||!cW.length){cW=""}else{if(cW instanceof Array){cW=JSON_PIWIK.stringify(cW)}}bF[5]=["_pkc",cW];if(H(cV)&&String(cV).length){bF[2]=["_pkp",cV]}if((!H(cX)||!cX.length)&&(!H(cU)||!cU.length)){return}if(H(cX)&&cX.length){bF[3]=["_pks",cX]}if(!H(cU)||!cU.length){cU=""}bF[4]=["_pkn",cU]};this.addEcommerceItem=function(cY,cU,cW,cV,cX){if(cY.length){cE[cY]=[cY,cU,cW,cV,cX]}};this.trackEcommerceOrder=function(cU,cY,cX,cW,cV,cZ){bI(cU,cY,cX,cW,cV,cZ) -};this.trackEcommerceCartUpdate=function(cU){be(cU)};this.trackRequest=function(cV,cX,cW,cU){b0(function(){var cY=cc(cV,cX,cU);bp(cY,bt,cW)})};e.trigger("TrackerSetup",[this])}function F(){return{push:aa}}function c(an,am){var ao={};var ak,al;for(ak=0;ak<am.length;ak++){var ai=am[ak];ao[ai]=1;for(al=0;al<an.length;al++){if(an[al]&&an[al][0]){var aj=an[al][0];if(ai===aj){aa(an[al]);delete an[al];if(ao[aj]>1){ae("The method "+aj+' 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')}ao[aj]++}}}}return an}var A=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking"];function Y(ai,ak){var aj=new O(ai,ak);G.push(aj);_paq=c(_paq,A);for(C=0;C<_paq.length;C++){if(_paq[C]){aa(_paq[C])}}_paq=new F(); -return aj}ah(R,"beforeunload",ac,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(al,ak,aj,ai){var am=typeof ai;if(am==="undefined"){ai=false}ah(al,ak,aj,ai)},onLoad:m,onReady:p,isNodeVisible:j,isOrWasNodeVisible:u.isNodeVisible},on:function(aj,ai){if(!w[aj]){w[aj]=[]}w[aj].push(ai)},off:function(ak,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){if(w[ak][ai]===aj){w[ak].splice(ai,1)}}},trigger:function(ak,al,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){w[ak][ai].apply(aj||R,al)}},addPlugin:function(ai,aj){b[ai]=aj},getTracker:function(ai,aj){if(!H(aj)){aj=this.getAsyncTracker().getSiteId()}if(!H(ai)){ai=this.getAsyncTracker().getTrackerUrl()}return new O(ai,aj)},getAsyncTrackers:function(){return G},addTracker:function(ai,aj){if(!G.length){Y(ai,aj)}else{G[0].addTracker(ai,aj)}},getAsyncTracker:function(aj,am){var al;if(G&&G.length&&G[0]){al=G[0]}else{return Y(aj,am)}if(!am&&!aj){return al -}if((!H(am)||null===am)&&al){am=al.getSiteId()}if((!H(aj)||null===aj)&&al){aj=al.getTrackerUrl()}var ak,ai=0;for(ai;ai<G.length;ai++){ak=G[ai];if(ak&&String(ak.getSiteId())===String(am)&&ak.getTrackerUrl()===aj){return ak}}},retryMissedPluginCalls:function(){var aj=ab;ab=[];var ai=0;for(ai;ai<aj.length;ai++){aa(aj[ai])}}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return e})}return e}()); +})};this.getNumTrackedPageViews=function(){return cb};this.trackPageView=function(cU,cW,cV){bT=[];if(L(bP)){b0(function(){V(aw,br,bP)})}else{b0(function(){cb++;bJ(cU,cW,cV)})}};this.trackAllContentImpressions=function(){if(L(bP)){return}b0(function(){p(function(){var cU=u.findContentNodes();var cV=ci(cU);cQ(cV,bt)})})};this.trackVisibleContentImpressions=function(cU,cV){if(L(bP)){return}if(!H(cU)){cU=true}if(!H(cV)){cV=750}aJ(cU,cV,this);b0(function(){m(function(){var cW=u.findContentNodes();var cX=aY(cW);cQ(cX,bt)})})};this.trackContentImpression=function(cW,cU,cV){if(L(bP)){return}cW=a(cW);cU=a(cU);cV=a(cV);if(!cW){return}cU=cU||"Unknown";b0(function(){var cX=ay(cW,cU,cV);bp(cX,bt)})};this.trackContentImpressionsWithinNode=function(cU){if(L(bP)||!cU){return}b0(function(){if(bY){m(function(){var cV=u.findContentNodesWithinNode(cU);var cW=aY(cV);cQ(cW,bt)})}else{p(function(){var cV=u.findContentNodesWithinNode(cU);var cW=ci(cV);cQ(cW,bt)})}})};this.trackContentInteraction=function(cW,cX,cU,cV){if(L(bP)){return +}cW=a(cW);cX=a(cX);cU=a(cU);cV=a(cV);if(!cW||!cX){return}cU=cU||"Unknown";b0(function(){var cY=aG(cW,cX,cU,cV);bp(cY,bt)})};this.trackContentInteractionNode=function(cV,cU){if(L(bP)||!cV){return}b0(function(){var cW=cO(cV,cU);bp(cW,bt)})};this.logAllContentBlocksOnPage=function(){var cW=u.findContentNodes();var cU=u.collectContent(cW);var cV=typeof console;if(cV!=="undefined"&&console&&console.log){console.log(cU)}};this.trackEvent=function(cV,cX,cU,cW,cZ,cY){b0(function(){am(cV,cX,cU,cW,cZ,cY)})};this.trackSiteSearch=function(cU,cW,cV,cX){b0(function(){bR(cU,cW,cV,cX)})};this.setEcommerceView=function(cX,cU,cW,cV){if(!H(cW)||!cW.length){cW=""}else{if(cW instanceof Array){cW=JSON_PIWIK.stringify(cW)}}bF[5]=["_pkc",cW];if(H(cV)&&String(cV).length){bF[2]=["_pkp",cV]}if((!H(cX)||!cX.length)&&(!H(cU)||!cU.length)){return}if(H(cX)&&cX.length){bF[3]=["_pks",cX]}if(!H(cU)||!cU.length){cU=""}bF[4]=["_pkn",cU]};this.addEcommerceItem=function(cY,cU,cW,cV,cX){if(cY.length){cE[cY]=[cY,cU,cW,cV,cX]}}; +this.trackEcommerceOrder=function(cU,cY,cX,cW,cV,cZ){bI(cU,cY,cX,cW,cV,cZ)};this.trackEcommerceCartUpdate=function(cU){be(cU)};this.trackRequest=function(cV,cX,cW,cU){b0(function(){var cY=cc(cV,cX,cU);bp(cY,bt,cW)})};e.trigger("TrackerSetup",[this])}function F(){return{push:aa}}function c(an,am){var ao={};var ak,al;for(ak=0;ak<am.length;ak++){var ai=am[ak];ao[ai]=1;for(al=0;al<an.length;al++){if(an[al]&&an[al][0]){var aj=an[al][0];if(ai===aj){aa(an[al]);delete an[al];if(ao[aj]>1){ae("The method "+aj+' 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')}ao[aj]++}}}}return an}var A=["addTracker","disableCookies","setTrackerUrl","setAPIUrl","enableCrossDomainLinking","setCookiePath","setCookieDomain","setDomains","setUserId","setSiteId","enableLinkTracking"];function Y(ai,ak){var aj=new O(ai,ak);G.push(aj);_paq=c(_paq,A); +for(C=0;C<_paq.length;C++){if(_paq[C]){aa(_paq[C])}}_paq=new F();return aj}ah(R,"beforeunload",ac,false);Date.prototype.getTimeAlias=Date.prototype.getTime;e={initialized:false,JSON:JSON_PIWIK,DOM:{addEventListener:function(al,ak,aj,ai){var am=typeof ai;if(am==="undefined"){ai=false}ah(al,ak,aj,ai)},onLoad:m,onReady:p,isNodeVisible:j,isOrWasNodeVisible:u.isNodeVisible},on:function(aj,ai){if(!w[aj]){w[aj]=[]}w[aj].push(ai)},off:function(ak,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){if(w[ak][ai]===aj){w[ak].splice(ai,1)}}},trigger:function(ak,al,aj){if(!w[ak]){return}var ai=0;for(ai;ai<w[ak].length;ai++){w[ak][ai].apply(aj||R,al)}},addPlugin:function(ai,aj){b[ai]=aj},getTracker:function(ai,aj){if(!H(aj)){aj=this.getAsyncTracker().getSiteId()}if(!H(ai)){ai=this.getAsyncTracker().getTrackerUrl()}return new O(ai,aj)},getAsyncTrackers:function(){return G},addTracker:function(ai,aj){if(!G.length){Y(ai,aj)}else{G[0].addTracker(ai,aj)}},getAsyncTracker:function(aj,am){var al;if(G&&G.length&&G[0]){al=G[0] +}else{return Y(aj,am)}if(!am&&!aj){return al}if((!H(am)||null===am)&&al){am=al.getSiteId()}if((!H(aj)||null===aj)&&al){aj=al.getTrackerUrl()}var ak,ai=0;for(ai;ai<G.length;ai++){ak=G[ai];if(ak&&String(ak.getSiteId())===String(am)&&ak.getTrackerUrl()===aj){return ak}}},retryMissedPluginCalls:function(){var aj=ab;ab=[];var ai=0;for(ai;ai<aj.length;ai++){aa(aj[ai])}}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return e})}return e}()); /*!!! pluginTrackerHook */ -}(function(){function b(){if("object"!==typeof _paq){return false}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.piwikPluginAsyncInit&&window.piwikPluginAsyncInit.length){var a=0;for(a;a<window.piwikPluginAsyncInit.length;a++){if(typeof window.piwikPluginAsyncInit[a]==="function"){window.piwikPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(!window.Piwik.getAsyncTrackers().length){if(b()){window.Piwik.addTracker()}else{_paq={push:function(c){var d=typeof console; -if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Piwik.trigger("PiwikInitialized",[]);window.Piwik.initialized=true}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.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=window.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()}}; +}(function(){function b(){if("object"!==typeof _paq){return false}var c=typeof _paq.length;if("undefined"===c){return false}return !!_paq.length}if(window&&"object"===typeof window.piwikPluginAsyncInit&&window.piwikPluginAsyncInit.length){var a=0;for(a;a<window.piwikPluginAsyncInit.length;a++){if(typeof window.piwikPluginAsyncInit[a]==="function"){window.piwikPluginAsyncInit[a]()}}}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}if(!window.Piwik.getAsyncTrackers().length){if(b()){window.Piwik.addTracker() +}else{_paq={push:function(c){var d=typeof console;if(d!=="undefined"&&console&&console.error){console.error("_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.",c)}}}}}window.Piwik.trigger("PiwikInitialized",[]);window.Piwik.initialized=true}());(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=window.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=window.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/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index bf5415f130..71386274c8 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -53,7 +53,7 @@ class ArchivingHelper unset($row[PiwikMetrics::INDEX_SITE_SEARCH_HAS_NO_RESULT]); } - if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT, Action::TYPE_EVENT_NAME))) { + if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT, Action::TYPE_EVENT_NAME, Action::TYPE_CONTENT_PIECE, Action::TYPE_CONTENT_TARGET))) { continue; } diff --git a/plugins/Contents/Columns/ContentInteraction.php b/plugins/Contents/Columns/ContentInteraction.php index 149ed94059..a50467f9d6 100644 --- a/plugins/Contents/Columns/ContentInteraction.php +++ b/plugins/Contents/Columns/ContentInteraction.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\Contents\Columns; use Piwik\Piwik; use Piwik\Plugin\Dimension\ActionDimension; use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -40,12 +41,11 @@ class ContentInteraction extends ActionDimension public function onLookupAction(Request $request, Action $action) { - $interaction = $request->getParam('c_i'); - - if (empty($interaction)) { + if (!($action instanceof ActionContent)) { return false; } + $interaction = $request->getParam('c_i'); $interaction = trim($interaction); if (strlen($interaction) > 0) { diff --git a/plugins/Contents/Columns/ContentName.php b/plugins/Contents/Columns/ContentName.php index 5ed5485791..6168a48725 100644 --- a/plugins/Contents/Columns/ContentName.php +++ b/plugins/Contents/Columns/ContentName.php @@ -8,9 +8,11 @@ */ namespace Piwik\Plugins\Contents\Columns; +use Piwik\Exception\InvalidRequestParameterException; use Piwik\Piwik; use Piwik\Plugin\Dimension\ActionDimension; use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -40,18 +42,17 @@ class ContentName extends ActionDimension public function onLookupAction(Request $request, Action $action) { - $contentName = $request->getParam('c_n'); - - if (empty($contentName)) { + if (!($action instanceof ActionContent)) { return false; } + $contentName = $request->getParam('c_n'); $contentName = trim($contentName); if (strlen($contentName) > 0) { return $contentName; } - return false; + throw new InvalidRequestParameterException('Param `c_n` must not be empty or filled with whitespaces'); } }
\ No newline at end of file diff --git a/plugins/Contents/Columns/ContentPiece.php b/plugins/Contents/Columns/ContentPiece.php index 6affe9a3d0..4cd0722e5a 100644 --- a/plugins/Contents/Columns/ContentPiece.php +++ b/plugins/Contents/Columns/ContentPiece.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\Contents\Columns; use Piwik\Piwik; use Piwik\Plugin\Dimension\ActionDimension; use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -40,12 +41,11 @@ class ContentPiece extends ActionDimension public function onLookupAction(Request $request, Action $action) { - $contentPiece = $request->getParam('c_p'); - - if (empty($contentPiece)) { + if (!($action instanceof ActionContent)) { return false; } + $contentPiece = $request->getParam('c_p'); $contentPiece = trim($contentPiece); if (strlen($contentPiece) > 0) { diff --git a/plugins/Contents/Columns/ContentTarget.php b/plugins/Contents/Columns/ContentTarget.php index 26c7a0d7a2..9e81c687f3 100644 --- a/plugins/Contents/Columns/ContentTarget.php +++ b/plugins/Contents/Columns/ContentTarget.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\Contents\Columns; use Piwik\Piwik; use Piwik\Plugin\Dimension\ActionDimension; use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -40,6 +41,10 @@ class ContentTarget extends ActionDimension public function onLookupAction(Request $request, Action $action) { + if (!($action instanceof ActionContent)) { + return false; + } + $contentTarget = $request->getParam('c_t'); $contentTarget = trim($contentTarget); |