Script Error: ReferenceError: "AdsApp" is not defined.

148 views
Skip to first unread message

Stewart

unread,
Jul 22, 2021, 11:12:11 AMJul 22
to Google Ads Scripts Forum
Hi my script has been working all OK for past few years, however today I toggled the 'Beta' switch, I ran the script within the Beta to see if it would work OK and nothing happened. I think check the logs and the logs were blank.

So I've toggled the 'Beta' switch back to normal/old version, and this time when I run my script I get:

ReferenceError: "AdsApp" is not defined.

and the script doesn't run at all. It's an important script....

Are you able to advise what is the issue here?

Thanks,

Stewart

Google Ads Scripts Forum Advisor

unread,
Jul 23, 2021, 12:38:49 AMJul 23
to adwords...@googlegroups.com
Hi Stewart, 

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

Kindly provide your CID and the script's name so that I can check on the issue you are encountering. You may send them here or privately via the reply to author option. Note that you may need to join the Google Group for you to use this option. If this option is not available at your end still, you may send it through our email (googleadsscr...@google.com) instead.

Looking forward to your reply.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JCs3a:ref

Google Ads Scripts Forum Advisor

unread,
Jul 25, 2021, 11:53:02 PMJul 25
to adwords...@googlegroups.com
Hi Stewart,

Thanks for providing the requested information. Can you kindly try to make a new copy of the script and see if you would still encounter the issue? I should be able to raise this with the rest of the team thereafter.

Let me know how it goes.

Stewart

unread,
Jul 26, 2021, 1:55:30 PMJul 26
to Google Ads Scripts Forum
Hi thank you for that, I copied the script and it is now working :-)

When we tried the 'Beta' the script didn't work, are you able to adjust the script so that it will work with the new Beta is live?

Many thanks,

Stewart

Message has been deleted

Google Ads Scripts Forum Advisor

unread,
Jul 27, 2021, 2:05:58 AMJul 27
to adwords...@googlegroups.com
Hi Stewart,

Allow me to raise your concern to the rest of the team. I'll update this thread the soonest they provide their feedback.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JCs3a:ref

Google Ads Scripts Forum Advisor

unread,
Jul 29, 2021, 9:52:53 PMJul 29
to adwords...@googlegroups.com
Hi Stewart,

Harry here. Thanks for your patience and information us that the issue is now resolved. Unfortunately, we would not be able to adjust your script for you as we can only provide guidance on issues/concerns with regard to your scripts. What I would recommend is checking our migration guide which contains detailed information on how you will migrate your script to the new Google Ads Script Beta.

Feel free to get back to us if you encounter any issue while migrating your script.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JCs3a:ref

Ken Hackenberg

unread,
Aug 24, 2021, 9:59:50 AMAug 24
to Google Ads Scripts Forum
So we are stuck managing edits on our scripts without notice. Mine is failing as well. Shouldn't  the BETA toggle warn you this results can occur? Will someone examine my script? Thank you.

Google Ads Scripts Forum Advisor

unread,
Aug 25, 2021, 12:21:37 AMAug 25
to adwords...@googlegroups.com
Hello,

Thanks for raising this to us. I would like to let you know that the Results column that you see in the Google Ads scripts interface would only let you know the script's recent results. By going through the Script History tab should show you a more detailed information on scripts' executions. The errors and its reasons are expected to be laid there when a script fails. In addition, Google Ads scripts do have the Preview Mode which shows the changes that would have been made had the script been executing. Once satisfied with the output, you can start the live execution of a script or schedule it.

On the other hand, if you would need further assistance with the issue you are encountering, kindly provide your CID and script name so I can take a closer look.

Ken Hackenberg

unread,
Aug 26, 2021, 9:22:00 AMAug 26
to Google Ads Scripts Forum
Preview mode didn't prevent my code from getting corrupted somehow after applying the BETA version. The error is: "ReferenceError: "AdsApp" is not defined. "
There is no history of this script after running.
I believe possibly, that the authorization to run scripts gets corrupted when reverting back from the BETA version.
CID: 411-531-6182
Script name: budgetMinder_mscarolsgymkids.com

Google Ads Scripts Forum Advisor

unread,
Aug 27, 2021, 1:24:50 AMAug 27
to adwords...@googlegroups.com
Hi Ken,

I work along with Harry. Allow me to assist you in this.

I've checked your script and noticed an error specifically to your campaign iterator. Could you please confirm if you're trying to select a campaign name "mscarolsgymkids.com"'? If so, you need to adjust your campaign selector from var nameCampaign = 'Name = "mscarolsgymkids.com"'; to var nameCampaign = 'CampaignName = "mscarolsgymkids.com"';

Please let me know how it goes after doing the recommendation above.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JCs3a:ref

Ken Hackenberg

unread,
Aug 28, 2021, 12:46:52 PMAug 28
to Google Ads Scripts Forum
Teejay -
Thank you for assisting and taking time to review the issue I have with the script error: ReferenceError: "AdsApp" is not defined.
I tried the change you suggested, and the error still displays while the script does not complete.
I believe it is something with the file itself and not the script because I have another script in my account identical to this one that I haven't switched to BETA and back, and it runs fine. If you examine this other script the only difference is an email recipient:
"budgetMinder_mscarolsgymkids.com_BETA_v01"
--
Switching it to BETA and then back is somehow disrupting the file itself from running. When I made the copy of the file getting the AdsApp error it requested authorization (at is normally would), and the copy runs fine. So is switching to the BETA somehow unauthorizing the file?
--
I do plan on updating the script to the BETA format (and thank you for the suggestions because I do not doubt my references or out of date) but this is an example of where the Google Ads Bulk Actions script user should make a copy of their script first before trying the BETA version.
I would like to hear back from you and see what you think.
Thank you, Teejay!

Google Ads Scripts Forum Advisor

unread,
Sep 1, 2021, 2:03:34 AMSep 1
to adwords...@googlegroups.com
Hi Ken,

Thank you for getting back to us and providing an extensive rundown of your concern.

Please note that there is no relation between authorizing the script and toggling the beta feature, so switching to beta will not unauthorize the script.

On the other hand, I've checked your script's history and didn't find any error there. Instead, it successfully executed. With this, could you please provide a screenshot of this behavior so we could pinpoint the issue here? Also, could you confirm if The error is: "ReferenceError: "AdsApp" is not defined. " only occured when beta is toggled on?

Regards.

Ken Hackenberg

unread,
Sep 1, 2021, 9:23:22 AMSep 1
to Google Ads Scripts Forum
Hi Teejay -
Thank you for reviewing my issue with scripts. I renamed the scripts so they make more sense, the "budgetMinder_mscarolsgymkids.com_BETA" is the one in question. As I had mentioned before, nothing shows up in the Script History after running that script file. I run or preview and get the results:
9/1/2021 6:13:53 AM

ReferenceError: "AdsApp" is not defined.

--
Something is with the file itself after converting to BETA then back again (no code changes), it is NOT the code! I created a new script file called "TEST_TEMP",  copied the very same script code from  "budgetMinder_mscarolsgymkids.com_BETA"  there and the  "TEST_TEMP" runs fine. I see other people having the same issue of trying the BETA and switching back then the script fails. Something within the file permissions or whatever, nothing I can control for sure. Sounds like you cannot either.
My suggestion to other Google Ad script writers is do NOT try a "working" file in BETA, copy the file to a new one first then switch the new one to BETA instead else it might get corrupted.
I do not think I will be doing any BETA for now until this behavior has a resolution..

Google Ads Scripts Forum Advisor

unread,
Sep 2, 2021, 3:56:31 AMSep 2
to adwords...@googlegroups.com
Hi Ken,

Thank you for coming back and providing more context to the issue. After a number of tests using your script on my end, I was unfortunately not able to replicate the error on my end. That said, as a last retruest, can you kindly try to use a different script and see if you would encounter the same after you turn on and off the beta option? I should be able to tap the rest of the team in this regard once you reply back.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2JCs3a:ref

Ken Hackenberg

unread,
Sep 3, 2021, 12:42:47 PMSep 3
to Google Ads Scripts Forum
Hiya Harry,
I tried switching "Get Budget Details test" to BETA and back, now it fails with no errors. So then I made a new file, called it "Get Budget Details test2", copied the same script from "Get Budget Details test", ran it, worked, then switched this same scrip to BETA, it failed but displayed error of missing function. All good because it needs to be updated for new BETA language, then I switched this same script back from BETA to normal state, and it runs fine.
Seems any per-existing script files are not adapting to BETA and back again gracefully for some reason, but any new script file works okay switching to BETA and back.
I do not have an answer or reason for it. What do yo think?

Google Ads Scripts Forum Advisor

unread,
Sep 6, 2021, 3:00:13 AMSep 6
to adwords...@googlegroups.com
Hi Ken,

Your observations are absolutely helpful so I really appreciate it. One final request though, would you mind providing a screenshot of when you encountering the error with beta toggled on? I'll definitely ask the team about it for further insights on what causes the issue to happen intermittently and update you accordingly.

Google Ads Scripts Forum Advisor

unread,
Sep 6, 2021, 3:00:39 AMSep 6
to adwords...@googlegroups.com
Hi Ken,

As a side note, if you're having trouble receiving private replies from us, please check your Spam folder. Additionally, please add the 'From address' on that email to your contact list to ensure we aren't flagged as Spam in future messages. If you don't see a message from us in your Spam folder, please email us directly at googleadsscr...@google.com referring to this forum thread.

Ken Hackenberg

unread,
Sep 6, 2021, 11:53:09 AMSep 6
to Google Ads Scripts Forum
Capture-edit01.png
Here is error but I am looking more for help with why the existing file does not translate thru BETA and back.

Google Ads Scripts Forum Advisor

unread,
Sep 7, 2021, 4:42:23 AMSep 7
to adwords...@googlegroups.com
Hi Ken,

Thanks for coming back. The error you are encountering with regard to the budget.campaigns function not being a function seems to be an issue with beta. Allow me to raise this with the rest of the team and get back to you once I have more information or updates becomes available.

If there's anything else I can assist you with in the meantime, please let me know.

Ken Hackenberg

unread,
Sep 7, 2021, 10:38:12 AMSep 7
to Google Ads Scripts Forum
Alrighty, thank you Harry.

Google Ads Scripts Forum Advisor

unread,
Oct 8, 2021, 6:03:00 AM (8 days ago) Oct 8
to adwords...@googlegroups.com
Hello Ken,

Hope you are well. Following up here on the issue with the budget.campaigns function in scripts beta, a fix has already been pushed into production and you should no longer enouter the same. Kindly test your script and let me know if the issue still persists.
Reply all
Reply to author
Forward
0 new messages