Regular Spelling
Thoughts on language and more

Unbalanced Load

I started using Google Analytics a while back to track visit information for this site, because my server logs and AdSense report very different things. And Analytics doesn't report anywhere close to the amount of traffic, either. Where Analyitics may say I only get 15 page views in a day, AWStats will show I've at least 100. It's never made sense, so I decided to make a little tracker of my own. A simple PHP script I added to the end of all my templates for a couple days, to just record a few peices of information. And when I checked them, I found a lot of those 100 hits were various search engine bots, some more were spambots that are filtered, leaving relatively few of them actual people.

Since I'm all about the sharing of code snippets, here's the code for the script. It's removed now.

$namefile = "../../log.asw";
$fn = fopen($namefile, 'a');
$ip = getenv('REMOTE_ADDR');
$name = substr($_SERVER["SCRIPT_NAME"],
strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
$curdate = date("m\-d\-Y");
$fullname = $ip . ">" . $curdate . ">" . $name . "\r\n";
fwrite($fn, $fullname);
fclose($fn);
?>

Date posted: 08 October, 2009
Tags: programming regularspelling website_design
« The Green House | Power Ballad »