Help -> how do I list the total spent for each month on a given account for a given range of months?

25 views
Skip to first unread message

Christopher Larkin

unread,
Sep 10, 2019, 9:01:47 PM9/10/19
to Google Ads Scripts Forum
Hi - 

Is there a way to grab the spend by month for a given account or all accounts under an MCC (or that fit criteria)? 

I thought about AWQL for this, but I don't see how to group by dates in AWQL. Is that even possible? 

Thanks in advance for any suggestions!

Google Ads Scripts Forum Advisor

unread,
Sep 11, 2019, 3:26:09 AM9/11/19
to adwords...@googlegroups.com

Hi Christopher,

I would recommend to use the Account Performance Report and include the ExternalCustomerId field, the Cost field and the MonthOfYear field. I suggested to include the MonthOfYear field as it can breakdown the cost of each account per month. Furthermore, you may refer to this link to see all the available fields that you can include in your report.

Let me know if you have further questions.

Regards,
Ejay
Google Ads Scripts Team



ref:_00D1U1174p._5001UHGN95:ref

Chris Larkin

unread,
Sep 11, 2019, 10:12:30 AM9/11/19
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
I thought ALL_TIME was a possible name. How could I get the all-time data for an account? 

Best regards,
Chris

Chris Larkin
Director of Online Advertising at Arcalea
73 W Monroe, Chicago, IL 60603 
(312) 248-4272   
Primary 214-802-3879  
ch...@arcalea.com  
https://arcalea.com/  



--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/JI3aoG4Y-bg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/idUti000000000000000000000000000000000000000000000PXNONF0045Rbn1a_T0e_c9yuajrG8g%40sfdc.net.

Bastien Rabaute

unread,
Sep 11, 2019, 10:37:40 AM9/11/19
to Google Ads Scripts Forum
Hi Christopher,

Unfortunately, I think what you want to do is not possible. 

The AWQL query for ALL_TIME on account performances will retrieve data for one period which is ALL_TIME. It will not split by months.

I think the only way is to request each month in a loop.

You can test your AWQL queries with https;//www.awql.me (even with GAQL if you want)

Bastien

To unsubscribe from this group and all its topics, send an email to adwords...@googlegroups.com.

Chris Larkin

unread,
Sep 11, 2019, 10:56:19 AM9/11/19
to Bastien Rabaute via Google Ads Scripts Forum, Google Ads Scripts Forum
It ended up being pretty easy Bastian! Thanks for your help - Chris

SELECT AccountDescriptiveName, Year, MonthOfYear, Cost, ExternalCustomerId FROM ACCOUNT_PERFORMANCE_REPORT DURING 20160101, 20190831

Chris Larkin
Director of Online Advertising at Arcalea
73 W Monroe, Chicago, IL 60603 
(312) 248-4272   
Primary 214-802-3879  
ch...@arcalea.com  
https://arcalea.com/  
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/380f66ad-0797-4937-a4da-f1bcc3312edd%40googlegroups.com.

Christopher Larkin

unread,
Sep 11, 2019, 1:46:53 PM9/11/19
to Google Ads Scripts Forum
FYI - I want to (again) praise the replies I've gotten. Thanks to all the feedback on my posts and the other questions I see, I've really upped my skills with coding, and this directly improves the quality of tuning my agency can give our brands. 

In the end, I changed my AWQL to:
SELECT AccountDescriptiveName, Year, MonthOfYear, Cost, ExternalCustomerId FROM ACCOUNT_PERFORMANCE_REPORT DURING 20190101, 20191231

This works great, and for each month through the rest of the year, I have the script sending me totals. 

Next I'll add logic to check the year of the previous month end (since the script will run midday on the first of the month), then the code will check for the tab in my Google Sheet doc. If not found, the tab will be created, before running the report query and inserting the results into that tab of Google Sheets. 

Thanks again -
Christopher
To unsubscribe from this group and all its topics, send an email to adwords-scripts+unsubscribe@googlegroups.com.

Bastien Rabaute

unread,
Sep 11, 2019, 2:36:11 PM9/11/19
to Google Ads Scripts Forum
Of course, it's better to do your way ! I don't think to it.

Google Ads Scripts Forum Advisor

unread,
Sep 12, 2019, 1:34:04 AM9/12/19
to adwords...@googlegroups.com
Hi Christopher,

Let me provide further support on your concern.

With regard to this, "I thought ALL_TIME was a possible name. How could I get the all-time data for an account?"? You should be able to use the 'ALL_TIME' pre-defined date range to get the all time data. However, there is an issue and I was able to replicate it as the script is throwing the "The date range is not valid. Please check spelling and casing" error. With this, I will file a bug to our engineering team and rest assured that we will provide updates when available.

For the mean time, please retain the current setting of the AWQL for reporting, especially the date range.

Moving forward to this concern "Next I'll add logic to check the year of the previous month end (since the script will run midday on the first of the month), then the code will check for the tab in my Google Sheet doc. If not found, the tab will be created, before running the report query and inserting the results into that tab of Google Sheets.". You can include the Year field of the current report type and use it as validation for creating new Google sheet. However, I can see that you already included it in your report.
Reply all
Reply to author
Forward
0 new messages