counting clickthroughs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sametch
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 4:53 am

counting clickthroughs

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

nope.. you require a redirection page in order to register the click.
sametch
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 4:53 am

Post by sametch »

Thanks feyd, I feared this would probably be the case :(
The Monkey
Forum Contributor
Posts: 168
Joined: Tue Mar 09, 2004 9:05 am
Location: Arkansas, USA

Post 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.
sametch
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 4:53 am

Post by sametch »

Thanks for that. I will give it a try! :wink:
Post Reply