Hello,
Sorry if this has been covered, or if I have made a silly error...
I am trying to use the AdGroupAdService to find the Final / Destination URLs for the ads we manage (there are about 6000 or so).
This part seems okay. But I want to only deal with our ads that are active, so i have been looking at the status field to see which are set to "ENABLED".
But often ads that are paused, or are within a campaign that is paused, or even in an account that is deactivated return with a status of ENABLED.
Is that expected behaviour, or have I made an error?
Thanks!
James
<?php
require_once '/apimaster/examples/AdWords/v201506/init.php';
$user = new AdWordsUser();
$account = '{account number removed}';
$user->SetClientCustomerId($account);
$adGroupAdService = $user->GetService('AdGroupAdService', ADWORDS_VERSION);
$selector = new Selector();
$selector->fields = array('CreativeFinalUrls', 'Status');
// Create paging controls.
$selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
$page = $adGroupAdService->get($selector);
if(!empty($page->entries)) {
foreach ($page->entries as $adgroup) {
$adgroupid = $adgroup->adGroupId;
$status = $adgroup->status;
$headline = $adgroup->ad->headline;
$description1 = $adgroup->ad->description1;
$description2 = $adgroup->ad->description2;
$normalurl = $adgroup->ad->url;
$finalurl = $adgroup->ad->finalUrls;
$displayurl = $adgroup->ad->displayUrl;
$id = $adgroup->ad->id;
if ($status === "ENABLED") {
[...]