Paying for traffic is expensive.
There is nothing worse than sending traffic to a broken link or page that is down.
You would think this would be common sense, but at least once a month I click on a ppc ad that goes to a 404 page or a page with some other error code.
It happens to the best of us. We make a change to the website and forget to update the SEM campaign, or perhaps we typed in the wrong URL in the ad, or did some bulk editing and accidentally made a mistake.
When this happens, you are throwing money down the drain, literally!
This is most common with landing pages where you might make changes constantly, or launch new campaigns and take down old ones or simply redesign your site. There are lots of reasons why a landing page might not resolve…but, there is NO EXCUSE to be paying for clicks that you have no chance of converting.Â
Hint: It is a good idea to turn your 404 page into a landing page. LeadPages.net offers a great 404 template in an easy to deploy format for WordPress sites.
If you are running traffic to dozens or hundreds of pages, it’s hard to know if one goes down.
Here’s a strategy you can follow to monitor your ppc for broken links to make sure your landing pages are always up and running.
There are two versions of this Adwords Script, one which monitors one account and another meant for MCC accounts where you can monitor multiple accounts simultaneously.
As you know, Adwords Scripts programmatically make changes to your Adwords account. While this script works wonders, it only checks your Adwords landing pages. If you happen to be using the same landing pages for Bing and Yahoo, you’re covered…
I have my script running daily, and it basically checks all the URLs in active campaigns and emails me a report of all the accounts I run. Here is a screenshot of what my reports look like:
If you were to click through to see details, it would show you exactly where the problem links are so you can quickly go in and fix them ASAP.
If you want me to monitor your account for broken links for you, simply email me your Customer ID and once it’s linked in my MCC account, this script will automatically run it for you. You can email me at david@davidmelamed.com.
If you are more of a DIY kinda guy, here are step by step instructions:
Let’s dive right in. If you need to know how to setup an Adwords script follow the instructions in this post. There are only two small differences. One, you need to upload a different code for the script which will appear below and two, you will need to slightly modify this code to email you the report.
Great, now let’s setup the code to install. There are two options here. Google has a code they created and shared. You can try to implement it, however when I tried it, I got an error message, so I’m not sure how to fix it, but feel free to give it a try…
Good news if it doesn’t work for you though: Russ Savage published a code that works wonders. It installed super quick, and runs like a charm.
/****************************
* Find Broken Urls In Your Account
* Version 1.1
* ChangeLog v1.1
*Â - Updated to only see Text Ads
* Created By: Russ Savage
* FreeAdWordsScripts.com
****************************/
function
main() {
 Â
// You can add more if you want: http://goo.gl/VhIX
 Â
var
BAD_CODES
= [
404
,
500
];
 Â
var
TO
= [
'email@example.com'
/*,'email_address_2@example.com'*/
];
 Â
var
SUBJECT
=
'Broken Url Report - '
+ _getDateString();
 Â
var
HTTP_OPTIONS
= {
   Â
muteHttpExceptions:
true
 Â
};
  Â
 Â
//Let's look at ads and keywords for urls
 Â
var
iters = [
   Â
//For Ad Level Urls
   Â
AdWordsApp
.ads()
     Â
.withCondition(
"Status = 'ENABLED'"
)
     Â
.withCondition(
"AdGroupStatus = 'ENABLED'"
)
     Â
.withCondition(
"CampaignStatus = 'ENABLED'"
)
     Â
.withCondition(
"Type = 'TEXT_AD'"
)
     Â
.get(),
   Â
//For Keyword Level Urls
   Â
AdWordsApp
.keywords()
     Â
.withCondition(
"Status = 'ENABLED'"
)
     Â
.withCondition(
"DestinationUrl != ''"
)
     Â
.withCondition(
"AdGroupStatus = 'ENABLED'"
)
     Â
.withCondition(
"CampaignStatus = 'ENABLED'"
)
     Â
.get()
   Â
];
 Â
 Â
var
already_checked = {};
 Â
var
bad_entities = [];
 Â
for
(
var
x
in
iters) {
   Â
var
iter = iters[x];
   Â
while
(iter.hasNext()) {
     Â
var
entity = iter.next();
     Â
if
(entity.getDestinationUrl() ==
null
) {
continue
; }
     Â
var
url = entity.getDestinationUrl();
     Â
if
(url.indexOf(
'{'
) >= 0) {
       Â
//Let's remove the value track parameters
       Â
url = url.replace(/\{[0-9a-zA-Z]+\}/g,
''
);
     Â
}
     Â
if
(already_checked[url]) {
continue
; }
     Â
var
response_code;
     Â
try
{
       Â
Logger
.log(
"Testing url: "
+url);
       Â
response_code =
UrlFetchApp
.fetch(url,
HTTP_OPTIONS
).getResponseCode();
     Â
}
catch
(e) {
       Â
//Something is wrong here, we should know about it.
       Â
bad_entities.push({e : entity, code : -1});
     Â
}
     Â
if
(
BAD_CODES
.indexOf(response_code) >= 0) {
       Â
//This entity has an issue. Save it for later.
       Â
bad_entities.push({e : entity, code : response_code});
     Â
}
     Â
already_checked[url] =
true
;
   Â
}
 Â
}
 Â
var
column_names = [
'Type'
,
'CampaignName'
,
'AdGroupName'
,
'Id'
,
'Headline/KeywordText'
,
'ResponseCode'
,
'DestUrl'
];
 Â
var
attachment = column_names.join(
","
)+
"\n"
;
 Â
for
(
var
i
in
bad_entities) {
   Â
attachment += _formatResults(bad_entities[i],
","
);
 Â
}
 Â
if
(bad_entities.length > 0) {
   Â
var
options = { attachments: [
Utilities
.newBlob(attachment,
'text/csv'
,
'bad_urls_'
+_getDateString()+
'.csv'
)] };
   Â
var
email_body =
"There are "
+ bad_entities.length +
" urls that are broken. See attachment for details."
;
    Â
   Â
for
(
var
i
in
TO
) {
     Â
MailApp.sendEmail(
TO
[i],
SUBJECT
, email_body, options);
   Â
}
 Â
}Â
}
Â
//Formats a row of results separated by SEP
function
_formatResults(entity,
SEP
) {
 Â
var
e = entity.e;
 Â
if
(
typeof
(e[
'getHeadline'
]) !=
"undefined"
) {
   Â
//this is an ad entity
   Â
return
[
"Ad"
,
           Â
e.getCampaign().getName(),
           Â
e.getAdGroup().getName(),
           Â
e.getId(),
           Â
e.getHeadline(),
           Â
entity.code,
           Â
e.getDestinationUrl()
          Â
].join(
SEP
)+
"\n"
;
 Â
}
else
{
   Â
// and this is a keyword
   Â
return
[
"Keyword"
,
           Â
e.getCampaign().getName(),
           Â
e.getAdGroup().getName(),
           Â
e.getId(),
           Â
e.getText(),
           Â
entity.code,
           Â
e.getDestinationUrl()
          Â
].join(
SEP
)+
"\n"
;
 Â
}
}
Â
//Helper function to format todays date
function
_getDateString() {
 Â
return
Utilities
.formatDate((
new
Date()),
AdWordsApp
.currentAccount().getTimeZone(),
"yyyy-MM-dd"
);
}
'email@example.com'
to your actual email address and/or anyone else you want to email.
This is such a great tip. Thank you SO MUCH.
You are very welcome. Look out for my next post about tracking 404’s in Analytics.
Speaking of 404 pages; if your 404 page is able to put a smile on the visitos face then things might not be so bad. A smiling visitor is (more) likely to stick around.
You could show a ‘recommendation’ on that same 404 page leading the visitor to either another page on your website or to an affiliate link somewhere.
Of course the visitors wouldn’t be targeted so it is just for the exceptions. Monitoring the 404 page visits is still required so you know which links out there have to be fixed or rerouted to the proper page.
I’ve always wanted to be able to prevent this from happening. I just didn’t know there was a way.
There’s actually a bunch of ways. For example, PPCHero has a script in their pro account that automatically pauses your ads if its going to a 404 page.
This seems very useful but I’m still very much intimidated by the thought of doing this.
Me, too. :/
I would be happy to set this up for you if you want. It takes 2 minutes. Just email me at david (at) davidmelamed.com
This was a good read, I like your posts and tips very much. Please keep writing good materials so I can keep learning more each day.
My pleasure. I would encourage you to check my blog at davidmelamed.com regularly as I share my best stuff there. (dig through the archives for some real gems.)
There is nothing more irritating that wanting to read or buy something and then when you click the link it’s broken. I mean talk about lost money! I think every company out there with a website needs to read this piece and fix their site so it doesn’t happen to them.
That is like my number 1 internet pet peeve. HATE that.
Next time this happens to you, be sure to forward this post to them. They’ll appreciate it.
I LOVE this blog. David, you and Jeremy have taught me so much over the last couple months. I check this blog every day to see what I can do better as I jump into starting my own blog and affiliate marketing.
I can only take credit for 21 posts so far, but I’m glad you are learning from them. Make sure to read TaeWoo’s stuff as well, it is dead on.
This is all so new to me. Wow.
You’re dead on. Traffic is so expensive why waste money on it if you’re just going to send it to a non-functioning page. Just piss away the money!
I know. It constantly blows my mind seeing how much money is being wasted all around me. Unfortunately though, if people stopped wasting money, the economy might just collapse 🙂 j/k
Technology helps you to do wonders.
Hi, David! 🙂
I think anyone who will read this article of yours would agree with you, and would not ask for further explanation.
As what you’ve said, paid traffic is expensive. So, it is just right that you ensure you didn’t send paid traffic to broken links. It’s a common sense, just like what you’ve also thought.
If this thing will happen, whether an accident or not, you’re just throwing money. You must be practical and wise nowadays. You work hard to earn money online, and not to throw away money online.
Thanks for sharing what you know! You’re such a help, especially for marketers.
Good day! 🙂
Best,
Ann07
By the way, I found this post shared on Kingged.com
David, you are fast becoming the worlds leading expert on adwords tips! Another home run, keep up the great work.
Well, I never thought of it until now. This is indeed a serious issue. For me, I were in this scenario, I will choose your first advice and turn the 404 page into a landing page, so there is no worries. The second option is little complicated and I will prefer to stay out of it. There might be some tracking problems though. I loved the article, it will help many like me who were not even aware of this issue.
Anyway, I found the link to this article on kingged.
Thank you for sharing this wonderful strategy.
Details for Adwords Scripts version are very helpful
Really informative article post.Thanks Again. Awesome. eceeabfkaeca
Hi, everything is going well here and ofcourse every one is sharing information, that’s really fine, keep up writing. dcdegebacdke