diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-10-05 07:41:27 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-10-05 07:41:28 +0300 |
commit | d449954b8303fee70ef446cc69e8c4f6115727ee (patch) | |
tree | 3acdd504e4c2adc77e3258ed992486dd4cc92748 /plugins/API | |
parent | d2924407765ad66a4340a62dfed2cf5f0b87fef9 (diff) |
Segment auto-suggest dropdown now behaves as expected for Download URL, outlink URL and Page URL
+ tests
Diffstat (limited to 'plugins/API')
-rw-r--r-- | plugins/API/API.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php index 809c94fa13..4ea0cb4055 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -202,6 +202,23 @@ class API extends \Piwik\Plugin\API return $segments; } + /** + * @param $segmentName + * @param $table + * @return array + */ + protected function getSegmentValuesFromVisitorLog($segmentName, $table) + { + // Cleanup data to return the top suggested (non empty) labels for this segment + $values = $table->getColumn($segmentName); + + + // Select also flattened keys (custom variables "page" scope, page URLs for one visit, page titles for one visit) + $valuesBis = $table->getColumnsStartingWith($segmentName . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP); + $values = array_merge($values, $valuesBis); + return $values; + } + private function sortSegments($row1, $row2) { $customVarCategory = Piwik::translate('CustomVariables_CustomVariables'); @@ -538,12 +555,7 @@ class API extends \Piwik\Plugin\API if ($suggestedValuesCallbackRequiresTable) { $values = call_user_func($segmentFound['suggestedValuesCallback'], $idSite, $maxSuggestionsToReturn, $table); } else { - // Cleanup data to return the top suggested (non empty) labels for this segment - $values = $table->getColumn($segmentName); - - // Select also flattened keys (custom variables "page" scope, page URLs for one visit, page titles for one visit) - $valuesBis = $table->getColumnsStartingWith($segmentName . ColumnDelete::APPEND_TO_COLUMN_NAME_TO_KEEP); - $values = array_merge($values, $valuesBis); + $values = $this->getSegmentValuesFromVisitorLog($segmentName, $table); } $values = $this->getMostFrequentValues($values); @@ -588,7 +600,9 @@ class API extends \Piwik\Plugin\API // If you update this, also update flattenVisitorDetailsArray $segmentsNeedActionsInfo = array('visitConvertedGoalId', 'pageUrl', 'pageTitle', 'siteSearchKeyword', - 'entryPageTitle', 'entryPageUrl', 'exitPageTitle', 'exitPageUrl'); + 'entryPageTitle', 'entryPageUrl', 'exitPageTitle', 'exitPageUrl', + 'outlinkUrl', 'downloadUrl' + ); $isCustomVariablePage = stripos($segmentName, 'customVariablePage') !== false; $isEventSegment = stripos($segmentName, 'event') !== false; $isContentSegment = stripos($segmentName, 'content') !== false; |