Google Ads Script is Breaking

93 views
Skip to first unread message

SEM Booster

unread,
Feb 17, 2021, 3:44:14 AM2/17/21
to Google Ads Scripts Forum
Hi there

A Google Ads Script query that used to work for years is now throwing an error:

  var report = AdWordsApp.report('SELECT Clicks, Cost, Conversions, Impressions FROM ACCOUNT_PERFORMANCE_REPORT WHERE Device="DESKTOP" DURING LAST_MONTH');

The error message I keep getting is:
"Failed to read from AdWords. Please wait a bit and try again."
Trying again didn't help. This is breaking since the beginning of the month.

This line of code used to execute successfully for years and started breaking recently. If I remove this part: "WHERE Device="DESKTOP" it works but then I can't segment by device. 

Did anyone experience this? Knows a workaround?

TIA
Ella

Google Ads Scripts Forum Advisor

unread,
Feb 17, 2021, 5:35:16 AM2/17/21
to adwords...@googlegroups.com

Hi Ella,

 

Thanks for reaching out. I am Harry, from the Google Ads Scripts Team.

 

Can you kindly provide your CID and the script name where you are encountering the issue so that I can check this on our end and assist you further? You may send them here or privately via the reply to author option. If this option is not available at your end, you may send it through our email (googleadsscr...@google.com) instead.

 

Thanks,

Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2CRs7l:ref

Sigurd Fabrin

unread,
Feb 17, 2021, 12:23:18 PM2/17/21
to Google Ads Scripts Forum
Hi Ella.

It expects a list in an array when you reference predicate values like that


Try this

  var report = AdWordsApp.report(
    'SELECT ' +
    'Clicks, Cost, Conversions, Impressions ' +
    'FROM ACCOUNT_PERFORMANCE_REPORT ' +
    'WHERE Device IN ["DESKTOP"] ' + // predicate value in array
    'DURING LAST_MONTH'
  );  


 sigurd

Google Ads Scripts Forum Advisor

unread,
Feb 18, 2021, 12:14:13 AM2/18/21
to adwords...@googlegroups.com

Hi Ella,

 

I have taken a look at your script and it does not seem to be a specific issue with the query/where clause that you are using, but is (assuming) an issue with the script as a whole. Running the query mentioned alone works fine with either comparing the value with a string or an array. With that said, allow me to raise this to the rest of the team and get back to you as soon as I have more information.

SEM Booster

unread,
Feb 18, 2021, 2:16:00 AM2/18/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hi there

I've just tried running the script again and this time it worked! I guess something was fixed on your end since it failed dozens of times when I tried before (I haven't changed anything in the script) so thanks for making it work again :)

Ella

--
-- 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 the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/jQG4t000000000000000000000000000000000000000000000QOPL7J00Iw-iMWFtRoyeYP0hhUc4yg%40sfdc.net.

Google Ads Scripts Forum Advisor

unread,
Feb 18, 2021, 4:32:32 AM2/18/21
to adwords...@googlegroups.com

Hi Ella,

 

Thanks for informing us. Let me know if the issue still persists.

Ruslan Obolonsky

unread,
Feb 18, 2021, 4:39:19 AM2/18/21
to Google Ads Scripts Forum
Hello.
Have the same issue now.
The script that used to work for months is now throwing an error:
screenshot-ads.google.com-2021.02.18-11_35_20.png

Google Ads Scripts Forum Advisor

unread,
Feb 18, 2021, 5:55:46 AM2/18/21
to adwords...@googlegroups.com

Hi Ruslan,

 

Kindly provide your CID and script name through our email (googleadsscr...@google.com) so that I can take a look at this on our end. As this worked for Ella after some time, I would suggest to try and recreate the script on your end and see if it would result in the same behavior.

Ruslan Obolonsky

unread,
Feb 18, 2021, 8:35:48 AM2/18/21
to Google Ads Scripts Forum
Hi.
Sent to your email

Google Ads Scripts Forum Advisor

unread,
Feb 18, 2021, 11:58:07 PM2/18/21
to adwords...@googlegroups.com

Hi Ruslan,

 

Thanks for proving your details. Upon checking, it does not seem that you have the same issue as Ella and I can confirm that there are no known performance issues related to this that I know of. The script is returning error: Exceeded maximum execution time which would be 30 mins and you can find check this in the Script History section in the UI. Your script seems to process a lot of data which means it would take longer execution time. It would be best if you continue to use shorter date ranges or retrieve your reports in batches in this regard.

 

Google Ads scripts for advertiser accounts can execute for a maximum of 30 minutes, after which they will be cancelled. All of the changes made before the script was cancelled will be applied. Please see Limits for your more details.

Ruslan Obolonsky

unread,
Feb 19, 2021, 6:17:51 AM2/19/21
to Google Ads Scripts Forum
Hi.
I can't agree with you. I am sure that a few days ago the same query (simple data for 2 days) with the same volume of data worked in a few seconds. But, now it works 16 min.

So, when I am trying to get data for 30 days I am facing error: Exceeded maximum execution time. 
But the same query worked just 17 min a few days ago. So I think there are some issues with performance on your side, I'll wait until Monday and try again.
Screenshot 2021-02-19 13.15.19.jpg

Google Ads Scripts Forum Advisor

unread,
Feb 21, 2021, 9:59:21 PM2/21/21
to adwords...@googlegroups.com

Hi Ruslan,

 

Thanks for clarifying and the added context. Can you kindly confirm that you are still encountering the same issue/error on your end? If yes, I would suggest to recreate the script, reauthorize and see if it would result to the same behavior.

 

Let me know how it goes and if the issue still persists so that I would be able to bring this up to the rest of the team as well.

Ruslan Obolonsky

unread,
Feb 22, 2021, 1:55:20 AM2/22/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hello Harry.
Hope you are doing well. Thanks for your patience.

I've recreated the script (new name, new authorization), but there is the same issue :(

Even more now I have new strange unexpectable behavior. I've run the script with much less date range (few days only), it worked few minutes, but in history eventually, I see '1 second'. It's impossible. I have a feeling that it just freezes sometimes.

image.png

Please, help me to solve this problem. It's an urgent question for our business.

FYI - I've added a log to the script so you can see the query and date range in script history:
image.png


Wait for your reply.




--
-- 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/a0cM6CsLBL0/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/4JCch000000000000000000000000000000000000000000000QOWTMS00dzR2rj9NRcK8TRI2ZN-iaQ%40sfdc.net.


--
Best wishes,Product Manager of BI Core, OWOX

Google Ads Scripts Forum Advisor

unread,
Feb 22, 2021, 4:29:55 AM2/22/21
to adwords...@googlegroups.com

Hi Ruslan,

 

Thanks for providing your observations on the matter. Allow me to raise this concern to the rest of the team as well. Rest assured that I will keep you updated once I have more information in this regard alongside the data discrepancy issue.

Google Ads Scripts Forum Advisor

unread,
Feb 22, 2021, 9:30:31 AM2/22/21
to adwords...@googlegroups.com
Hello,

I looked through the logs of the most recent failure, and it appears that one of the reports you're fetching has nearly 500,000 rows and takes 25 minutes to download (out of the 30 total minutes you have for execution).

See:
2/22/2021 3:22:56 AM    Query report and daterange: SELECT CampaignName,CampaignId,CampaignStatus,ImageCreativeName,AdGroupName,AdGroupId,Id,DisplayUrl,CreativeFinalUrls,CreativeTrackingUrlTemplate,Cost,Clicks,Impressions,AccountCurrencyCode,Date FROM AD_PERFORMANCE_REPORT  DURING 20210106,20210110
2/22/2021 3:49:18 AM    Downloaded AD_PERFORMANCE_REPORT for account REDACTED with 497461 rows, in 19 chunks.

It looks like the issue may just be that your account has grown in size, and the data now exceeds the amount that this script can support. You can try removing this specific report from the BigQuery exporter script to see if that resolves the issue.

Regards,
Mike, Google Ads API Team

ref:_00D1U1174p._5004Q2CRs7l:ref

Ruslan Obolonsky

unread,
Feb 22, 2021, 10:48:24 AM2/22/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hello Mike.
Thanks for your reply.
I understood where is the problem. Lately, script have had downloaded all metric where impressions > 0 without explicit condition in a query from my side. But starting last week this changed and I got a lot of rows with 0 metrics. It dramatically increased the number of rows. That's why I got this error.
So now I added explicit CONDITIONS: 'WHERE Impressions > 0' and it reduced the total amount of rows and it started to work much faster.

But I still have troubles in UI with showing the time of execution. I guess there is some delay in UI. However - it's not critical.
image.png

Thanks a lot for your patience and help. I have no more questions on this topic.



--
-- 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/a0cM6CsLBL0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages