Our Free Website Uptime Monitor Runs in Google’s AppScript Environment, and Is 100% Effective and 100% Free. Follow These Instructions to Build One for Yourself or Your Agency

Website uptime has consistently been understood to be a ranking factor; it’s obvious that a search engine would tend to reward a website that was consistently online. And, if you are an agency that works on websites or undertakes SEO, your clients might expect you to be taking some steps to ensure reliability. It’s a great tool to offer clients with real value that doesn’t cost anything. Also, downtime is death to conversion rates. We use it at our SEO Agency every day.

If you want to skip the blah-blah, scroll down to “Let’s Get Coding”.

Why are we giving away this free tool?

  • If you like it and use it, maybe you’ll link to our homepage or to this post? (Please?)
  • It was fun to build, seriously!

So Simple, Why Pay for Uptime Monitoring?

And so, a host of 3rd-party services have sprung up to offer paid “website uptime monitoring” services. You know the drill….you get a 2-week trial and after that, it’s a monthly fee to get alerts when your website goes down. Such services and some of the pricing include:

  • Site24x7.com,
  • UptimeRobot.com, chares up to $54 a month for up to 200 sites.
  • DataLog
  • Uptime.com

We’ve used them, we’ve paid for them. But we’ve used this free version for about a year and it’s worked perfectly. There are a bunch of free monitors online, but most only check for 200 status and not for a particular string…

Let’s Start Coding/Building the Uptime Monitor

You will need:

  • Google Sheets (Google’s free spreadsheet app at drive.google.com or docs.google.com)
  • That’s pretty much it, we’ll be writing some code in Google Apps Script, but that is included in Google docs.

Here’s what it will look like when finished:

Here are the columns we’ll be building:

  1. Name, just a name for the website you are tracking
  2. URL, the actual URL to check
  3. Status, The Status column is handled by the script
  4. Last Check, The Last Check column is handled by the script, this updates as the script runs periodically
  5. String to Check, this is the actual string you want the script to read. We use GTM codes, but you can use any string of text
  6. Email Notification, this is an email where you want a notice of site outage to be sent (there is also a default in the script, more on that below

Step One: Create & Populate a Google Sheet

Open google sheets and start a new document, and do this exactly:

  • Name the document
  • Make these exact fields at the top in fields A1 to F1
  • Important! You have to name the first sheet “Websites”, the script needs that identifier
  • Make a second sheet called “Logs”, see the second screenshot

 

Don’t forget to name your sheets!

Next, we want to associate an AppsScript project with our Google Sheet, to do that we navigate to Extensions and then click Apps Script, which I realize that I write as “AppsScript” all the time.

 

When you first navigate to Apps Script, you will create a new Apps Script document that is associated with the Google Sheet. The next time you navigate here, you’ll be editing that same Apps Script Document.

Here is your blank Apps Script, where we’ll be writing code. In this main window, the file “Code.gs” is indicated, and in this edit window we will paste our code. Now we’ll move on to step 2:

 

 

Step 2: Where We Actually Code the Free Website Uptime Monitor

We are pretty much done with our Google Sheet, now we do our work on the associated Apps Script. If you closed your Apps Script window, simply open the Google Sheet and navigate to Extensions and then Apps Script. I had a problem in one account with Apps Script not opening, so I tried another Google account and it worked fine.

What follows is the full script. Simply paste this into the “Code.gs” edit window in Apps Script, replacing the default lines 1 through 4. I have marked up this code with explanations of each section. Near the bottom you can set your own email instead of the dummy email indicated.

 

// Create custom menu when spreadsheet opens. 
// These create a menu item that lets us manually run the script
function onOpen() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

var menuOptions = [{
name: 'Check Status',
functionName: 'checkStatus'
}];

spreadsheet.addMenu('Manage', menuOptions);
}

// Check status of each website in Websites sheet.
function checkStatus() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Websites');
var rows = sheet.getDataRange().getValues();

// Remove/Bypass that first column headings row.
rows.shift();

// Clear the existing Status and Last Check columns.
sheet.getRange('C2:D').clear();

// Loop through rows in sheet and make a request to website url.
// This really is the meat of the script.
for (var i = 0; i < rows.length; i++) { ///is the first row throwing us off?
var row = rows[i];
var name = row[0];
var url = row[1];
var stringToCheck = row[4]; // Get the string to check from column E
var recipient = row[5]; // Get the recipient email from column F
var status = 'OK';
var color = '#bfb';
var timestamp = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'M/d/Y h:m a');
var issues = 0;

if (url) {
try {
var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
var responseCode = response.getResponseCode();
var responseBody = response.getContentText();

// Check if the response code is greater than 200, indicating an issue.
// But this really makes 2 checks, one for the response code and...
// One check for the presence of the string. 
// the "color" commands change the field color to alert to a problem
if (responseCode > 200) {
status = 'ISSUE='+responseCode;
color = '#faa';
issues++;
} else if (stringToCheck && !responseBody.includes(stringToCheck)) {
// If the specified string isn't found in the body, it's an issue.
status = 'STRING MISSING';
color = '#faa';
issues++;
}

// Update Status and Last Check columns with results.
sheet.getRange(i + 2, 3, 1, 2).setValues([[status, timestamp]]).setBackground(color);

} catch (e) {
// Handle errors gracefully if UrlFetchApp fails (e.g., timeout, etc.)
status = 'ERROR'+e;
color = '#faa';
issues++;
sheet.getRange(i + 2, 3, 1, 2).setValues([[status, timestamp]]).setBackground(color);
}

// Rate limit the requests to avoid being blocked.
Utilities.sleep(1000);

// If recipient is defined, notify that person.
if (status != 'OK'){ //only send if it's not good
if (recipient) {
notify(recipient,url,name,issues,status); // Pass recipient to the notify function
} }
}
}

// Notify me if there are issues.
if (issues > 0) {
iteration = 'owner-notifies';
notify(recipient,url,name,issues,status); // Still notify the document owner (default behavior)
}
}

// Send email notification. Sends to document owner AND to any "recipient" from Column F.
// You can put a default email two lines down, I have a dummy email here
function notify(recipient = Session.getEffectiveUser().getEmail(),urlSite,name,issues,status) {
var recipient2 = 'waldo@fakewebsite.com'; //sending to default users
var subject = 'Website Down! Site:' + name;
var body = 'Check spreadsheet for issues found.';
var spreadsheetUrl = SpreadsheetApp.getActiveSpreadsheet().getUrl();
var html = '<p>Check <a target="_blank" href="' + spreadsheetUrl + '">spreadsheet</a> for issues found. Or click on the site <a href="' + urlSite + '">URL</a>. The issue is: ' + issues + ' and the status is: ' + status;
var options = { htmlBody: html };

// Here's the part that actually sends the email on a failure.
if (MailApp.getRemainingDailyQuota() > 0) {
MailApp.sendEmail(recipient, subject, body, options);
MailApp.sendEmail(recipient2, subject, body, options);
}
}

Last Step: Let’s set it to check uptime automatically

We don’t code this, we change a setting in Apps Script. Screenshots will help here:

First, we click the little clock and click “Add Trigger”

 

Then simply set your Trigger to look like this. Essentially we are setting the trigger so that the script runs every 30 minutes. We never had a problem at 30 minutes, faster than that and you might get blocked by a server.

So, yep, make your trigger like this:

 

Let’s manually test the script

First we have to authorize the script, you are sending a bot out to read websites, so you have to approve it, you’ll only need to do this once.

From Apps Script, use the “Run” button at the top and follow the standar authorization steps:

 

Great, now return to your spreadsheet.

Do an initial configuration, something like this. You won’t have “Status” or “Last Check” yet, the script fills those in:

 

Now, you are ready to test manually. From the Google Sheet, go to Manage and then Check Status. Remember, our code added these elements in the first few lines of the Apps Script. If this menu item isn’t there, that’s your problem, the Script isn’t connected.

So here is my first test below. I set the “String to Check” to “Yahoo” because I know that string appears on the URL Yahoo.com. So I would expect an “OK” test and sure enough, I got the following response and no email:

Now let’s test for failure. This time I set the “String to Check” to “Bozo”–just a random word. So, I would expect the uptime monitor to fail (simulating a website than had gone down or was hacked, or some similar failure) and sure enough, I get a failure and an email sent to me.

So how does the uptime monitor really work, in essence?

Basically, you are calling UrlFetchApp.fetch from Apps Script and Google sends a bot and stores the text on the page.

Next the script checks for a 200 response code and tries to match your string from the spreadsheet with what is read on the page of the URL.

After that, the script writes to the Google Sheet and sends an email on failure.

We run this script with about 50 websites for over a year and it’s worked fine.

If you use this script:

Please, link to this page from your website…

Thank you for your time,

Michael David…I CODED THIS!!!

 

 

 

Book Review: The Art of SEO

by Eric Enge, Stephan Spencer, Rand Fishkin, and Jessie C. Stricchiola

Art of SEO Book ReviewIt’s hard for me to review The Art of SEO–after all, the book was a gift from author Eric Enge, owner of search marketing firm Stone Temple Consulting. Eric gave me a copy at PubCon Paradise in Honolulu in February of 2012, and I returned the favor by humbly offering him a copy of my book, WordPress 3.0 Search Engine Optimization.

But were I not to like the book or discover some obvious error, I’d be looking the proverbial gift horse in the mouth. To make my task even more challenging, I’ve met co-author Stephan Spencer as a co-speaker at several PubCon conferences, and the other co-authors are of equal stature in the SEO sphere. Then, I procrastinated this review for so long that the Second Edition came out, necessitating a second gift to me, this time from Spencer.

But no problem: The Art of SEO meets its well-deserved reputation as the Bible on SEO: a sound, comprehensive guide to nuts-and-bolts search engine optimization.

First Impressions

The first thing you’ll notice about The Art of SEO is the testimonials; accolades are offered up by industry heavyweights including Tim Ash, Will Critchlow, Danny Sullivan, Barry Schwarz, Andy Beal, and more. The second edition offers testimonials that go on for pages. The book itself is voluminous: nearly 700 pages of very dense text and ideas.

Support for Fresh SEOs

For an SEO book to be worthwhile, it must serve both experienced practitioners and those just starting out. “Search Engine Basics” lays a solid foundation in clear terms for the material to follow. Chapter 4, “First Stages of SEO,” maps out a clear plan of action for the early stages of a campaign. Some of the more advanced material, though, will likely leave an inexperienced webmaster with a headache. However, text throughout the book is accompanied by explanatory diagrams and images that help the reader visualize the concepts.

Each chapter is broken down into comprehensive subsections. This allows for an in depth analysis without seeming overwhelming.  The detailed snippets focus on the importance of each element, while getting straight to the point.

The sections pertaining to social media are particularly extensive. They discuss the benefits of link building with social media on multiple platforms. They also discuss what types of content work best to attract attention on the different platforms. This section has general information that is beneficial for those new to social media, but it also goes deep into analytics information and new trends that are great for those well versed in social media marketing.

The last chapter, “An Evolving Art Form: The Future of SEO”, discuses how Google and SEO are constantly changing. It’s a game to try to constantly crack the code. It emphasizes the importance of local, voice recognition and mobile search which are recently increasing with the development of new technology — like Siri on the iPhone.

Overall, The Art of SEO is a good book for both beginners and experts. It has basic information, but also goes in depth to fully discuss certain tactics and methods.

 

Local listings are an increasingly large part of search. Google places results now pop up at the top of search results automatically. This is good news for local businesses. If you have a physical location, you better take full advantage of the opportunity!

You should always start by claiming your business on Google Places, then work your way down by submitting information to Yahoo Local, YellowPages.com, and maybe even Bing Local. From there, you want to convince search engines that your business exists and is significant to users. To do that, you’ll have to submit to many alternate local directories.

In Chapter 9 of our book, SEO for WordPress, we talk about local listings and their explosive power in the hands of local businesses.

We at TastyPlacement have been scouring local directories to figure out which best factor into local rankings.

Directory Link Post speed Pictures Notes
Kudzu.com Yes Slow No
MojoPages.com Yes Immediate 4
SuperPages.com(search)
Supermedia.com(data entry)
Yes Moderate 4
InsiderPages.com Yes Immediate 4
ExpressUpdateUSA.com No Moderate No
advertise.local.com Yes Moderate No Upgrade to Premium to add pictures
local.botw.org Yes Moderate Logo only Must email a representative to edit mistakes
MerchantCircle.com Yes Immediate 4 Must email a representative for multiple listings
Hotfrog.com Yes Immediate 4
Yellowbook.com Yes Moderate No May require phone verification
Foursquare.com Yes Immediate No Customers can check-in
thinklocal.com Yes Moderate No
cityslick.net Yes Moderate No
USYellowPages.com No Slow No
MyCity.com Yes Immediate Logo only
BizJournals.com No Slow No
mapinsight.teleatlas.com/mapfeedback No Slow No Provides a tracking number
justclicklocal.com No Immediate No
DiscoverOurTown.com Yes Slow No
MetroBot.com No Moderate No
BestDealOn.com Yes Moderate No
Manta.com/claim Yes Immediate Logo only
Infignos.com No Slow No
Yellowassistance.com No Slow No
MyHuckleberry.com Yes Immediate 4
BrownBook.net/business/add Yes Immediate 4
CitySquares.com Yes Immediate No
Navteq.com No Slow No
CitySearch.com Yes Slow Logo only
Yellowee.com Yes Immediate Logo only
MatchPoint.com Yes Immediate 4
Mapquest.com Yes Moderate No They have a number of options for verification
Sustainlane.com No Immediate 4
Localprice.com Yes Slow No
Thumbtack.com Yes Immediate 4
Scrub the Web No Slow No
CommunityWalk.com Yes Immediate 4
ChamberofCommerce.com Yes Moderate 4