getKeywordNotDefinedString() public static method

public static getKeywordNotDefinedString ( )
コード例 #1
0
ファイル: API.php プロジェクト: TensorWrenchOSS/piwik
 /**
  * Returns a summary for a visit's referral.
  *
  * @param Row $visit
  * @return bool|mixed|string
  * @ignore
  */
 public static function getReferrerSummaryForVisit($visit)
 {
     $referrerType = $visit->getColumn('referrerType');
     if ($referrerType === false || $referrerType == 'direct') {
         $result = Piwik::translate('Referrers_DirectEntry');
     } else {
         if ($referrerType == 'search') {
             $result = $visit->getColumn('referrerName');
             $keyword = $visit->getColumn('referrerKeyword');
             if ($keyword !== false && $keyword != APIReferrers::getKeywordNotDefinedString()) {
                 $result .= ' (' . $keyword . ')';
             }
         } else {
             if ($referrerType == 'campaign') {
                 $result = Piwik::translate('Referrers_ColumnCampaign') . ' (' . $visit->getColumn('referrerName') . ')';
             } else {
                 $result = $visit->getColumn('referrerName');
             }
         }
     }
     return $result;
 }
コード例 #2
0
 protected function getTopDimensions($idGoal)
 {
     $columnNbConversions = 'goal_' . $idGoal . '_nb_conversions';
     $columnConversionRate = 'goal_' . $idGoal . '_conversion_rate';
     $topDimensionsToLoad = array();
     if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('UserCountry')) {
         $topDimensionsToLoad += array('country' => 'UserCountry.getCountry');
     }
     $keywordNotDefinedString = '';
     if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('Referrers')) {
         $keywordNotDefinedString = APIReferrers::getKeywordNotDefinedString();
         $topDimensionsToLoad += array('keyword' => 'Referrers.getKeywords', 'website' => 'Referrers.getWebsites');
     }
     $topDimensions = array();
     foreach ($topDimensionsToLoad as $dimensionName => $apiMethod) {
         $request = new Request("method={$apiMethod}\n\t\t\t\t\t\t\t\t&format=original\n\t\t\t\t\t\t\t\t&filter_update_columns_when_show_all_goals=1\n\t\t\t\t\t\t\t\t&idGoal=" . AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE . "\n\t\t\t\t\t\t\t\t&filter_sort_order=desc\n\t\t\t\t\t\t\t\t&filter_sort_column={$columnNbConversions}" . "&filter_limit=" . (self::COUNT_TOP_ROWS_TO_DISPLAY + 2));
         $datatable = $request->process();
         $topDimension = array();
         $count = 0;
         foreach ($datatable->getRows() as $row) {
             $conversions = $row->getColumn($columnNbConversions);
             if ($conversions > 0 && $count < self::COUNT_TOP_ROWS_TO_DISPLAY && !($dimensionName == 'keyword' && $row->getColumn('label') == $keywordNotDefinedString)) {
                 $topDimension[] = array('name' => $row->getColumn('label'), 'nb_conversions' => $conversions, 'conversion_rate' => $this->formatConversionRate($row->getColumn($columnConversionRate)), 'metadata' => $row->getMetadata());
                 $count++;
             }
         }
         $topDimensions[$dimensionName] = $topDimension;
     }
     return $topDimensions;
 }
コード例 #3
0
ファイル: VisitorProfile.php プロジェクト: hongquan/piwik
 /**
  * Returns a summary for a visit's referral.
  *
  * @param DataTable\Row $visit
  * @return bool|mixed|string
  */
 public static function getReferrerSummaryForVisit($visit)
 {
     $referrerType = $visit->getColumn('referrerType');
     if ($referrerType === false || $referrerType == 'direct') {
         return Piwik::translate('Referrers_DirectEntry');
     }
     if ($referrerType == 'search') {
         $referrerName = $visit->getColumn('referrerName');
         $keyword = $visit->getColumn('referrerKeyword');
         if ($keyword !== false && $keyword != APIReferrers::getKeywordNotDefinedString()) {
             $referrerName .= ' (' . $keyword . ')';
         }
         return $referrerName;
     }
     if ($referrerType == 'campaign') {
         $summary = Piwik::translate('Referrers_ColumnCampaign') . ': ' . $visit->getColumn('referrerName');
         $keyword = $visit->getColumn('referrerKeyword');
         if (!empty($keyword)) {
             $summary .= ' - ' . $keyword;
         }
         return $summary;
     }
     return $visit->getColumn('referrerName');
 }