Adwords Link Checker - check for redirects

877 views
Skip to first unread message

Ryan Scollon

unread,
May 18, 2016, 11:48:11 AM5/18/16
to AdWords Scripts Forum
Hey guys,

I recently implemented the single account link checker (https://developers.google.com/adwords/scripts/docs/solutions/link-checker) but noticed that it returns a 200 ok in the spreadsheet for a link that is actually a 301 redirect. Is there any way to get it to alert me of any 301 or 301 redirects 

Tyler Sidell (AdWords Scripts Team)

unread,
May 18, 2016, 3:30:37 PM5/18/16
to AdWords Scripts Forum
Hi Ryan,

You are experiencing this due to the inability of UrlFetchApp to detect redirects.  The script will return 200 and 404 response codes.  You can monitor what gets returned by the following line:
responseCode = response.getResponseCode();

Thanks,
Tyler Sidell 
AdWords Scripts Team

Augusto Rebagliati

unread,
Jul 10, 2019, 6:58:35 AM7/10/19
to Google Ads Scripts Forum
I know this is an old post and Ryan hopefully found the answer he was looking for. But since the page still ranks and people stilll look for a solution (as I just did), I would like to point to the same question in another thread with a very straightforward answer by Anthony Madrigal: https://groups.google.com/forum/#!topic/adwords-scripts/GUECDB5FjP8

He said, that you need to find this line: UrlFetchApp.fetch(url, {muteHttpExceptions: true}).getResponseCode(); 
And change it by this here: UrlFetchApp.fetch(url, {muteHttpExceptions: true,followRedirects:false}).getResponseCode();

Augusto

Nils Rooijmans

unread,
Jul 15, 2019, 3:44:33 AM7/15/19
to Google Ads Scripts Forum
Hi Tyler, Augusto,

for those who feel uncomfortable making changes to the javascript code i've developed a somewhat less complicated script to check for redirects in your account.

The script is ready to use, simply copy paste , add the email and spreadsheet url and you are good to go.


Hope this helps, 

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

Phoebe Qian

unread,
Apr 9, 2020, 5:44:32 PM4/9/20
to Google Ads Scripts Forum
Hey Nils,
I have set up this the final URL checker script on https://developers.google.com/google-ads/scripts/docs/solutions/link-checker
However, it didn't send over an email alert to my designated email address. 
Do you know what the issue could be?
Another question: can we use the same spreadsheet for multiple accounts? or we have to create a new spreadsheet for each account.

If you could provide some guidance, that would be much appreciated!
Phoebe

Google Ads Scripts Forum Advisor

unread,
Apr 10, 2020, 11:00:04 AM4/10/20
to adwords-scripts+apn2wqcgrxcl77dr...@googlegroups.com, adwords-scripts+apn2wqcgrxcl77dr...@googlegroups.co, adwords...@googlegroups.com
Hi Phoebe,

There are a number of possible explanations for this. If you can please provide your CID and script name, that will help us investigate the issue.

Thanks,
Matt
Google Ads Scripts Team

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