[英]Adwords PHP API withCondition not working
$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;
I am trying to limit the campaigns that I get back in the report so that I only get those starting with 'CTC'. 我试图限制我在报告中返回的广告系列,以使我只获得以“ CTC”开头的广告系列。
$selector->withCondition = "Name STARTS_WITH 'CTC'";
I am not sure if I have the syntax wrong I am using this page as a reference https://developers.google.com/adwords/scripts/docs/reference/adwordsapp_campaignselector#withCondition_1 我不确定我的语法是否错误,我是否将此页面用作参考https://developers.google.com/adwords/scripts/docs/reference/adwordsapp_campaignselector#withCondition_1
The error I am getting back is: 我回来的错误是:
An error has occurred: Report download failed.
发生错误:报告下载失败。 Underlying errors are Type = 'ReportDownloadError.INVALID_REPORT_DEFINITION_XML', Trigger = 'Invalid ReportDefinition Xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'withCondition'.
潜在的错误是Type ='ReportDownloadError.INVALID_REPORT_DEFINITION_XML',Trigger ='Invalid ReportDefinition Xml:cvc-complex-type.2.4.a:发现无效的内容,从元素'withCondition'开始。 One of '{" https://adwords.google.com/api/adwords/cm/v201306 ":ordering, " https://adwords.google.com/api/adwords/cm/v201306 ":paging}' is expected.', FieldPath = ''.
“ {” https://adwords.google.com/api/adwords/cm/v201306“:ordering ”,“ https://adwords.google.com/api/adwords/cm/v201306“:paging }”之一是',FieldPath =”。
Thanks in advance, 提前致谢,
James 詹姆士
$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');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.