DaniWeb IT Discussion Community

Code Snippets (http://www.daniweb.com/code/)
-   coldfusion (http://www.daniweb.com/code/coldfusion.html)
-   -   Receive an Email Every time the Googlebot comes to your site! (http://www.daniweb.com/code/snippet137.html)

igotdreams coldfusion syntax
Jan 1st, 2005
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.

  1. <cfif CGI.Http_User_Agent CONTAINS "googlebot">
  2. <cfmail from="info@yoursite.com" to="you@yoursite.com" subject="The Googlebot came to call" server="smtp.mailserver.com">
  3. Google has visited #CGI.Script_Name#
  4. </cfmail>
  5. </cfif>
  6.  
  7. 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;
  8.  
  9. info@yoursite.com = your email
  10. you@yoursite.com = your email
  11. smtp.mailserver.com = your mail server ex. mail.yourdomain.com
  12.  
  13. You can even change the script to alert you to other visits by other spiders, all you need is a list of other bots!
  14.  
  15. Try this list;
  16.  
  17. http://www.robotstxt.org/wc/active/html/