Search code examples
rubygoogle-ads-apiawql

How do I fetch best performing ads from adwords api


I am trying to fetch top performing ads using attributes like impressions, clickx etc

I tried google adwords reporting api first, but reporting api do not support ORDER BY clause. And I couldn't find any AdsService in the service list. Closest I could find AdGroupsAd which seeems do not have attributes like impressions clicks, etc. Am I missing something ?

query = "SELECT Headline,AdGroupName,AdType,CampaignName, Clicks FROM AD_PERFORMANCE_REPORT ORDER BY Clicks"
CSV.parse(report_utils.download_report_with_awql(query, 'CSV'))

AdwordsApi::Errors::ReportXmlError: HTTP code: 400, error type: 'QueryError.ORDER_BY_CLAUSE_NOT_SUPPORTED', trigger: '', field path: ''


Solution

  • AFAIK there's no way to have the Adwords API give you any entities ordered by stats. The reports don't support any ordering. With the services, you can order by attributes (e.g. alphabetically by headline for text ads), but not performance metrics.

    So the only way is to download the whole report and do the ordering on your end.