0
$user->LoadService("ReportDefinitionService");

$selector = new Selector();
$selector->fields = $report["fields"];
$selector->dateRange = new DateRange($api_date, $api_date);
$selector->withCondition = "Name STARTS_WITH 'CTC'";

$reportDefinition = new ReportDefinition();
$reportDefinition->reportName = 'my_made_up_name_' . time();
$reportDefinition->dateRangeType = "CUSTOM_DATE";
$reportDefinition->reportType = $report["type"];
$reportDefinition->downloadFormat = "GZIPPED_CSV";
$reportDefinition->selector = $selector;

我试图限制我在报告中返回的广告系列,以便我只得到那些以“CTC”开头的广告系列。

$selector->withCondition = "Name STARTS_WITH 'CTC'";

我不确定我是否有语法错误我将此页面用作参考https://developers.google.com/adwords/scripts/docs/reference/adwordsapp_campaignselector#withCondition_1

我回来的错误是:

发生错误:报告下载失败。基础错误是 Type = 'ReportDownloadError.INVALID_REPORT_DEFINITION_XML',Trigger = 'Invalid ReportDefinition Xml:cvc-complex-type.2.4.a:发现以元素'withCondition'开头的无效内容。'{" https://adwords.google.com/api/adwords/cm/v201306 ":ordering, " https://adwords.google.com/api/adwords/cm/v201306 ":paging}' 之一是预期。',FieldPath = ''。

提前致谢,

詹姆士

4

1 回答 1

0
$selector = new Selector();
$selector->fields = $report["fields"];
$selector->dateRange = new DateRange($api_date, $api_date);
//$selector->withCondition = "Name STARTS_WITH 'CTC'";
$selector->predicates[] = new Predicate('CampaignName', 'STARTS_WITH', 'CTC');
于 2013-08-01T15:58:53.130 回答