Connecting Tech Pros Worldwide Help | Site Map

How can I tell if a visitor is a search engine bot?

Mark
Guest
 
Posts: n/a
#1: Nov 19 '05
Hi, I am writing some code to log vistors to my website.

I notice in some statistics pacakages that they are able to differentiate
between normal visitors and search bots. Does anyone know how that is done?

I thought that they might be looking at the IP address of the remote visitor
and then if the IP range is associated with Google or whatever than that
"person" is a bot...

Any ideas welcome
thanks
Mark


Scott Allen
Guest
 
Posts: n/a
#2: Nov 19 '05

re: How can I tell if a visitor is a search engine bot?


You'll want to look at the Agent header coming in with the request.

Here are some reference sources:
http://www.google.com/search?hl=en&q...+agent+strings

HTH!

--
Scott
http://www.OdeToCode.com/blogs/scott/
[color=blue]
> Hi, I am writing some code to log vistors to my website.
>
> I notice in some statistics pacakages that they are able to
> differentiate between normal visitors and search bots. Does anyone
> know how that is done?
>
> I thought that they might be looking at the IP address of the remote
> visitor and then if the IP range is associated with Google or whatever
> than that "person" is a bot...
>
> Any ideas welcome
> thanks
> Mark[/color]


jongalloway
Guest
 
Posts: n/a
#3: Nov 19 '05

re: How can I tell if a visitor is a search engine bot?


You can check the Request.UserAgent property. Each major search bot
uses a different user agent, so you'd need to check against a list. The
biggest ones are googlebot, msnbot, and slurp (Yahoo).

Here's a partial list:
http://webmaster-resources.web-maste...ification.html

If you just want to prevent search engines from spidering all or
portions of your site, you can do this with a robots.txt file at the
root of your site:
http://www.searchengineworld.com/rob...s_tutorial.htm

Keep in mind that it is possible for users can change their user agent
(for instance via the Firefox User Agent Switcher extension), so if you
have pages of your site that you want to allow only subscribers or
search engines, you'd need to check against an IP whitelist to keep
people out.

- Jon
http://weblogs.asp.net/jgalloway

Mark
Guest
 
Posts: n/a
#4: Nov 19 '05

re: How can I tell if a visitor is a search engine bot?


Hi, thanks for your help
Regards
Mark

"Mark" <mark@Z-Zvolution.nZt> wrote in message
news:%23uQJpUe%23EHA.2568@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi, I am writing some code to log vistors to my website.
>
> I notice in some statistics pacakages that they are able to differentiate
> between normal visitors and search bots. Does anyone know how that is[/color]
done?[color=blue]
>
> I thought that they might be looking at the IP address of the remote[/color]
visitor[color=blue]
> and then if the IP range is associated with Google or whatever than that
> "person" is a bot...
>
> Any ideas welcome
> thanks
> Mark
>
>[/color]


bruce barker
Guest
 
Posts: n/a
#5: Nov 19 '05

re: How can I tell if a visitor is a search engine bot?


note: following these bot rules is strictly up to the bot. the major engines
are polite and do, but not all.

-- bruce (sqlwork.com)

"jongalloway" <jongalloway@gmail.com> wrote in message
news:1105673171.351214.135360@f14g2000cwb.googlegr oups.com...
| You can check the Request.UserAgent property. Each major search bot
| uses a different user agent, so you'd need to check against a list. The
| biggest ones are googlebot, msnbot, and slurp (Yahoo).
|
| Here's a partial list:
| http://webmaster-resources.web-maste...ification.html
|
| If you just want to prevent search engines from spidering all or
| portions of your site, you can do this with a robots.txt file at the
| root of your site:
| http://www.searchengineworld.com/rob...s_tutorial.htm
|
| Keep in mind that it is possible for users can change their user agent
| (for instance via the Firefox User Agent Switcher extension), so if you
| have pages of your site that you want to allow only subscribers or
| search engines, you'd need to check against an IP whitelist to keep
| people out.
|
| - Jon
| http://weblogs.asp.net/jgalloway
|


Closed Thread


Similar ASP.NET bytes