Receive an Email Every time the Googlebot comes to your site!

igotdreams 0 Tallied Votes 158 Views Share

Would you like to know when the Google spider or any other spider comes by your site? Well now you can with this handy snippet. It will send you an email for everypage it visits.

<cfif CGI.Http_User_Agent CONTAINS "googlebot">
    <cfmail from="info@yoursite.com" to="you@yoursite.com" subject="The Googlebot came to call" server="smtp.mailserver.com">
        Google has visited #CGI.Script_Name#
    </cfmail>
</cfif>

Put this in your application.cfm file in the root of your site. Then every page it visits you get an email, be sure to change the following code to yours;

info@yoursite.com = your email
you@yoursite.com = your email
smtp.mailserver.com = your mail server ex. mail.yourdomain.com

You can even change the script to alert you to other visits by other spiders, all you need is a list of other bots!

Try this list;

http://www.robotstxt.org/wc/active/html/
jsmall26 0 Light Poster

I dont know that i'd put it in the application file. Maybe the index.cfm page, but the application.cfm will be called for every page in that directory and if its in the root of your website, you'll get a TON of emails. That's just my 2 cents though. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.