How to get information form link clicks?
-
13-09-2019 - |
Question
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?
Solution
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.
OTHER TIPS
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.
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>