Forum Moderators: open

Message Too Old, No Replies

counting clicks

redirects & real links

         

mfagan

4:00 am on Oct 13, 2002 (gmt 0)

10+ Year Member



To count how many times an outgoing link is clicked on, I can use a redirect such as
<a href="http://www.mysite.com/r?url=www.othersite.net">www.othersite.net</a>
but then othersite.net doesn't get a "real" link that spiders would find.

What do you think about using a real link and an onClick to override it?
<a href="http://www.othersite.net" onClick="location.href='http://www.mysite.com/r?url=www.othersite.net'">www.othersite.net</a>

keyplyr

6:47 am on Oct 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Don't know the answer, just sending it back to the top.

dingman

7:11 am on Oct 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I were a site being linked, I'd certainly appreciate that as a way to both allow you to track the clicks when the user had js enabled (ie, most of the time) while still letting me get the SE hits and hits from people who have js turned off. I'd also, as a user, appreciate that you had left the links in a state useable by my browser if I visit you with js turned of or using a browser that doesn't support javascript.

If you want to shave the size of the code a bit, perhaps you could do something like <a href="outside-url" class="external"> along with a document.onload() that would re-set the onclick hanler for each "external" link. Saves you writing out all those tracking URIs in each link. I think I could code that up in a few minutes...

mfagan

2:45 pm on Oct 14, 2002 (gmt 0)

10+ Year Member



The way that I was thinking would have the links in a database, and a loop would write the code, so I wouldn't have to type it repeatedly.

Thanks for the comments, I know I'd want "real" links to my website :)