WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Get an email when the Googlebot comes
  • Print
Pages: [1]   Go Down

Author Topic: Get an email when the Googlebot comes  (Read 11450 times)

Offline DGEC

  • Posts: 388
  • Gender: Male
    • EbelTech homepage
Get an email when the Googlebot comes
« on: November 30, 2007, 08:10:18 PM »
I found this code various places around the 'net, which emails you whenever the Googlebot is detected, has anyone else tried something like it?  I'm not sure if the mail statement will work or not.

(I thought I first read about it on here, but I can't find any references to it). I'm assuming it works now, an ELSE condition is detected.

Code: [Select]
if(eregi("googlebot",$_SERVER['HTTP_USER_AGENT'])) {
  mail("your.email@example.com", "Googlebot detected", "Google has crawled : ".$_SERVER['REQUEST_URI']);
}

I threw it in a CODE section to know when specific page is crawled (like home or news page). The original was wrapped in
 <?php  &  ?> so it would work in index.php of course.

If you try it, watch out your browser/editor doesn't "helpfully" convert the quotes to proper opening and closing quotation marks - it was driving me bonkers trying to figure out why I was getting an error!

Logged

Waldschwein

  • Guest
Re: Get an email when the Googlebot comes
« Reply #1 on: December 01, 2007, 11:30:13 AM »
Hello!

Well, I have to say - let's see at my awstats - that the Googlebot had only in november 8995 accesses on my page. And you have to say that Googlebot visits you very often, you can say 10-30 times a day. So I would be very, very carefully with this snippet. 
And btw: Why do you know that Googlebot visits you? Google is everywhere...

Regards Michael
 
Logged

Offline DGEC

  • Posts: 388
  • Gender: Male
    • EbelTech homepage
Re: Get an email when the Googlebot comes
« Reply #2 on: December 04, 2007, 08:21:48 PM »
You get that many hits per day from the bot?  :?  I only get it a few times a day at most, usually every few days.

Or are you confusing the BOT, with people coming to your site because they ran a search on Google?
Logged

Offline DGEC

  • Posts: 388
  • Gender: Male
    • EbelTech homepage
Re: Get an email when the Googlebot comes
« Reply #3 on: February 08, 2008, 08:07:00 PM »
By the way, you can set this up for other visitors as well.

For example, you can modify it to email you if other search engines hit your site, or if ANYBODY hits a special page without waiting to check your sever log statistics.

Take a look at http://www.useragentstring.com/pages/useragentstring.php if you're interested.
Logged

spida

  • Guest
Re: Get an email when the Googlebot comes
« Reply #4 on: April 07, 2008, 01:58:12 PM »
Haha, don't you get enough SMS per day yet?  8-)
This code is unnessesary, since your logfile tells you exactly how often which bot visited wich of your project's pages.

Regards,
spida
Logged

Offline DGEC

  • Posts: 388
  • Gender: Male
    • EbelTech homepage
Re: Get an email when the Googlebot comes
« Reply #5 on: April 10, 2008, 01:53:18 AM »
Of course... if the log files are available.  Not everyone is allowed access to the log files though, don't forget. 

Also some clients might just want to know when new site content is indexed and don't want to see all the other log enties, or they are not very technical, find the log files confusing or the programs like awstats confusing and ugly with poor layout (which it is).

And obviously user-agent detection as well as email creation are php techniques that have other uses.  For those learning PHP in bite-sized chunks, they might find it useful.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Get an email when the Googlebot comes
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2