How can I set the daterange to LAST_7_DAYS in query language?

100 views
Skip to first unread message

Jip Veerbeek

unread,
Nov 2, 2022, 11:33:33 AM11/2/22
to Google Ads API and AdWords API Forum
Hello team,

I am trying to set the daterange to LAST_7_DAYS with the query language. 
I found this in the documentation:

Syychermafbeelding 2022-11-02 163038.jpg
I have tried this:

Sychermafbeelding 2022-11-02 162812.jpg

I cant find another way to do this and I hope someone can help me with this.

Regards,

Jip Veerbeek

Google Ads API Forum Advisor

unread,
Nov 2, 2022, 3:00:45 PM11/2/22
to jip.ve...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

Upon taking look at your query, I noticed that you are using incorrect order by clause. Please see this guide. 

Please find below query for example:
SELECT metrics.conversions, metrics.conversions_value, metrics.cost_per_all_conversions, metrics.cost_per_conversion, segments.date, ad_group.effective_target_cpa_micros, ad_group.id FROM ad_group WHERE segments.date DURING LAST_7_DAYS ORDER BY segments.date ASC

Let me know if you have any questions.

Thanks,
Google Logo
Nirmita
Google Ads API Team
 


ref:_00D1U1174p._5004Q2fzMLL:ref

Jip Veerbeek

unread,
Nov 3, 2022, 10:02:01 AM11/3/22
to Google Ads API and AdWords API Forum
Hello,

Thanks for the help.
I was wondering if it is possible to retreive information from the last 90 days in the same way you can do it with 7, 14 and 30.

Regards,

Jip Veerbeek

Google Ads API Forum Advisor

unread,
Nov 3, 2022, 12:20:31 PM11/3/22
to jip.ve...@gmail.com, adwor...@googlegroups.com
Hi Jip,

There are no other predefined date ranges aside from the list you referenced in your first email. To use a 'last 90 days' date range, you will have to implement a dynamic custom date range.

Regards,

Google Logo
Matt
Google Ads API Team
 


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