如果最终的网址重定向到404,是否可以创建一个暂停关键字的Adwords脚本?并在更正URL时启用它们?
我知道常见的链接检查器脚本,但只会在URL错误时通知您?它没有任何动作。
这可能吗?
谢谢,
Broon。
答案 0 :(得分:0)
是的,代码看起来像这样:
function main(){
$_Keywords = AdWordsApp.keywords()
.get()
while ($_Keywords.hasNext())
{
$_Keyword = $_Keywords.next()
try {
var $_Response = UrlFetchApp.fetch($_Keyword.urls().gerFinalUrl(), {muteHttpExceptions: true});
$_ResponseCode = $_Response.getResponseCode();
} catch (e) {
//Presuming something went wrong here
$_Keyword.pause()
}
if ($_ResponseCode == 404)
{
$_Keyword.pause()
}
}
}