[ciapug] Logging outgoing traffic while being crawler friendly
Claus
ciapug@cialug.org
Thu, 29 May 2003 15:03:55 -0500
Hello
I have a php redirect page that I use to redirect outgoing links
through. That way I can keep track of what links people use from my
site. Things work great with the exception that search engines / crawlers
don't account these links. So for instance the link to
/go.php?http://www.ames.ia.us will never get put into the "Find web pages
that link to www.ames.ia.us" list of google. That's because it doesn't
appear as a link.
Is there another way that could do both, track outgoing links and be
crawler friendly?
Thanks,
Claus
----Link----
<A HREF="/go.php?http://www.ames.ia.us"
onMouseOver="window.status='http://www.ames.ia.us'; return true"
onMouseOut="window.status=''; return true">
Ames City Government</A>
----Redirection/Logging Page----
<?php
$link = getenv('QUERY_STRING');
if ($REMOTE_ADDR != 'insert my ip here' &&
$REMOTE_ADDR != 'insert my other ip here') {
require_once('DB.php');
$db = DB::connect('pgsql://www@unix+localhost/database');
if (DB::isError($db)) {die ($db->getMessage());}
$result = $db->query("insert into web_stats_links_visited (timestamp,
server
_name, remote_ip, remote_name, url) values (current_timestamp,
'$SERVER_NAME', '
$REMOTE_ADDR', ' ', '$link')");
if (DB::isError($result)) {die ($result->getMessage());}
$db->disconnect();
}
header("Location: " . $link);
exit;
?>