Ejemplo n.º 1
0
 protected function getTopDimensions($idGoal)
 {
     $columnNbConversions = 'goal_' . $idGoal . '_nb_conversions';
     $columnConversionRate = 'goal_' . $idGoal . '_conversion_rate';
     $topDimensionsToLoad = array();
     if (Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
         $topDimensionsToLoad += array('country' => 'UserCountry.getCountry');
     }
     $keywordNotDefinedString = '';
     if (Piwik_PluginsManager::getInstance()->isPluginActivated('Referers')) {
         $keywordNotDefinedString = Piwik_Referers::getKeywordNotDefinedString();
         $topDimensionsToLoad += array('keyword' => 'Referers.getKeywords', 'website' => 'Referers.getWebsites');
     }
     $topDimensions = array();
     foreach ($topDimensionsToLoad as $dimensionName => $apiMethod) {
         $request = new Piwik_API_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=" . Piwik_DataTable_Filter_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;
 }
Ejemplo n.º 2
0
 function getKeyword()
 {
     $keyword = $this->details['referer_keyword'];
     if (Piwik_PluginsManager::getInstance()->isPluginActivated('Referers') && $this->getRefererType() == 'search') {
         $keyword = Piwik_Referers::getCleanKeyword($keyword);
     }
     return urldecode($keyword);
 }
Ejemplo n.º 3
0
 function getKeyword()
 {
     $keyword = $this->details['referer_keyword'];
     if ($this->getRefererType() == 'search') {
         $keyword = Piwik_Referers::getCleanKeyword($keyword);
     }
     return urldecode($keyword);
 }