2017-06-13 6 views
0

AdWords APIを扱うときは非常に「緑色」です。誰かがORDER BY ..を使用する方法を手助けすることができますか?特にORDER BY 'Month'?月間注文をAdWordsのセレクタに追加するPHPのAPI V201705

public static function runExample(AdWordsServices $adWordsServices, 
    AdWordsSessionBuilder $sessionBuilder, $reportDir) { 
// Construct an API session for the client customer ID specified in the 
// configuration file. 
$session = $sessionBuilder->build(); 

// Create selector. 
$selector = new Selector(); 
$selector->setFields(['Month', 'Impressions', 'Clicks', 'Ctr', 'AverageCpc', 'AveragePosition', 'Cost', 'Conversions', 'CostPerConversion', 'ConversionRate', 'SearchImpressionShare']); 

$From = date('Ym01', strtotime("-5 months")); 
$To = date('Ymt', strtotime("-0 months")); 

$selector->setDateRange(new DateRange($From, $To)); 



// Use a predicate to filter out paused criteria (this is optional). 
//$selector->setPredicates([ 
    //new Predicate('Impressions', PredicateOperator::GREATER_THAN, [1000]), 
    //new Predicate('CampaignName', PredicateOperator::CONTAINS, ['Branded']) 
    //]); 

// Create report definition. 
$reportDefinition = new ReportDefinition(); 
$reportDefinition->setSelector($selector); 
$reportDefinition->setReportName('MOM ACCOUNT_PERFORMANCE_REPORT'); 
$reportDefinition->setDateRangeType(
    ReportDefinitionDateRangeType::CUSTOM_DATE); 
$reportDefinition->setReportType(
    ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT); 
$reportDefinition->setDownloadFormat(DownloadFormat::CSV); 

$customerIds = self::getAllManagedCustomerIds($adWordsServices, $session); 
printf("Downloading reports for %d managed customers.\n", 
    count($customerIds)); 

私はORDER BYがセレクタの内部にあると仮定していますか?

答えて

0

私は別のフォーラムで助けられました....下記を参照してください。

use Google\AdsApi\AdWords\v201705\cm\SortOrder; 
use Google\AdsApi\AdWords\v201705\cm\OrderBy; 
. 
. 
$selector->setOrdering([new OrderBy('Name', SortOrder::ASCENDING)]); //sort by 
Name 
関連する問題