/** * Parses the overview data */ private function parseOverviewData() { // get aggregates $results = BackendAnalyticsModel::getAggregates($this->startTimestamp, $this->endTimestamp); $resultsTotal = BackendAnalyticsModel::getAggregatesTotal($this->startTimestamp, $this->endTimestamp); // are there some values? $dataAvailable = false; foreach ($resultsTotal as $data) { if ($data != 0) { $dataAvailable = true; } } // show message if there is no data $this->tpl->assign('dataAvailable', $dataAvailable); if (!empty($results)) { // pageviews percentage of total $pageviewsPercentageOfTotal = $results['pageviews'] == 0 ? 0 : number_format($results['allPagesPageviews'] / $results['pageviews'] * 100, 0); // unique pageviews percentage of total $uniquePageviewsPercentageOfTotal = $results['uniquePageviews'] == 0 ? 0 : number_format($results['allPagesUniquePageviews'] / $results['uniquePageviews'] * 100, 0); // time on site values $timeOnSite = $results['entrances'] == 0 ? 0 : $results['timeOnSite'] / $results['entrances']; $timeOnSiteTotal = $resultsTotal['entrances'] == 0 ? 0 : $resultsTotal['timeOnSite'] / $resultsTotal['entrances']; $timeOnSiteDifference = $timeOnSiteTotal == 0 ? 0 : number_format(($timeOnSite - $timeOnSiteTotal) / $timeOnSiteTotal * 100, 0); if ($timeOnSiteDifference > 0) { $timeOnSiteDifference = '+' . $timeOnSiteDifference; } // bounces $bounces = $results['entrances'] == 0 ? 0 : number_format($results['bounces'] / $results['entrances'] * 100, 0); $bouncesTotal = $resultsTotal['entrances'] == 0 ? 0 : number_format($resultsTotal['bounces'] / $resultsTotal['entrances'] * 100, 0); $bouncesDifference = $bouncesTotal == 0 ? 0 : number_format(($bounces - $bouncesTotal) / $bouncesTotal * 100, 0); if ($bouncesDifference > 0) { $bouncesDifference = '+' . $bouncesDifference; } // exits percentage $exitsPercentage = $results['allPagesPageviews'] == 0 ? 0 : number_format($results['exits'] / $results['allPagesPageviews'] * 100, 0); $exitsPercentageTotal = $resultsTotal['pageviews'] == 0 ? 0 : number_format($resultsTotal['exits'] / $resultsTotal['pageviews'] * 100, 0); $exitsPercentageDifference = $exitsPercentageTotal == 0 ? 0 : number_format(($exitsPercentage - $exitsPercentageTotal) / $exitsPercentageTotal * 100, 0); if ($exitsPercentageDifference > 0) { $exitsPercentageDifference = '+' . $exitsPercentageDifference; } $this->tpl->assign('timeOnSite', BackendAnalyticsModel::getTimeFromSeconds($timeOnSite)); $this->tpl->assign('timeOnSiteTotal', BackendAnalyticsModel::getTimeFromSeconds($timeOnSiteTotal)); $this->tpl->assign('timeOnSiteDifference', $timeOnSiteDifference); $this->tpl->assign('pageviews', $results['pageviews']); $this->tpl->assign('pageviewsPercentageOfTotal', $pageviewsPercentageOfTotal); $this->tpl->assign('uniquePageviews', $results['uniquePageviews']); $this->tpl->assign('uniquePageviewsPercentageOfTotal', $uniquePageviewsPercentageOfTotal); $this->tpl->assign('bounces', $bounces); $this->tpl->assign('bouncesTotal', $bouncesTotal); $this->tpl->assign('bouncesDifference', $bouncesDifference); $this->tpl->assign('exitsPercentage', $exitsPercentage); $this->tpl->assign('exitsPercentageTotal', $exitsPercentageTotal); $this->tpl->assign('exitsPercentageDifference', $exitsPercentageDifference); } }
/** * Parses the overview data * * @return void */ private function parseOverviewData() { // get aggregates $results = BackendAnalyticsModel::getAggregates($this->startTimestamp, $this->endTimestamp); // get total aggregates $resultsTotal = BackendAnalyticsModel::getAggregatesTotal($this->startTimestamp, $this->endTimestamp); // are there some values? $dataAvailable = false; foreach ($resultsTotal as $data) { if ($data != 0) { $dataAvailable = true; } } // show message if there is no data $this->tpl->assign('dataAvailable', $dataAvailable); // there are some results if (!empty($results)) { // time on site values $timeOnSite = $results['entrances'] == 0 ? 0 : $results['timeOnSite'] / $results['entrances']; $timeOnSiteTotal = $resultsTotal['entrances'] == 0 ? 0 : $resultsTotal['timeOnSite'] / $resultsTotal['entrances']; $timeOnSiteDifference = $timeOnSiteTotal == 0 ? 0 : number_format(($timeOnSite - $timeOnSiteTotal) / $timeOnSiteTotal * 100, 0); if ($timeOnSiteDifference > 0) { $timeOnSiteDifference = '+' . $timeOnSiteDifference; } // pages / visit $pagesPerVisit = $results['visits'] == 0 ? 0 : number_format($results['pageviews'] / $results['visits'], 2); $pagesPerVisitTotal = $resultsTotal['visits'] == 0 ? 0 : number_format($resultsTotal['pageviews'] / $resultsTotal['visits'], 2); $pagesPerVisitDifference = $pagesPerVisitTotal == 0 ? 0 : number_format(($pagesPerVisit - $pagesPerVisitTotal) / $pagesPerVisitTotal * 100, 0); if ($pagesPerVisitDifference > 0) { $pagesPerVisitDifference = '+' . $pagesPerVisitDifference; } // new visits $newVisits = $results['entrances'] == 0 ? 0 : number_format($results['newVisits'] / $results['entrances'] * 100, 0); $newVisitsTotal = $resultsTotal['entrances'] == 0 ? 0 : number_format($resultsTotal['newVisits'] / $resultsTotal['entrances'] * 100, 0); $newVisitsDifference = $newVisitsTotal == 0 ? 0 : number_format(($newVisits - $newVisitsTotal) / $newVisitsTotal * 100, 0); if ($newVisitsDifference > 0) { $newVisitsDifference = '+' . $newVisitsDifference; } // bounces $bounces = $results['entrances'] == 0 ? 0 : number_format($results['bounces'] / $results['entrances'] * 100, 0); $bouncesTotal = $resultsTotal['entrances'] == 0 ? 0 : number_format($resultsTotal['bounces'] / $resultsTotal['entrances'] * 100, 0); $bouncesDifference = $bouncesTotal == 0 ? 0 : number_format(($bounces - $bouncesTotal) / $bouncesTotal * 100, 0); if ($bouncesDifference > 0) { $bouncesDifference = '+' . $bouncesDifference; } // parse data $this->tpl->assign('pageviews', $results['pageviews']); $this->tpl->assign('visitors', $results['visitors']); $this->tpl->assign('pageviews', $results['pageviews']); $this->tpl->assign('pageviewsTotal', $resultsTotal['pageviews']); $this->tpl->assign('pagesPerVisit', $pagesPerVisit); $this->tpl->assign('pagesPerVisitTotal', $pagesPerVisitTotal); $this->tpl->assign('pagesPerVisitDifference', $pagesPerVisitDifference); $this->tpl->assign('timeOnSite', BackendAnalyticsModel::getTimeFromSeconds($timeOnSite)); $this->tpl->assign('timeOnSiteTotal', BackendAnalyticsModel::getTimeFromSeconds($timeOnSiteTotal)); $this->tpl->assign('timeOnSiteDifference', $timeOnSiteDifference); $this->tpl->assign('newVisits', $newVisits); $this->tpl->assign('newVisitsTotal', $newVisitsTotal); $this->tpl->assign('newVisitsDifference', $newVisitsDifference); $this->tpl->assign('bounces', $bounces); $this->tpl->assign('bouncesTotal', $bouncesTotal); $this->tpl->assign('bouncesDifference', $bouncesDifference); } }
/** * Parses the overview data * * @return void */ private function parseOverviewData() { // get aggregates $results = BackendAnalyticsModel::getAggregates($this->startTimestamp, $this->endTimestamp); // get total aggregates $resultsTotal = BackendAnalyticsModel::getAggregatesTotal($this->startTimestamp, $this->endTimestamp); // are there some values? $dataAvailable = false; foreach ($resultsTotal as $data) { if ($data != 0) { $dataAvailable = true; } } // show message if there is no data $this->tpl->assign('dataAvailable', $dataAvailable); // there are some results if (!empty($results)) { // exits percentage of total $exitsPercentageOfTotal = $results['exits'] == 0 ? 0 : number_format($results['exitPagesExits'] / $results['exits'] * 100, 0); // pageviews percentage of total $pageviewsPercentageOfTotal = $results['pageviews'] == 0 ? 0 : number_format($results['exitPagesPageviews'] / $results['pageviews'] * 100, 0); // exits percentage $exitsPercentage = $results['exitPagesPageviews'] == 0 ? 0 : number_format($results['exits'] / $results['exitPagesPageviews'] * 100, 0); $exitsPercentageTotal = $resultsTotal['pageviews'] == 0 ? 0 : number_format($resultsTotal['exits'] / $resultsTotal['pageviews'] * 100, 0); $exitsPercentageDifference = $exitsPercentageTotal == 0 ? 0 : number_format(($exitsPercentage - $exitsPercentageTotal) / $exitsPercentageTotal * 100, 0); if ($exitsPercentageDifference > 0) { $exitsPercentageDifference = '+' . $exitsPercentageDifference; } // parse data $this->tpl->assign('exits', $results['exits']); $this->tpl->assign('exitsPercentageOfTotal', $exitsPercentageOfTotal); $this->tpl->assign('pageviews', $results['exitPagesPageviews']); $this->tpl->assign('pageviewsPercentageOfTotal', $pageviewsPercentageOfTotal); $this->tpl->assign('exitsPercentage', $exitsPercentage); $this->tpl->assign('exitsPercentageTotal', $exitsPercentageTotal); $this->tpl->assign('exitsPercentageDifference', $exitsPercentageDifference); } }
/** * Parses the overview data * * @return void */ private function parseOverviewData() { // get aggregates $results = BackendAnalyticsModel::getAggregates($this->startTimestamp, $this->endTimestamp); // get total aggregates $resultsTotal = BackendAnalyticsModel::getAggregatesTotal($this->startTimestamp, $this->endTimestamp); // are there some values? $dataAvailable = false; foreach ($resultsTotal as $data) { if ($data != 0) { $dataAvailable = true; } } // show message if there is no data $this->tpl->assign('dataAvailable', $dataAvailable); // there are some results if (!empty($results)) { // new visitors $newVisits = $results['entrances'] == 0 ? 0 : number_format($results['newVisits'] / $results['entrances'] * 100, 0); $newVisitsTotal = $resultsTotal['entrances'] == 0 ? 0 : number_format($resultsTotal['newVisits'] / $resultsTotal['entrances'] * 100, 0); $newVisitsDifference = $newVisitsTotal == 0 ? 0 : number_format(($newVisits - $newVisitsTotal) / $newVisitsTotal * 100, 0); if ($newVisitsDifference > 0) { $newVisitsDifference = '+' . $newVisitsDifference; } // bounces $bounces = $results['entrances'] == 0 ? 0 : number_format($results['bounces'] / $results['entrances'] * 100, 0); $bouncesTotal = $resultsTotal['entrances'] == 0 ? 0 : number_format($resultsTotal['bounces'] / $resultsTotal['entrances'] * 100, 0); $bouncesDifference = $bouncesTotal == 0 ? 0 : number_format(($bounces - $bouncesTotal) / $bouncesTotal * 100, 0); if ($bouncesDifference > 0) { $bouncesDifference = '+' . $bouncesDifference; } // parse data $this->tpl->assign('pageviews', $results['pageviews']); $this->tpl->assign('pageviewsTotal', $resultsTotal['pageviews']); $this->tpl->assign('uniquePageviews', $results['uniquePageviews']); $this->tpl->assign('uniquePageviewsTotal', $resultsTotal['uniquePageviews']); $this->tpl->assign('newVisits', $newVisits); $this->tpl->assign('newVisitsTotal', $newVisitsTotal); $this->tpl->assign('newVisitsDifference', $newVisitsDifference); $this->tpl->assign('bounces', $bounces); $this->tpl->assign('bouncesTotal', $bouncesTotal); $this->tpl->assign('bouncesDifference', $bouncesDifference); } }