|
Posted by Colin Fine on 10/09/06 23:58
Robertcode wrote:
> Hey all, I'm trying to create a custom stats script for my site, I'm
> new to php and I'm just wondering is there a way to tell what link
> someone clicked to leave my site?
>
> So if I've got links to section a, section b, section c, google, yahoo,
> msn and someone clicks on google I can record that.
>
> Thanks for your time.
>
If they are straight links (<a href = 'http://..'>text</a>) there is
absolutely nothing you can do, because any program of yours has finished
before the user ever sees the page containing the link.
However, if you change the links to make them go to a script of yours,
that script can do anything you like.
eg
<a href = 'myscript.php?dest=http%2C%2E%2Ewww.google.com'>google</a>
Then you can make your script myscript.php do something like
<?php
$destination = $_GET['dest'];
# Record the jump to $destination in your database or whatever
header('Location: $destination);
?>
I haven't checked the details of what I've written (and I made up the
ASCII values %2E etc in the URL above) but this is roughly right.
Colin
Navigation:
[Reply to this message]
|