How to get an email whenever Google visits your site

Do you want to be emailed whenever Google’s spider (GoogleBot) visits your site or your page(s)? If yes, here is an easy way to do it.

I was reading the article - Ever wanted to know when google crawls your site via Digg. The article explains how you to send an email via a PHP Script when Google’s spider (GoogleBot) visits your site. So, why not automate that for each and every page that is PHP powered.

To include the script on every page of your site, let us follow the following steps;

1. Modify your .htaccess file (create if you do not have one) to use the auto_prepend_file feature, it should have this line
php_value auto_prepend_file /home/yourdomain.com/www/html/autoappend.php
(a single line full absolute path to the autoappend.php on your server)
2. Create/Modify your autoappend.php (you are free to change the file name accordingly here and in the .htaccess file) to include the PHP script from swik.net (I’ve modified it slightly to have a clickable url when you get the mail);

<?php //let us notify someone when google crawls this page if ( strpos( $_SERVER['HTTP_USER_AGENT'], ‘Googlebot’ ) !== false ) { // The email address we want to send the email to $email_address = ‘mymail@domain.com’; // Send the email mail($email_address,’Googlebot Visit’, ‘Googlebot has visited your page: http://’.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); } ?>

But, my files extension is not PHP even though my server support PHP, how do I use this?

Well, you can use the same .htaccess to enable PHP for any file extension, you have to add this line

AddType application/x-httpd-php .html .htm

This will parse all files with the extension html and htm as PHP scripts.

References

Update

  1. 2006 June 5 (10:00 am) - Be careful to set a filter for your email for this one. Now, I’m bombarded with “Googlebot Visit” mails!
  2. 2006 June 5 (02:00 pm) - This is perhaps a bad idea for a high traffic website. So, far I have received over 500 emails in just about 5 hours. I’m turning mine off.


Don't like it? There are lots of published articles, pick a random one.

oCricket

Brajeshwar posted this article on Tue, Jul 4th, 2006 at 6:00 pm
Categorized under Technology and has the following tags

Prev Article: Movable Type 3.3

Next Article: Fabrik opens limited beta account


Possibly Related Articles

Archives: Visit the Archives for more articles.

Comments Post Yours

There are one response so far. You can follow any responses to this entry through the RSS feed. You can skip to the end and leave a response. Pinging is currently not allowed.

  1. One thing to watch with this though is that lot’s of spammers, particularly Comment spammers set ‘Googlebot’ to be the user agent so you’ll get a lot of false positives from this I would have thought.

Post yours

Sidenotes

Quick notes, scribbles, somehow related to this website and to what I do. Or perhaps I'm just plain lazy to make them into a full article.

What a bad team can do to a Startup?

Flash/Flex developer, Orian Marx, started his Startup with much zeal and enthusiasm but had to give-in to failures because of none other but the team - the founders involved. His article outlined the story so ...13th Oct, 2008

Introduction to Adobe AIR (NetTuts)

Nettuts have a nice Introduction to Adobe AIR which focus on using HTML/JS to build an AIR Application. It covers -- Adobe AIR Architecture, How to install AIR, Get the development SDK, Configurations, gets on to ...2nd Oct, 2008

Decide Team Type from Books

What do you think of the "Team-Type" if they got these books recently? What "Team-Type" do these books suggest? ( surveys) 29th Sep, 2008

What do investors look for in a startup?

A great video Interview with Venture Hacker Naval Ravikant answering the age-old question: What do you look for in a startup? Investors look for two things that are paramount above all: # Great team: It's obvious. It's a ...27th Sep, 2008

You don't mess with the 'Englineer Bother'

(Via: Hiring Horror) 24th Sep, 2008

View the Sidenotes Archive

Play the Penguin Game

Recommended

  • Ode to Apple Dedicated to Apple - Mac, iPhone, iPod, iTunes, Quicktime, Apple TV and all the awesome softwares for the Apple Mac.
  • oCricket oCricket is about Cricket and people enthusiastic about it.
  • ActionScript 3.0 Reference Flash/Flex ActionScript 3.0 Reference.
  • AS 2.0 Reference Reference for ActionScript 2.0 Programming Language used in Flash. Primarily stashed here for my own personal reference.
  • Not Safe for Work Ever clicked a link and felt embarrassed with the content in front of your co-workers? Ever caught unaware because the funny link your friend sent was a little beyond funny? Let’s minimize that with NSWF.
  • Forum Oinam’s technical discussion forum where developers and designers can discuss all technical topics.
  • Downloads All downloads, Free and Open Source.

Download free Brajeshwar Wordpress Theme

Brajeshwar

Brajeshwar I firmly believe in keeping things simple, easy for users and I envison pushing the technical envelop time and again for the betterment of viable commercial and practical applications. More about me.

Brajeshwar Personal Identity Portal powered by VeriSign Labs

Brajeshwar's affinity with Adobe

My Photos

More photos on Flickr

Member of 9rules Network

Since its inception on 11th June, 2001, "Brajeshwar" has 864 Articles and 6,009 comments, contained within 20 categories and 1,233 tags.