Jump to content

counter, weed out bots


M.O.S. Studios

Recommended Posts

I have a counter that counts hits on my: home page, each product &  my check out.

 

after reviewing I realize that I have a of hits just on my homepage. it might just be because no want goes past that section OR because of web crawlers and bots. anyone know how to check for that???

 

here is my code if it helps.

 

<?php
SESSION_START();
if(!$_GET){$pages = 'index';}
    elseif($_GET['page']=='store' && isset($_GET['prod'])){$pages = $_GET['prod'];}
    elseif($_GET['page']=='checkout'){$pages = 'checkout';}

if(is_null($_SESSION['count'][$pages]) && is_null($_SESSION['testing']) && isset($pages)){	
include("admin/common/link.php");
	$query = "INSERT INTO `count` (`ip`, `page`, `date`) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".$pages."', '".mktime()."')";
	mysql_query($query);
	$_SESSION['count'][$pages]=1;
mysql_close($link);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/192719-counter-weed-out-bots/
Share on other sites

The first place to start is your access log. If it does not already, alter the conf file for your server to include the user-agent. If you are not able to alter the conf file or through your admin panel able to set your manner of logging then you will have to do it yourself. That is where to start to ID a bot, also make sure your site has a robots.txt file to guide bots for what folders to traverse. While you may not think you need one any well behaved bot will leave your site if they cant find a robots.txt file.

 

 

HTH

Teamatomic

Instead of keeping track of hits manually use Google Analytics instead it provides you with much more information and allows you to set-up funnels and goals

 

http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55580

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.