diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2011-02-12 16:34:53 +0300 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2011-02-12 16:34:53 +0300 |
commit | 0e3252517cf23823cbb231250ab1839679ae6808 (patch) | |
tree | 3296cadc2ee9f6b939034b9d26d39f0ad83b362f /plugins/VisitorInterest/API.php | |
parent | 8518cb19b351e5d9be1d6d1951da4a8f0044cb96 (diff) |
Refs #1736
* API functions returning data now have a new optional 'segment' parameter. segment can define a Visitor segment dynamically that will be applied to the report. For example, &segment=country==FR;actions>=3 (AND, OR supported. Only == and != supported currently, but easy to add more)
* For API requests with a segment parameter, the reports will now be processed on the fly, and only the requested plugin report will be archived.
* All plugins now define the 'segments', with a name, category, SQL field, filter, etc.
* Simplifying archiving code a bit
* Fixes #2069 Exit rate computation
* New widget: lists the Top Keywords for a page URL, Widgets for a website only. Maybe later we could create a widget category "For your site"?
* This widget is pretty cool SEO wise, but maybe the PHP snippet should do caching (not so good hitting the API on each page view... but why not?)
* still to do!
git-svn-id: http://dev.piwik.org/svn/trunk@3870 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/VisitorInterest/API.php')
-rw-r--r-- | plugins/VisitorInterest/API.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php index 78b927a9ed..87ddc924b6 100644 --- a/plugins/VisitorInterest/API.php +++ b/plugins/VisitorInterest/API.php @@ -26,10 +26,10 @@ class Piwik_VisitorInterest_API return self::$instance; } - protected function getDataTable($name, $idSite, $period, $date) + protected function getDataTable($name, $idSite, $period, $date, $segment) { Piwik::checkUserHasViewAccess( $idSite ); - $archive = Piwik_Archive::build($idSite, $period, $date ); + $archive = Piwik_Archive::build($idSite, $period, $date, $segment ); $dataTable = $archive->getDataTable($name); $dataTable->filter('Sort',array(Piwik_Archive::INDEX_NB_VISITS)); $dataTable->queueFilter('ReplaceColumnNames'); @@ -37,16 +37,16 @@ class Piwik_VisitorInterest_API return $dataTable; } - public function getNumberOfVisitsPerVisitDuration( $idSite, $period, $date ) + public function getNumberOfVisitsPerVisitDuration( $idSite, $period, $date, $segment = false ) { - $dataTable = $this->getDataTable('VisitorInterest_timeGap', $idSite, $period, $date); + $dataTable = $this->getDataTable('VisitorInterest_timeGap', $idSite, $period, $date, $segment); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getDurationLabel')); return $dataTable; } - public function getNumberOfVisitsPerPage( $idSite, $period, $date ) + public function getNumberOfVisitsPerPage( $idSite, $period, $date, $segment = false ) { - $dataTable = $this->getDataTable('VisitorInterest_pageGap', $idSite, $period, $date); + $dataTable = $this->getDataTable('VisitorInterest_pageGap', $idSite, $period, $date, $segment); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getPageGapLabel')); return $dataTable; } |