我正在尝试从购物绩效报告中获取包含一些详细信息的产品列表。我能够以零展示次数获得产品,但在 49 种产品中,我可以通过特定活动获得,它只显示了 47 种。
我一直在分析产品数据,显然,这两个没有出现任何不同。
// Create selector.
$selector = new Selector();
$selector->setFields(
[
'OfferId',
'Brand'
]
);
// Set the predicates array
$predicates = [];
// Predicates offerIds
// Predicates campaigns
if (!empty($campaignIds)) {
$predicates[] = new Predicate('CampaignId', PredicateOperator::IN, $campaignIds);
}
// Predicates adgroups
if (!empty($adGroupIds)) {
//$predicates[] = new Predicate('AdGroupId', PredicateOperator::IN, $adGroupIds);
}
// Global predicates
$predicates[] = new Predicate('Impressions', PredicateOperator::EQUALS, [0]);
//$predicates[] = new Predicate('CampaignStatus', PredicateOperator::EQUALS, ['ENABLED']);
// Use a predicate to filter out paused criteria (this is optional).
$selector->setPredicates($predicates);
$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setReportName('Shopping report #' . uniqid());
$reportDefinition->setDateRangeType(ReportDefinitionDateRangeType::ALL_TIME);
$reportDefinition->setReportType(ReportDefinitionReportType::SHOPPING_PERFORMANCE_REPORT);
$reportDefinition->setDownloadFormat(DownloadFormat::CSV);
// Download report.
$reportDownloader = new ReportDownloader(parent::getSession());
// Set the Report Settings Builder
$reportSettingsOverride = (new ReportSettingsBuilder())
->skipReportHeader(true)
->skipColumnHeader(true)
->skipReportSummary(true)
->build();
// Download the report
$reportDownloadResult = $reportDownloader->downloadReport($reportDefinition, $reportSettingsOverride);
// Stores the stream
$reportStream = $reportDownloadResult->getAsString();