I Use a hit counter but also visitor history, which tells me more about each visit: stored to MySQL(Table 'LOG'), so that I can report on it.
This is the php file "sniffer.php" which I put into an incude folder.
You'll have to put in your own connection and database selection.
PHP Code:
<!--Sniffer Script -->
<?php require_once ($_SERVER["DOCUMENT_ROOT"].'/Connections/freecrm.php'); ?>
<?php
//connection
//database selection
<?php
$userloggedin=$HTTP_SESSION_VARS['MM_Username'];//take username from session if you are using it.
$ip=$_SERVER['REMOTE_ADDR'];//get ip address
$when = time();//get time page was hit
$clientbrowser = getenv(HTTP_USER_AGENT);//get system and browser info
$referer = getenv(HTTP_REFERER);// get refering page i.e. where it came from
function getAddress()
{
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
$clienturl=getAddress();//call address function above to get URL visited
$clienthost=gethostbyaddr($_SERVER['REMOTE_ADDR']);//get hostname
$clientlanguage=$_SERVER["HTTP_ACCEPT_LANGUAGE"];// get language
?>
<!--end sniffer script -->
<!--Start of sniffer insert -->
<?php
mysql_query("
INSERT INTO LOG (IP, BROWSER, VISDATETIME, REFERAL, URL, LANGUAGE, HOST) VALUES('$ip', '$clientbrowser', '$when', '$referer', '$clienturl' ,'$clientlanguage', '$clienthost')
") or die(mysql_error()); //insert record into db
?>
<!--End of sniffer insert -->
When this is saved, just include this in every page you want to track. (I put it into a header include so its always on every page I put a header into.)
PHP Code:
<?php include("sniffer.php");?>
You can then have a report page to echo this data however you want. It also tracks bots.