diff --git a/config/global.ini.php b/config/global.ini.php index b4fde4c3582..65e42247b8a 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -586,15 +586,15 @@ ; Includes by default the GA style campaign keyword parameter utm_term campaign_keyword_var_name = "pk_kwd,pk_keyword,piwik_kwd,utm_term" -; if set to 1, actions that contain different campaign information from the last action in the current visit will +; if set to 1, actions that contain different campaign information from the visitor's in progress visit will ; be treated as the start of a new visit. This will include situations when campaign information was absent before, -; but is present now (or vice versa). -tracker_create_new_visit_when_campaign_changes = 1 +; but is present now. +create_new_visit_when_campaign_changes = 1 -; if set to 1, actions that contain different website referrer information from the last action in the current visit +; if set to 1, actions that contain different website referrer information from the visitor's in progress visit ; will be treatedas the start of a new visit. This will include situations when website referrer information was -; absent before, but is present now (or vice versa). -tracker_create_new_visit_when_website_referrer_changes = 0 +; absent before, but is present now. +create_new_visit_when_website_referrer_changes = 0 ; maximum length of a Page Title or a Page URL recorded in the log_action.name table page_maximum_length = 1024; diff --git a/core/Columns/Dimension.php b/core/Columns/Dimension.php index 0da3bcf8b3d..e760a090832 100644 --- a/core/Columns/Dimension.php +++ b/core/Columns/Dimension.php @@ -15,9 +15,6 @@ use Piwik\Plugin\Dimension\ConversionDimension; use Piwik\Plugin\Dimension\VisitDimension; use Piwik\Plugin\Segment; -use Piwik\Tracker\Action; -use Piwik\Tracker\Request; -use Piwik\Tracker\Visitor; use Piwik\Translate; /** @@ -169,25 +166,6 @@ public function getId() return $pluginName . '.' . $dimensionName; } - /** - * This hook is executed by the tracker when determining if an action is the start of a new visit - * or part of an existing one. Derived classes can use it to force new visits based on dimension - * data. - * - * For example, the Campaign dimension in the Referrers plugin will force a new visit if the - * campaign information for the current action is different from the last. - * - * @param Request $request The current tracker request information. - * @param Visitor $visitor The information for the currently recognized visitor. - * @param Action|null $action The current action information (if any). - * @return bool Return true to force a visit, false if otherwise. - * @api - */ - public function shouldForceNewVisit(Request $request, Visitor $visitor, Action $action = null) - { - return false; - } - /** * Gets an instance of all available visit, action and conversion dimension. * @return Dimension[] diff --git a/core/Plugin/Dimension/VisitDimension.php b/core/Plugin/Dimension/VisitDimension.php index 09a58554c09..b9aa3a9b2aa 100644 --- a/core/Plugin/Dimension/VisitDimension.php +++ b/core/Plugin/Dimension/VisitDimension.php @@ -269,6 +269,25 @@ public function onAnyGoalConversion(Request $request, Visitor $visitor, $action) return false; } + /** + * This hook is executed by the tracker when determining if an action is the start of a new visit + * or part of an existing one. Derived classes can use it to force new visits based on dimension + * data. + * + * For example, the Campaign dimension in the Referrers plugin will force a new visit if the + * campaign information for the current action is different from the last. + * + * @param Request $request The current tracker request information. + * @param Visitor $visitor The information for the currently recognized visitor. + * @param Action|null $action The current action information (if any). + * @return bool Return true to force a visit, false if otherwise. + * @api + */ + public function shouldForceNewVisit(Request $request, Visitor $visitor, Action $action = null) + { + return false; + } + /** * Get all visit dimensions that are defined by all activated plugins. * @return VisitDimension[] diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 2530dc774b6..4e108450b5d 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -542,21 +542,14 @@ private function triggerHookOnDimensions($dimensions, $hook, $visitor, $action, return $valuesToUpdate; } - private function triggerPredicateHookOnDimensions($dimensions, $hook, Visitor $visitor, Action $action = null, $returnFirstTrue = true) + private function triggerPredicateHookOnDimensions($dimensions, $hook, Visitor $visitor, Action $action = null) { - $result = $returnFirstTrue ? false : array(); foreach ($dimensions as $dimension) { - $value = $dimension->$hook($this->request, $visitor, $action); - - if ($returnFirstTrue) { - if ($value) { - return true; - } - } else { - $result[] = $value; + if ($dimension->$hook($this->request, $visitor, $action)) { + return true; } } - return $result; + return false; } protected function getAllVisitDimensions() diff --git a/plugins/Referrers/Columns/Campaign.php b/plugins/Referrers/Columns/Campaign.php index df648fbd34d..5074578b161 100644 --- a/plugins/Referrers/Columns/Campaign.php +++ b/plugins/Referrers/Columns/Campaign.php @@ -27,7 +27,7 @@ class Campaign extends Base public function __construct() { - $this->createNewVisitWhenCampaignChanges = TrackerConfig::getConfigValue('tracker_create_new_visit_when_campaign_changes') == 1; + $this->createNewVisitWhenCampaignChanges = TrackerConfig::getConfigValue('create_new_visit_when_campaign_changes') == 1; } public function getName() diff --git a/plugins/Referrers/Columns/Website.php b/plugins/Referrers/Columns/Website.php index a806b8e8987..3bd5618b1d1 100644 --- a/plugins/Referrers/Columns/Website.php +++ b/plugins/Referrers/Columns/Website.php @@ -27,7 +27,7 @@ class Website extends Base public function __construct() { - $this->createNewVisitWhenWebsiteReferrerChanges = TrackerConfig::getConfigValue('tracker_create_new_visit_when_website_referrer_changes') == 1; + $this->createNewVisitWhenWebsiteReferrerChanges = TrackerConfig::getConfigValue('create_new_visit_when_website_referrer_changes') == 1; } public function getName() diff --git a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php index b4adc3dbd17..678f1d50e64 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php @@ -37,7 +37,7 @@ public function tearDown() private function setPiwikEnviornmentOverrides() { $configOverride = $this->getTestEnvironment()->configOverride; - $configOverride['Tracker']['tracker_create_new_visit_when_website_referrer_changes'] = 1; + $configOverride['Tracker']['create_new_visit_when_website_referrer_changes'] = 1; $this->getTestEnvironment()->configOverride = $configOverride; $this->getTestEnvironment()->save(); }