I'm looking at all the ads for a campaign. I want to fetch the top performing ad from the campaign. By top performing I guess I would choose the ad with the highest CTR maybe? Or maybe the Conversion rate. Anyways, I'm doing this kind of thing:
$user = new AdWordsUser();
$user->setClientCustomerId($accountId);
$user->LoadService('ReportDefinitionService', ADWORDS_VERSION);
$selector = new Selector();
$selector->fields = array(.....);
$selector->predicates[] = new Predicate('CampaignId', 'IN', $campaignIds);
$reportDefinition = new ReportDefinition();
$reportDefinition->selector = $selector;
$reportDefinition->reportName = 'Ad performance report #' . uniqid();
$reportDefinition->dateRangeType = "LAST_30_DAYS";
$reportDefinition->reportType = 'AD_PERFORMANCE_REPORT';
$reportDefinition->downloadFormat = 'XML';
$reportDefinition->includeZeroImpressions = FALSE;
The problem with this API call is that it returns ALL the ads (218 ads for this particular campaign I'm testing on). And I don't think the ads are sorted in any logical way that I can see. Maybe by adID ascending.
Anyways, I tried to add two things to my selector:
$selector->ordering[] = new OrderBy('Ctr', 'DESCENDING');
Gives the error:
Report download failed. Underlying errors are Type = 'ReportDefinitionError.SORTING_NOT_SUPPORTED', Trigger = 'Sorting is not supported for reports', FieldPath = ''.
Also, in order to just return the first result only (which work work if I could get ordering to work), I tried using paging:
$selector->paging = new Paging(0,1);
But I get
Report download failed. Underlying errors are Type = 'ReportDefinitionError.PAGING_NOT_SUPPORTED', Trigger = 'Paging is not supported for reports', FieldPath = ''.
Okay so downloading reports supports neight ordering or paging/limiting? Am I only able to just fetch ALL the ads and I need to manually sort through them myself? That doesn't seem right...
Am I missing something here?