Link Checker Script Error

242 views
Skip to first unread message

José Luís Culebras

unread,
Sep 13, 2023, 2:07:52 AM9/13/23
to Google Ads Scripts Forum
I am currently trying to implement the Google Link Checker script in a single Google Ads account. The script can be found here: https://developers.google.com/google-ads/scripts/docs/solutions/link-checker

I follow the instructions on this page to copy the spreadsheet (click on "How to copy the template spreadsheet"). However, when I click on the "Install the script template" button, Google Ads opens my MCC account, and I want to install this script at the account level. 

What I do then is go to the Scripts section of my account and create the 3 files that this script generates, (Config.gs, Info.gs, Code.gs). Then I copy the code from an account that is running the script, and change the Spreadsheet URL. 

However, when I run the script, there is an error: 
ReferenceError: CONFIG is not defined (line 61).

How can I fix it?

Thanks.

Google Ads Scripts Forum Advisor

unread,
Sep 13, 2023, 5:14:23 AM9/13/23
to adwords...@googlegroups.com
Hi,

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

After reviewing your concern, I understand that you are getting the error "ReferenceError: CONFIG is not defined" while running a script. I would like to inform you that you are getting the error message because the CONFIG variable is not defined in the script. In order to fix the error, I suggest you make sure that the variable config is defined in the script. You can do this by creating a file called Config.gs and adding the following code to it:

var CONFIG = {
   spreadsheetUrl : 'YOUR_SPREADSHEET_URL'
}

If the issue still persists, kindly provide us with the following details to further investigate your concern: 
  • Google Ads account ID / CID
  • Name of the affected script
  • If the script uses a spreadsheet, please provide a shareable link to the spreadsheet. You can follow this guide to share a file publicly.
You can send the details via Reply privately to the author option, or direct private reply to this email.

 
This message is in relation to case "ref:_00D1U1174p._5004Q2okpkc:ref"

Thanks,
 
Google Logo Google Ads Scripts Team

 

José Luís Culebras

unread,
Sep 15, 2023, 4:12:42 AM9/15/23
to Google Ads Scripts Forum
I followed your instructions and now, I have a different error message.

TypeError: Cannot read properties of undefined (reading 'advanced_options') (line 61)

¿Could you please check the script? These are the account details. 

My knowledge about scripts is limited, so I don't know exactly what portion of the code is wrong. 

Also, how I can limit the link check to active campaigns, ad groups, kw, ads an extensions?

Thanks. 

Nils Rooijmans

unread,
Sep 18, 2023, 3:31:53 AM9/18/23
to Google Ads Scripts Forum
This is probably your best bet:
instead of clicking on the "Install the script template" button to install the code, try this

In Google Ads, navigate to Scripts by clicking the Accounts tab, then choose Bulk Operations > Scripts in the left navigation.
Create a new script and give it a name. 
Copy-paste the complete source code into the script. (click on the 'copy code' icon in the right upper corner of the code section on the page)
Authorize the script.
Fix all configuration steps as documented on the page.
Run the script.

Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/


José Luís Culebras

unread,
Sep 19, 2023, 7:12:24 AM9/19/23
to Google Ads Scripts Forum
Hi Nils and Support. 

What I've done is exactly this: I installed the script in one account (using the "Install script" button from the Link Checker for Google Ads page). Then, I created a script in another account, and copied the content from Info.gs, Config.gs, Code.gs changing only the spreadsheet URL. Then, I got this error:  

ReferenceError: CONFIG is not defined (line 61).

But, If I paste this in Config.gs:
var CONFIG = {
   spreadsheetUrl : 'theurl'
}

I got this error: 

TypeError: Cannot read properties of undefined (reading 'advanced_options') (line 61)


Google Ads Scripts Forum

unread,
Sep 19, 2023, 7:15:38 AM9/19/23
to Google Ads Scripts Forum
I pasted the full script and it worked!

Thank you, Nils. 

El lunes, 18 de septiembre de 2023 a las 9:31:53 UTC+2, Nils Rooijmans escribió:

Google Ads Scripts Forum Advisor

unread,
Sep 20, 2023, 9:52:35 AM9/20/23
to adwords...@googlegroups.com
Hi,

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

After reviewing your concern, I understand that you are facing some error while running the script. I would like to confirm that I checked your “Link Checker” script as referenced in the document. I did not find any error in your script. Could you please recheck it once from your side and If you still encounter any issue please get back to us with following details : 
  • The uncropped screen shot of the error you encountered.
Reply all
Reply to author
Forward
0 new messages