Shopping Cart (0)

SEO Plugin: Search Engine Visit Alerts

6 Posted January 26, 2012 by Guru Frog Categories: SEO

Hello Tadpoles,

I’ve got something more tangible for you this week, a plugin that I built. I should state upfront that I am not a developer, so please don’t judge me on my coding kung-fu. This post was inspired by an eFrog fan, James M, when he wrote a blog post about requiring a script of sorts to see when Search Engines were arriving at his website as well as by a client that wanted to know when his site was going to be indexed by Google.

First things first, let me tell you about the plugin. The idea is quite simple, the script determines the agent that is arriving at the website (could be a “human” or a search engine spider) and sends an email alert if it’s an engine, thus informing you that a spider is crawling your site and potentially indexing your content. Nifty eh? I think so.

My first move was to write a script that determines whether the agent is a bot (robot aka engine aka spider), in the case below I’ve simply used Google, Yahoo and MSN (Bing). There are hundreds of bots and you can see the complete list here and adapt as you see fit. The second move was to include some simple mailing code, which executes when the visiting agent is a bot and sends an email alert – hence the name, CrawlAlert.

Here is the PHP code to determine the agent and trigger the alert:

<?php

$to = ""; // insert receiving email address
$from = ""; // insert sending email address
$body = "";
$bots = array('Googlebot', 'Yahoo', 'MSN'); //add the bots you want

foreach ($bots as $bot)
	{
		if (eregi($bot, $_SERVER['HTTP_USER_AGENT']))
		{
			$subject = "BOT DETECTED: " . $_SERVER['HTTP_USER_AGENT'];
			if (mail($to, $subject, $body, $from))
			{
				  // nudda
		 	}
		}
	}
?>

Because eFrog Digital Design builds WordPress themes, it made sense to turn the script into a WordPress plugin and release it for all of you tadpoles to try out, who knows what use you might find or how you might evolve it. In fact, we’d love you to evolve it and let us know!

The plugin code was fairly straight forward, I had to create a hook to enable a Dashboard menu item, which displays some plugin settings and then a further hook to tap into the wp_footer function to ensure that the alert function is executed each time someone visits the site.

You can download the plugin by clicking here, unpack it, upload it straight into the /wp-content/plugins/ folder and activate it as per usual.

To inspire you a little, here are a few things that came to mind:

  • Building in some session management to track the page/s the bot visiting and then include this information in the alert.
  • Evolving the session management to track the pages in a database and then visually represent the bots journey around your website.
  • Track the amount of time the bot is on your website.

Of course, most of the ideas that come to mind can be executed in Google Analytics, and with Analytics real-time engine it’s easier than ever, but I do imagine that there are uses and I will certainly be building on this plugin in the future.

Hope you enjoy it!

Comments

26/01/2012 12:07 pm
Sue

I’ve seen this in action – really useful!

Thanks, Guru Frog :-)

Reply
26/01/2012 12:14 pm
Guru Frog

It’s my pleasure, Sue, glad you like it!

Got any cool ideas that I could add to it?

26/01/2012 12:17 pm
George E. Frog

That’ll do, frog, that’ll do :)

Reply
26/01/2012 12:28 pm
Guru Frog

Thank you, George!

26/01/2012 1:39 pm
James M

Rocking! Glad to see someone jumped on the ideas as this is what I was hoping for. To turn it into a plugin in only one day is quote impressive as well. Got some talented peeps in your pond it seems!

Reply
26/01/2012 2:11 pm
Guru Frog

Hi James M,

Thank you for your continued support of eFrog Themes, all us froggies appreciate it! Did you try out the plugin yet on your website?

This was your idea initially, so please feel free to jot down some notes here as to what you were thinking long-term and let’s see if we can evolve this! Perhaps we’ll even put it into the eFrog Options as a standard feature :D

Leave a Comment

(required)

(required, not shown)

TimThumb not displaying images? Let’s fix that!

If you've noticed that a number of images aren't displaying correctly ... Read more

George has something new to show you

Hello tadpoles! We're as happy and excited as a dog with two tails, to tell you about the latest theme from the team around the pond. It's called Cohesion, and we like to think of it as "a socially-engaged business theme". Read more

Creating a useful 404 page – for both your visitors and yourself

Having a creative 404 page is always fun. Site developers end up spend... Read more

Adding a Tweet Box to your site

Both Windows and Mac are integrating social media platforms more and m... Read more

Valentines Giveaway: Win a copy of our new gorgeous theme – Occasions

Love is in the air, and lucky for you frogs aren't immune to Cupid's m... Read more

eFrog News Categories

Browse our themes