getVisitsSummary() public static method

public static getVisitsSummary ( )
Example #1
0
 protected function addExcludeLowPopDisplayProperties(ViewDataTable $view)
 {
     if (Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') != '0') {
         $view->requestConfig->filter_excludelowpop = 'nb_hits';
         $view->requestConfig->filter_excludelowpop_value = function () {
             // computing minimum value to exclude (2 percent of the total number of actions)
             $visitsInfo = \Piwik\Plugins\VisitsSummary\Controller::getVisitsSummary()->getFirstRow();
             $nbActions = $visitsInfo->getColumn('nb_actions');
             $nbActionsLowPopulationThreshold = floor(0.02 * $nbActions);
             // we remove 1 to make sure some actions/downloads are displayed in the case we have a very few of them
             // and each of them has 1 or 2 hits...
             return min($visitsInfo->getColumn('max_actions') - 1, $nbActionsLowPopulationThreshold - 1);
         };
     }
 }