Dynadot โ€” .com Registration $8.99

Tracking referral hits

Spaceship Spaceship
Watch
Impact
11
Hi,
I'm trying to set up some sort of referral link on my site.

For example, each user is given his own referal code that looks like:
http://www.site.com/index.php?my_referral_code

That will take clickers to http://www.site.com,
and I can track where the clickers come from
by looking at my _referal_code..

Do you know of any script (not awstats) that does this and
tracks referral hits?
Thanks.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
I just wrote a little snippet to do this a few days ago... the "3600 * 4" part adjusts times to be displayed in my time zone, so tweak that as you like.

Stick this in a PHP file and point to it instead of your referal link, it will log their IP & hostname, time and date, and then redirect them to your referral link.


PHP:
<?php

// get address
$ip = getenv('REMOTE_ADDR');

$Track = sprintf("%s: %s - %s\n",strftime("%m/%d/%y %H:%M",time() + 3600 * 4),$ip,
gethostbyaddr($ip));

$fp = fopen("refer.log","a");
fwrite($fp,$Track);
fclose($fp);

$URL = "http://www.referalsite.com/id=123";

header ('HTTP/1.1 301 Moved Permanently');
header ('Location: ' . $URL);
?>
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back