Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count clicks on links

Status
Not open for further replies.

TKaeser

Technical User
Mar 4, 2002
16
CH
Hello,

I want to make a ranking of the links in a link database: which links are used the most.

eg: Every time the link is clicked, its clickcounter is increased by one and stored in the db.

I think you could do it trough a form, with different buttons for every link, but i want to keep the links like they are (underlined text).

Any good ideas on this?

Thanks!
Thomas
 
you could just use some server logging to do this, or write a php-redirect script that stores the redirect url to the db.

example: change each link to have a redirect.php?url= before the existing link, then in redirect.php, log the $url to the db (increment the 'click count' field for that url), then do a header("Location: $url"); and neither the user nor your current site design will be affected.

good luck! -gerrygerry
Go To
 
Thank you gerrygerry!
Works like a charm!

Thomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top