track hyperlink clicks on php website

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
potato_chip
Forum Newbie
Posts: 20
Joined: Mon Oct 06, 2008 10:38 am

track hyperlink clicks on php website

Post by potato_chip »

I'm designing a php website which is only accessible to members. Once member logs in, there are two hyperlinks on a particular web page. I would to track how many times the hyperlinks are clicked by which member. Could someone advise me how to achieve this?

I did some research online, they are all about counting hyperlink clicks on the whole website, no matter who made the clicks. What I really want is to track the numbers by different members.

I'm really stuck here and your help is greatly appreciated!
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: track hyperlink clicks on php website

Post by jaoudestudios »

If they are logged in then you know their user.id.

Have a table like...
id | user_id | link_id | created_on

Then on each link put an id, which if you want to contain more details have a link lookup table...
id | title | description | created_on

At the top of every page grab the link_id in the URL and record the user and link :)
Post Reply