Querying aggregated metrics for custom intervals

56 views
Skip to first unread message

Антон Бендриков

unread,
Nov 18, 2020, 6:12:17 AM11/18/20
to AdWords API and Google Ads API Forum
Description:
for the purposes of an example, lets say I have an Ad Group. I want to know how many impressions/clicks/other metrics I received on this Ad Group in the last 7 days (or any other from X to Y interval) daily (or hourly, or any other aggregate criteria).

Problem:
as far as I can tell, to satisfy the request above, I need to make X requests to the google ads api (where X is the number of days in my interval). There is no way to receive all of the data I want in a single query.

If it is possible, could someone point me in the direction of how to do that?

If it is not possible, I think this sort of query is reasonable and the API should provide a better way of getting this information.

Google Ads API Forum Advisor Prod

unread,
Nov 18, 2020, 3:39:21 PM11/18/20
to antj...@gmail.com, adwor...@googlegroups.com

Hi Антон,

Thank you for reaching out. You could actually fetch data for a date range in one query via the Google Ads API. You could use date-related segment fields to implement the query.

Thanks and regards,
Xiaoming, Google Ads API Team

 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q27ulap:ref

Антон Бендриков

unread,
Nov 19, 2020, 5:31:57 AM11/19/20
to AdWords API and Google Ads API Forum
Hello,

thank you for the answer! Ah so this looks to me like I can effectively do `SELECT segments.date` to achieve the `GROUP BY` functionality I want.

Will test later and post if this helped.

Google Ads API Forum Advisor Prod

unread,
Nov 19, 2020, 3:56:12 PM11/19/20
to antj...@gmail.com, adwor...@googlegroups.com

Hi Антон,

Thank you for reaching out. Yes, this is correct. Please let us know if you have any further concerns.



Thanks and regards,
Xiaoming, Google Ads API Team

Антон Бендриков

unread,
Nov 20, 2020, 3:56:59 AM11/20/20
to AdWords API and Google Ads API Forum
I realised I don't actually have data to test this with (don't think test ads accounts can have any data on them and my app is not yet allowed to work with live accouts).

So I will just assume that this works as expected (the docs seem pretty convincing) and close this.

tl;dr
If you want to have functionality similar to what you would normally have with a 'GROUP BY' in a typical sql-like query -- add the segment that you want to 'group by' as part of your SELECT condition.

Google Ads API Forum Advisor Prod

unread,
Nov 20, 2020, 3:27:00 PM11/20/20
to antj...@gmail.com, adwor...@googlegroups.com

Hi Антон,

Thank you for reaching out. The segmentation in the GAQL and AWQL is basically behaving the same as 'GROUP BY' in SQL language. I’m very confident that it will work for your use case.



Thanks and regards,
Xiaoming, Google Ads API Team

 

Reply all
Reply to author
Forward
0 new messages