woocha Posted January 5, 2008 Share Posted January 5, 2008 Hey guys. I had a guys write this code for me a while back before I started to learn PHP. The script is a stats tracker. But, it must have some problems. To see if it was working, I started using Google Analytics as well. The Google stats tracker says I get 100 visits a day and the home brew version says I have 1000. I am tending to believe the Google stats gizmo, but I want to fix the original one that was made for me. SO here is my question: Is it possible to determine that it is Google's or Yahoo's Spider checking out my site. I'm thinking something like if(Google or Yahoo){don't count}; Is there anyway to do this? Thanks fellas and Happy New Year !! Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/ Share on other sites More sharing options...
kratsg Posted January 5, 2008 Share Posted January 5, 2008 If anything, it sounds like the homebrew doesn't track unique visitors, but a simple visit. Are you tracking visitors by IP or just logging whenever a page is visited? The Google/Yahoo works by unique visits. Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-431340 Share on other sites More sharing options...
woocha Posted January 5, 2008 Author Share Posted January 5, 2008 I think you're right...I thinks its tracking hits not visits. And your advise is to seqregate the visitors by ip...if this ip matches google IP, then do NOT count....does that sound right? Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-431357 Share on other sites More sharing options...
woocha Posted January 5, 2008 Author Share Posted January 5, 2008 OK...here's a question. Is it possible to track how many times Google or MSN or Yahoo or Alta Vista spiders my site? I think this could also be useful information. Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-431431 Share on other sites More sharing options...
cooldude832 Posted January 5, 2008 Share Posted January 5, 2008 just record all the IPS of users in then if its yahoos or googles (They are static) you can add to your count Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-431434 Share on other sites More sharing options...
woocha Posted January 6, 2008 Author Share Posted January 6, 2008 just record all the IPS of users in then if its yahoos or googles (They are static) you can add to your count I am affraid that might be a bit over my head. Could you point in the right direction on how to do that? I am more than willing to work on it and learn about. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-431857 Share on other sites More sharing options...
woocha Posted January 7, 2008 Author Share Posted January 7, 2008 BUMP !! Anyone know how to count everytime Yahoo, AOL, Google, MSN visit my site? Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-432639 Share on other sites More sharing options...
chronister Posted January 7, 2008 Share Posted January 7, 2008 http://www.iplists.com/ Here is a listing with all the spiderbots and mediabots for the various sources. There are a LOT of them. Looks like you would want to keep them each in a text file and then use a bit of code like so to see if the remote ip is in this list. <?php $visitors_ip=$_SERVER['REMOTE_ADDR']; // our guests IP $botfiles=array('googlebots.txt','yahoobots.txt'); //array of bot files foreach($botfiles as $file) { $botfile=file($file); //bot file foreach($botfile as $v) { $bots[]=trim($v); } } if(in_array($visitors_ip,$bots)) { // this is a google bot do what you want here echo 'bot'; } else { // this is not a google bot echo 'not a bot'; } ?> Grab all the bot files you want to compare to and add them to the array above. The script loops through and makes 1 big ass array with all the bot ips in there. Hope this helps, nate Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-432818 Share on other sites More sharing options...
woocha Posted January 8, 2008 Author Share Posted January 8, 2008 Nate... You answer was exactly what I was looking for. Awesome. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-433141 Share on other sites More sharing options...
chronister Posted January 8, 2008 Share Posted January 8, 2008 Remember to mark as solved. Quote Link to comment https://forums.phpfreaks.com/topic/84642-solved-determine-if-its-google-or-yahoo-spidering-my-site-or-is-it-actually-visitors/#findComment-433362 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.