views:

29

answers:

3

I am wondering how it is possible to get information from link clicks.

For example, a user is logged in and clicks a link. Is it possible to record that information? Number of links clicked, which ones, etc... things like that.

I have no idea how to do this. Any ideas / links to information?

+1  A: 

You could use JavaScript to bind an event to your links and have the logging done that way. See this question.

You also might try looking at setting up Google Analytics on your site; it's a free service that offers incredible amounts of data collecting for your site. Here's a blog post that details tracking clicks with Google Analytics.

Donut
Thanks. I know about Google Analytics, but I want to generate the information myself.
GreenRails
A: 

One way to do that is by passing the user through a redirect link of your own. So the links go to http://yourserver.com/redir.aspx?realink=<url encoded link>

Matt Wrock
+1  A: 

You have several options:

  • read the statistics from logs on the web server
  • use redirects through different URL
  • use your own JavaScript code executed in onclick attribute

Update: there is ping attribute for a element. Web browser will then send a notification to the specified link. In HTML5 though.

Viliam