This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes calling web site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "calling web site" Watch "calling web site" New topic
Author

calling web site

Paul Richards
Greenhorn

Joined: Jul 25, 2001
Posts: 19
Folks
Here is my problem. I need to determine which web site called ours.
For example if the user did a search in yahoo.com and this provided a link to our website, how could I determine that the previous site was www.yahoo.com?
I need to do this for marketing reasons!!! They want to know who is coming to our site via which search engine.
cheers Paul
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
Have a look at the "HTTP_REFERER" field in the HTTP headers via getHeader(String name) in the request object.
<%=req.getHeader("Referer")%>
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
HTTPRequest headers has the Referer header that you can check.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Paul Richards
Greenhorn

Joined: Jul 25, 2001
Posts: 19
thanks for the replies
I have tried using your suggestion and using the following code
<%String url = new String();
url = request.getHeader("Referer");
System.out.println(url);%>
I actually got this
http://209.185.240.250/cgi-bin/linkrd?_lang=EN&lah=13ee0e019bbebffce9957610d0f949ac&lat=1017859774&hm___action=http%3a%2f%2fwww%2econfused%2ecom%2fpages%2findex%2ejsp%3fMediaCode%3 d122
as the url
This is not what I was quite expecting, have I done something wrong?
thanks in advance Paul
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling web site
 
Similar Threads
Search Functionality in Web Site
need co-runner for new java web site
java-Factory Method
JSP Web Site
What is Meta Search Engine?