Getting cost for every add

56 views
Skip to first unread message

Nero Gato Nevoso

unread,
Jul 27, 2021, 10:34:48 AM7/27/21
to AdWords API and Google Ads API Forum
Hello, I've been trying to get the cost for every add but was not able to. I tried to get the cost_micros metric but it gives me a query error: unexpected input metrics.cost

This is my current query:

"SELECT campaign.id, "
. "segments.date "
. "metrics.cost_micros "
. "FROM ad_group_ad "
. "WHERE segments.date DURING LAST_30_DAYS "
. "ORDER BY segments.date DESC";

All others work it's just the metrics.cost_micros that won't.

Any help is appreciated. Thanks!

Google Ads API Forum Advisor

unread,
Jul 28, 2021, 11:20:19 AM7/28/21
to nerogaton...@gmail.com, adwor...@googlegroups.com
Hi Nero,

Thank you for bringing this issue to our attention. First I would suggest looking at this link which has an exact sample of making a query call very similar to this. There are a few items which pop out to me and would suggest looking at.

First, I would start by removing the ORDER BY, just to make sure that this is not causing something with that one metric. Second is that I see you are pulling the campaign id from the start? Again not sure if it could be causing an issue with the one metric. And the last item would be to make sure there are no " or. in the query, but this could just be only because of the post.

In general, I would suggest using the exact query they show and then build up from that to what you want exactly. Chances are by doing this we will see what might be causing the issue.

Regards,
Google Logo
William Pescherine
Google Ads API Team
 


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