问题
recently i started a project to get campaigns from google adwords api and make analytics reports about that info.
I have that issue:
I launch this piece of code to get all campaigns:
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);
}
But the result is not the two campaigns that i created, is just only one.
I have to say that the one that the api dont give to me, is a Video Campaigns, and not a search campaign.
RESULT OF THE CODE:
1 / 1 (100%)Campaign with name 'Testingalot' and ID '469071928' was found.
回答1:
It is correct because CampaignService does not show video campaigns in listings. See e.g. https://groups.google.com/forum/#!topic/adwords-api/SH7lk_y4GTw
来源:https://stackoverflow.com/questions/36497079/whats-happens-with-get-video-adwords-campaigns