diff options
author | benakamoorthi <benaka.moorthi@gmail.com> | 2011-11-05 06:02:15 +0400 |
---|---|---|
committer | benakamoorthi <benaka.moorthi@gmail.com> | 2011-11-05 06:02:15 +0400 |
commit | 57c09eab2ed8d627e058dd1c518249c7decc0d37 (patch) | |
tree | f226eac13ad63d96f98448d768e7a7635a2e395a /plugins/VisitorInterest/API.php | |
parent | c157d6515979f47124cf238046e73a940a11b299 (diff) |
Fixes #583:
Added "Days since last visit" report under Visitors > Engagement.
Added tooltip to visitor log that displays the days since a visitor's last visit for each visit.
Notes:
The new report has been added to the Metadata API.
Augmented range label beautification so non-range labels could be displayed if desired.
Modified archiving code to allow further refinement when summarizing data over ranges.
git-svn-id: http://dev.piwik.org/svn/trunk@5411 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/VisitorInterest/API.php')
-rw-r--r-- | plugins/VisitorInterest/API.php | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php index 7f23f4f56d..0ba87f7e6f 100644 --- a/plugins/VisitorInterest/API.php +++ b/plugins/VisitorInterest/API.php @@ -33,15 +33,14 @@ class Piwik_VisitorInterest_API Piwik::checkUserHasViewAccess( $idSite ); $archive = Piwik_Archive::build($idSite, $period, $date, $segment ); $dataTable = $archive->getDataTable($name); - $dataTable->filter('Sort',array($column)); $dataTable->queueFilter('ReplaceColumnNames'); - $dataTable->queueFilter('Sort', array('label', 'asc', true)); return $dataTable; } public function getNumberOfVisitsPerVisitDuration( $idSite, $period, $date, $segment = false ) { $dataTable = $this->getDataTable('VisitorInterest_timeGap', $idSite, $period, $date, $segment); + $dataTable->queueFilter('Sort', array('label', 'asc', true)); $dataTable->queueFilter('BeautifyTimeRangeLabels', array( Piwik_Translate('VisitorInterest_BetweenXYSeconds'), Piwik_Translate('VisitorInterest_OneMinute'), @@ -52,6 +51,7 @@ class Piwik_VisitorInterest_API public function getNumberOfVisitsPerPage( $idSite, $period, $date, $segment = false ) { $dataTable = $this->getDataTable('VisitorInterest_pageGap', $idSite, $period, $date, $segment); + $dataTable->queueFilter('Sort', array('label', 'asc', true)); $dataTable->queueFilter('BeautifyRangeLabels', array( Piwik_Translate('VisitorInterest_OnePage'), Piwik_Translate('VisitorInterest_NPages'))); @@ -59,6 +59,28 @@ class Piwik_VisitorInterest_API } /** + * Returns a DataTable that associates counts of days (N) with the count of visits that + * occurred within N days of the last visit. + * + * @param int $idSite The site to select data from. + * @param string $period The period type. + * @param string $date The date type. + * @param string|bool $segment The segment. + * @return Piwik_DataTable the archived report data. + */ + public function getNumberOfVisitsByDaysSinceLast( $idSite, $period, $date, $segment = false ) + { + $recordName = 'VisitorInterest_daysSinceLastVisit'; + $dataTable = $this->getDataTable( + $recordName, $idSite, $period, $date, $segment, Piwik_Archive::INDEX_NB_VISITS); + + $dataTable->queueFilter('BeautifyRangeLabels', array( + Piwik_Translate('General_OneDay'), Piwik_Translate('General_NDays'))); + + return $dataTable; + } + + /** * Returns a DataTable that associates ranges of visit numbers with the count of visits * whose visit number falls within those ranges. * |