Page 1 of 1

counting clickthroughs

Posted: Thu Feb 17, 2005 11:24 am
by sametch
I am creating a directory of websites.

When someone clicks one of the links and leaves my site I would like to be able to record which hyperlink they clicked and when.

The only way I can think of doing it is to have a "hidden" page between the hyperlink on my site and the final destination.

If a user clicks a link it goes first to a hideen page which processes the event, sends the details to a MySQL database and then redirects to the final destination using a meta refresh tag.

Is there any other (neater) approach I could take?

Posted: Thu Feb 17, 2005 11:29 am
by feyd
nope.. you require a redirection page in order to register the click.

Posted: Thu Feb 17, 2005 11:38 am
by sametch
Thanks feyd, I feared this would probably be the case :(

Posted: Thu Feb 17, 2005 12:07 pm
by The Monkey
instead of a meta refresh tag, header("Location: $link"); would make it appear more seamless for your users.

Code: Select all

header("Location: http://www.example.com");
The url can also be a $variable.

Posted: Thu Feb 17, 2005 12:33 pm
by sametch
Thanks for that. I will give it a try! :wink: