File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Track clicking of URL links Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Track clicking of URL links" Watch "Track clicking of URL links" New topic
Author

Track clicking of URL links

Mike Li
Greenhorn

Joined: Sep 16, 2002
Posts: 5
Hi,
My servlet creates a page with a list of URL links to different web sites. I like to record the date and time when user clicks on any link. Any idea how should i do this?
Thanks!
Mike.
Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
You could have the links posted back to a servlet on your site, where you record the date, time, and link hit, and then you use a RequestDispatcher to forward to the other site.
So when you reference google- your href is back to a servlet on your site that records the info, then forwards them to the new site.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
Without some sort of intervention, you will never know when a user clicks a link.
In order to track the click throughs, you will have to use JavaScript to send the new location to a servlet on your system, you can count it and then do a redirect to the correct URL. The cool thing to do would be to use a code in the Javascript link so the user could not look at the source and discover the real URL.
What an interesting idea .... I could use that.
Bill
(Come to think of it Javascript is not needed - I must be doing too much Javascript these days.)
[ October 24, 2002: Message edited by: William Brogden ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Track clicking of URL links