Piwik\Tracker\GoalManager::getGoalIds PHP Method

getGoalIds() public static method

public static getGoalIds ( $idSite )
    public static function getGoalIds($idSite)
    {
        $goals = self::getGoalDefinitions($idSite);
        $goalIds = array();
        foreach ($goals as $goal) {
            $goalIds[] = $goal['idgoal'];
        }
        return $goalIds;
    }

Usage Example

コード例 #1
0
ファイル: Archiver.php プロジェクト: a4tunado/piwik
 /**
  * @internal param $this->getProcessor()
  */
 public function aggregateMultipleReports()
 {
     /*
      * Archive Ecommerce Items
      */
     $dataTableToSum = $this->dimensionRecord;
     foreach ($this->dimensionRecord as $recordName) {
         $dataTableToSum[] = self::getItemRecordNameAbandonedCart($recordName);
     }
     $this->getProcessor()->aggregateDataTableRecords($dataTableToSum);
     /*
      *  Archive General Goal metrics
      */
     $goalIdsToSum = GoalManager::getGoalIds($this->getProcessor()->getParams()->getSite()->getId());
     //Ecommerce
     $goalIdsToSum[] = GoalManager::IDGOAL_ORDER;
     $goalIdsToSum[] = GoalManager::IDGOAL_CART;
     //bug here if idgoal=1
     // Overall goal metrics
     $goalIdsToSum[] = false;
     $fieldsToSum = array();
     foreach ($goalIdsToSum as $goalId) {
         $metricsToSum = Goals::getGoalColumns($goalId);
         unset($metricsToSum[array_search('conversion_rate', $metricsToSum)]);
         foreach ($metricsToSum as $metricName) {
             $fieldsToSum[] = self::getRecordName($metricName, $goalId);
         }
     }
     $records = $this->getProcessor()->aggregateNumericMetrics($fieldsToSum);
     // also recording conversion_rate for each goal
     foreach ($goalIdsToSum as $goalId) {
         $nb_conversions = $records[self::getRecordName('nb_visits_converted', $goalId)];
         $conversion_rate = $this->getConversionRate($nb_conversions);
         $this->getProcessor()->insertNumericRecord(self::getRecordName('conversion_rate', $goalId), $conversion_rate);
         // sum up the visits to conversion data table & the days to conversion data table
         $this->getProcessor()->aggregateDataTableRecords(array(self::getRecordName(self::VISITS_UNTIL_RECORD_NAME, $goalId), self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME, $goalId)));
     }
     // sum up goal overview reports
     $this->getProcessor()->aggregateDataTableRecords(array(self::getRecordName(self::VISITS_UNTIL_RECORD_NAME), self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME)));
 }
All Usage Examples Of Piwik\Tracker\GoalManager::getGoalIds