diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-07 10:43:22 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-07 10:43:22 +0400 |
commit | 4d3a3b3204da368e809d374f9471b3bb9af883fd (patch) | |
tree | 6c3830686ee79425a259bc03603399dbd781c126 /plugins/Actions/ArchivingHelper.php | |
parent | ac5425ec48878249080de5624f5b235b40059204 (diff) |
Refs #3332
* Transition works for Page titles with hierarchy (eg "$Category / $name")
* URL metadata:
* is only available on non Summary rows.
* It is now set to the page with highest number of visits, when page names do overwrite.
* However now, by default we do track keep hash tags and we do not aggregate them in one page URL.
* Refs #3232 Will be nice to have, to allow to "not track fragment" by default. See stub processUrlFragment().
More to do: Admin UI, Tests w/ and wo/ hash tags, w/ Capital letter in hostname
* URL being tracked, and URL read from the logs (for backward compatibility) are now cleaned: hostname is lowered,
and URL Fragment is kept/removed.
git-svn-id: http://dev.piwik.org/svn/trunk@7113 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Actions/ArchivingHelper.php')
-rw-r--r-- | plugins/Actions/ArchivingHelper.php | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index 015a35ef3d..e7d0bad3bb 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -61,16 +61,16 @@ class Piwik_Actions_ArchivingHelper continue; } - $currentTable = self::getActionRow($actionName, $actionType, $urlPrefix, $actionsTablesByType); + $actionRow = self::getActionRow($actionName, $actionType, $urlPrefix, $actionsTablesByType); - self::setCachedActionRow($idaction, $actionType, $currentTable); + self::setCachedActionRow($idaction, $actionType, $actionRow); } else { - $currentTable = self::getCachedActionRow($row['idaction'], $row['type']); + $actionRow = self::getCachedActionRow($row['idaction'], $row['type']); // Action processed as "to skip" for some reasons - if($currentTable === false) + if($actionRow === false) { continue; } @@ -81,7 +81,7 @@ class Piwik_Actions_ArchivingHelper unset($row['idaction']); unset($row['url_prefix']); - if (is_null($currentTable)) + if (is_null($actionRow)) { continue; } @@ -92,33 +92,33 @@ class Piwik_Actions_ArchivingHelper // this happens when 2 visitors visit the same new page at the same time, there is a SELECT and an INSERT for each new page, // and in between the two the other visitor comes. // here we handle the case where there is already a row for this action name, if this is the case we add the value - if(($alreadyValue = $currentTable->getColumn($name)) !== false) + if(($alreadyValue = $actionRow->getColumn($name)) !== false) { - $currentTable->setColumn($name, $alreadyValue+$value); + $actionRow->setColumn($name, $alreadyValue+$value); } else { - $currentTable->addColumn($name, $value); + $actionRow->addColumn($name, $value); } } // if the exit_action was not recorded properly in the log_link_visit_action // there would be an error message when getting the nb_hits column // we must fake the record and add the columns - if($currentTable->getColumn(Piwik_Archive::INDEX_PAGE_NB_HITS) === false) + if($actionRow->getColumn(Piwik_Archive::INDEX_PAGE_NB_HITS) === false) { // to test this code: delete the entries in log_link_action_visit for // a given exit_idaction_url foreach(self::getDefaultRow()->getColumns() as $name => $value) { - $currentTable->addColumn($name, $value); + $actionRow->addColumn($name, $value); } } $rowsProcessed++; } - // just to make sure php copies the last $currentTable in the $parentTable array - $currentTable =& $actionsTablesByType; + // just to make sure php copies the last $actionRow in the $parentTable array + $actionRow =& $actionsTablesByType; return $rowsProcessed; } @@ -192,6 +192,7 @@ class Piwik_Actions_ArchivingHelper protected static function getActionRow( $actionName, $actionType, $urlPrefix=null, &$actionsTablesByType ) { // we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.) + /* @var Piwik_DataTable $currentTable */ $currentTable =& $actionsTablesByType[$actionType]; // check for ranking query cut-off @@ -209,20 +210,16 @@ class Piwik_Actions_ArchivingHelper $actionExplodedNames = self::getActionExplodedNames($actionName, $actionType, $urlPrefix); list($row, $level) = $currentTable->walkPath( $actionExplodedNames, self::getDefaultRowColumns(), self::$maximumRowsInSubDataTable); - + // if we didn't traverse the entire path, the table the action belongs to is full, so we // found a summary row. we don't set metadata on that row. - if ($level != count($actionExplodedNames)) + if ($level != count($actionExplodedNames) + || $actionType == Piwik_Tracker_Action::TYPE_ACTION_NAME) { return $row; } - - // if the action type is a URL type, set the url as metadata - if ($actionType != Piwik_Tracker_Action::TYPE_ACTION_NAME) - { - $row->setMetadata('url', Piwik_Tracker_Action::reconstructNormalizedUrl((string)$actionName, $urlPrefix)); - } - + $row->setMetadata('url', Piwik_Tracker_Action::reconstructNormalizedUrl((string)$actionName, $urlPrefix)); + return $row; } @@ -273,7 +270,7 @@ class Piwik_Actions_ArchivingHelper $isUrl = true; $urlHost = $matches[1]; $urlPath = $matches[2]; - $urlAnchor = $matches[3]; + $urlFragment = $matches[3]; } if($type == Piwik_Tracker_Action::TYPE_DOWNLOAD @@ -304,6 +301,15 @@ class Piwik_Actions_ArchivingHelper $categoryDelimiter = self::$actionUrlCategoryDelimiter; } + + if( $isUrl ) + { + $urlFragment = Piwik_Tracker_Action::processUrlFragment($urlFragment); + if(!empty($urlFragment)) { + $name .= '#' . $urlFragment; + } + } + if(empty($categoryDelimiter)) { return array( trim($name) ); @@ -446,7 +452,7 @@ class Piwik_Actions_ArchivingHelper /** * Creates a summary row for an Actions DataTable. * - * @return array + * @return Piwik_DataTable_Row */ private static function createSummaryRow() { |