StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > Webmaster > Lounge (non-StatCounter related topics here!)

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 06-11-2006, 01:13 AM
fuzzy fuzzy is offline
Senior Member
 
Join Date: May 2005
Location: Milwaukee, WI
Posts: 1,145
Default AOL detector code

Hey Christina,

Some time ago you mentioned that you have a separate SC project for AOL users, which are counted differently from other users via a javascript. Care to share it? (again?)
  #2  
Old 06-11-2006, 01:23 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,176
Default

For that you need php and for your pages to be parsed as php.

I keep the regular code in one file named, say, counter-non-aol.html.
I have the code I use for AOL visitors in a nother file called counter-non-aol.html .

My web page itself is suiffixed as php (or html and parsed as php).

At the spot in the source code of my web page where I want to insert Statcounter code I have something like this:

Quote:

<?php

$ipaddress = $_SERVER['REMOTE_ADDR'];
$hostname = gethostbyaddr($ipaddress);
if ($hostname === '')
{ $hostname = $ipaddress ;}
$findme = 'aol';
$posfound = strpos($hostname, $findme);

if ($posfound === false) {
// the counter for non-aol users
include("counter-non-aol.html");

}
else {
// the counter for AOL users
include("counter-aol.html");
}

?>
I could optionally decide to not even bother tracking AOL users:

Quote:

<?php

$ipaddress = $_SERVER['REMOTE_ADDR'];
$hostname = gethostbyaddr($ipaddress);
if ($hostname === '')
{ $hostname = $ipaddress ;}
$findme = 'aol';
$posfound = strpos($hostname, $findme);

if ($posfound === false) {
// the counter for non-aol users
include("counter-non-aol.html");

}
// no else - it's a waste of time tracking aol users.
?>
You can bundle that code in a file called, say, counter.php use just this in your web page:

<?php include("counter.php"); ?>

If your web page is already suffixed as .shtml you don't have to have it parsed as php and you can use this instead:

<!--#include virtual="counter.php"-->
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.

Last edited by webado; 06-11-2006 at 01:26 AM.
  #3  
Old 06-11-2006, 04:09 AM
fuzzy fuzzy is offline
Senior Member
 
Join Date: May 2005
Location: Milwaukee, WI
Posts: 1,145
Default

Thanks Christina. As I'm not quite ready to jump into php, I guess that will have to wait. Might play with it in the 3um though... someday!
  #4  
Old 04-16-2008, 06:24 PM
fuzzy fuzzy is offline
Senior Member
 
Join Date: May 2005
Location: Milwaukee, WI
Posts: 1,145
Default

Old OLD topic -- but I finally decided to use it. Thanks again, Christina!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:59 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.