Forum Moderators: coopster

Message Too Old, No Replies

Creating a link out script

that count the number of times a link is clicked on

         

le_gber

9:21 am on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do you do it?

Do you hold everything in a db/table or a flat file? are there any security issues I should be aware of? will the spiders follow the link and increase the 'count'?

eelixduppy

11:16 am on Jun 15, 2006 (gmt 0)



I'm not sure if you own the page the link links to, but if you do, you can set up a traditional counter on that page that counts how many people visit it.

le_gber

11:47 am on Jun 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the type I was thinking of the the one you find in directories etc... to count the visits from my site to the company listed.

phprockz

12:38 pm on Jun 17, 2006 (gmt 0)

10+ Year Member



I use php click counter its good

jatar_k

5:38 pm on Jun 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you just have all of your links go through a counting script, then either append the url to it or use an id if you like

click the link with the id attached
script looks up who that id goes to
ups the counter and adds whatever info you want to track
send the user off to the url

le_gber

7:57 am on Jun 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thank's guys - one more question would you lock the table to guarantee all clicks are counted?

jatar_k

5:20 pm on Jun 19, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't think I would but if you did you would have to figure out what to do if the script hit the lock

It should be fast enough, though at very high traffic you may be better off using a file or you could even use syslog if you have access to it. Then it would be fire and forget. Though you would have to write a parser to transfer the syslog to something more usable for stats.