• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tracking links in a db

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a website with multiple pages. I want to track when a user clicks on any link from my site. The thing that came to mid initially was a onClick property that when onClick, the javascript function would be called to write to the db. This wont work. What are my other options.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean that you have links to other sites and you want to track when someone "clicks out", the common approach is to embed the actual destination in a server request. Like this:
< a href="http://www.mysite.com/tracklink.jsp?dest=www.elsewhere.com" >Bye now!< / a >
Then the tracklink.jsp can capture and log the destination and redirect the request.
Fair warning, though - I'm notorious for using the "open in a new window feature" myself, so I may not have completely left your site!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic