【发布时间】:2016-04-08 10:16:27
【问题描述】:
最近我开始了一个项目,从 google adwords api 获取广告系列并制作有关该信息的分析报告。
我有这个问题:
我启动这段代码来获取所有广告系列:
public function testGetCampaigns()
{
$user = new \AdWordsUser();
$user->LogAll();
$campaignService = $user->GetService('CampaignService', 'v201603');
// Create selector.go
$selector = new \Selector();
$selector->fields = array('Id', 'Name');
$selector->ordering[] = new \OrderBy('Name', 'ASCENDING');
// Create paging controls.
$selector->paging = new \Paging(0, \AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
$page = $campaignService->get($selector);
if (isset($page->entries)) {
foreach ($page->entries as $campaign) {
printf("Campaign with name '%s' and ID '%s' was found.\n",
$campaign->name, $campaign->id);
}
} else {
print "No campaigns were found.\n";
}
$selector->paging->startIndex += \AdWordsConstants::RECOMMENDED_PAGE_SIZE;
} while ($page->totalNumEntries > $selector->paging->startIndex);
}
但结果不是我创建的两个广告系列,只是一个。
我不得不说,api 没有给我的是视频广告系列,而不是搜索广告系列。
代码结果:
找到了 1 / 1 (100%) 个名为“Testingalot”且 ID 为“469071928”的广告系列。
【问题讨论】:
-
会不会是分页的问题?
标签: google-ads-api