Get campaigns data with campaign_budget and campaign_criterion

26 views
Skip to first unread message

Antonio Cortina

unread,
Jan 16, 2021, 2:36:26 PM1/16/21
to AdWords API and Google Ads API Forum
Hi,

I need to get a list of all campaigns and show campaign_budget and campaign_criterion (location) data from them but query is returning an error.

This is the query:

'SELECT campaign.id, campaign.name, campaign.status, metrics.impressions, metrics.clicks, metrics.ctr, metrics.cost_micros, campaign_budget.amount_micros, campaign_criterion.location.geo_target_constant FROM campaign WHERE campaign.status != "REMOVED" ORDER BY campaign.id'

This is the output:
{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.ads.googleads.v6.errors.GoogleAdsFailure","errors":[{"errorCode":{"queryError":"PROHIBITED_RESOURCE_TYPE_IN_SELECT_CLAUSE"},"message":"Cannot select fields from the following resource: 'CAMPAIGN_CRITERION', since the resource is incompatible with the resource in FROM clause."}]}]}

I tried with campaign, campaign_criterion and campaign_budget in clausule FROM but it doesnt work.

Any idea?

Thanks in advance

Google Ads API Forum Advisor Prod

unread,
Jan 18, 2021, 1:43:28 AM1/18/21
to antco...@gmail.com, adwor...@googlegroups.com
Hi Antonio,

Thank you for posting your concern.

The possible reason why the issue is occurring is because campaign_criterion resource is not supported in the campaign report. Also, I am afraid that there is no way to get the specific set of data that you've mentioned. You will need to use different report for retrieving the targeted locations of each campaign with its metrics and retrieving campaigns with its budget.

For the first report, you will need to use the location_view and include the campaign resource to get the targeted locations with its campaign.

As for retrieving campaigns with its budget, you will need to use the campaign_budget report and include campaign resource.

Hope this will help. Let me know if you have further questions.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2B0x0a:ref
Reply all
Reply to author
Forward
0 new messages