Piwik\Plugins\Live\Model::getNumVisitsConverted PHP Méthode

getNumVisitsConverted() public méthode

public getNumVisitsConverted ( $idSite, $lastMinutes, $segment ) : integer
$idSite
$lastMinutes
$segment
Résultat integer
    public function getNumVisitsConverted($idSite, $lastMinutes, $segment)
    {
        return $this->getLastMinutesCounterForQuery($idSite, $lastMinutes, $segment, 'COUNT(*)', 'log_conversion', 'log_conversion.server_time >= ?');
    }

Usage Example

Exemple #1
0
 /**
  * This will return simple counters, for a given website ID, for visits over the last N minutes
  *
  * @param int $idSite Id Site
  * @param int $lastMinutes Number of minutes to look back at
  * @param bool|string $segment
  * @param array $showColumns The columns to show / not to request. Eg 'visits', 'actions', ...
  * @param array $hideColumns The columns to hide / not to request. Eg 'visits', 'actions', ...
  * @return array( visits => N, actions => M, visitsConverted => P )
  */
 public function getCounters($idSite, $lastMinutes, $segment = false, $showColumns = array(), $hideColumns = array())
 {
     Piwik::checkUserHasViewAccess($idSite);
     $model = new Model();
     $counters = array();
     $hasVisits = true;
     if ($this->shouldColumnBePresentInResponse('visits', $showColumns, $hideColumns)) {
         $counters['visits'] = $model->getNumVisits($idSite, $lastMinutes, $segment);
         $hasVisits = !empty($counters['visits']);
     }
     if ($this->shouldColumnBePresentInResponse('actions', $showColumns, $hideColumns)) {
         if ($hasVisits) {
             $counters['actions'] = $model->getNumActions($idSite, $lastMinutes, $segment);
         } else {
             $counters['actions'] = 0;
         }
     }
     if ($this->shouldColumnBePresentInResponse('visitors', $showColumns, $hideColumns)) {
         if ($hasVisits) {
             $counters['visitors'] = $model->getNumVisitors($idSite, $lastMinutes, $segment);
         } else {
             $counters['visitors'] = 0;
         }
     }
     if ($this->shouldColumnBePresentInResponse('visitsConverted', $showColumns, $hideColumns)) {
         if ($hasVisits) {
             $counters['visitsConverted'] = $model->getNumVisitsConverted($idSite, $lastMinutes, $segment);
         } else {
             $counters['visitsConverted'] = 0;
         }
     }
     return array($counters);
 }