ClickTale Support Forums

All times are UTC - 6 hours



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed Aug 27, 2008 8:08 am 
Offline

Joined: Tue Mar 18, 2008 1:50 pm
Posts: 31
Please note: This is the old version of the code. A newer one can be found here.

If your site uses cookie-based sessions, you may have noticed that ClickTale is unaware of any session-based stuff that's happening. So this is a little snippet for overriding the URL that ClickTale fetches from so it is sure to include the current session id.

This snippet will show you how to customize your script to do that.

First we create the "sessioned" URL for the currently displaying page
Code:
<%
String ClickTaleFetchFromURL;
String ClickTaleFetchFrom = "";
javax.servlet.http.HttpSession s = pageContext.getSession();
if(s != null) {
  ClickTaleFetchFromURL = request.getRequestURL()+";jsessionid="+s.getId();
  if(request.getQueryString() != "") {
    ClickTaleFetchFromURL += "?" + request.getQueryString();
  }
  ClickTaleFetchFrom = "ClickTaleFetchFrom=\""+ClickTaleFetchFromURL+"\";";
}
%>

Then, if you bottom ClickTale script looks like this
Code:
if(typeof ClickTale=='function')
   ClickTale([!YOUR PROJECT ID!],[!YOUR RATIO!]);

Change it to this:
Code:
if(typeof ClickTale=='function') {
   <%=ClickTaleFetchFrom%>
   ClickTale([!YOUR PROJECT ID!],[!YOUR RATIO!]);
}


Hope this will be of any help to all of those JSPers out there,
Tal Shani,
ClickTale Team


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Wed Aug 27, 2008 8:54 am 
Offline

Joined: Thu Jun 26, 2008 8:38 am
Posts: 7
We're hesitant to include the session ID in the URL. What's the actual problem with Clicktale and session ids? Is there another way around the issue?


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Thu Aug 28, 2008 9:36 am 
Offline
Site Admin

Joined: Fri Jul 21, 2006 2:39 pm
Posts: 1206
Location: Israel
Andrew,

Passing the session ID to ClickTale will enable us to simulate a visitor request more accurately, this will result in correct caching of the visitor's cart state and other data/pages.

You will get a second hit from us for those pages, so be careful with GET pages that have side effects (with correct design you shouldn't have those).

I understand why you are hesitant, but since your session ID is already passed in the cookie and available to client side code, there is no decrease in security. I am assuming you trust us with your data, otherwise you wouldn't be using our services.
Please also consider that sessions timeout after some time (not sure how this is set for JSP).

Let me know if you are aware of other attack vectors or vulnerabilities.

There is no other easy solution. It depends on how much you want to invest in the implementation and changes on your side.

Arik.


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Wed Nov 26, 2008 8:54 am 
Offline

Joined: Wed Nov 26, 2008 8:21 am
Posts: 1
I was trying to integrate the code snippet above, however it produces a javascript error.

I modified it to this:

<%
String ClickTaleFetchFromURL;
String ClickTaleFetchFrom = "";
javax.servlet.http.HttpSession s = pageContext.getSession();
if(s != null) {
ClickTaleFetchFromURL = "\""+request.getRequestURL()+"?jsessionid="+s.getId();
if(request.getQueryString() != "") {
ClickTaleFetchFromURL += "&" + request.getQueryString()+"\";";
}
ClickTaleFetchFrom = "ClickTaleFetchFrom="+ClickTaleFetchFromURL;
}
%>

However I'm not sure this is what was intended. It produces a string such as:

ClickTaleFetchFrom="https://www.domain.com/page.jsp?jsessionid=36B3E1707C8E2810CB7573B69D3F54E0&null"

The problem is, this doesn't seem to work on our site - it still won't render any recordings. This may be an issue on our side which I'm going to work with our java developer on (I don't speak jsp)

The original code would separate the jsessionid as a js variable (';jsessionid' in the snippet above). Not sure if this was intended, but it didn't work this way.
Also, the original doesn't wrap the string variable in quotes.


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Wed Nov 26, 2008 9:33 am 
Offline
Site Admin

Joined: Fri Jul 21, 2006 2:39 pm
Posts: 1206
Location: Israel
Hey,

"jsessionid" should be appended with ; to the script name. JSP needs it there and not as part of the query string. This is by design. It allows you to keep the session id while going through some difficult cases such as POSTs, etc.

You are right about the quotes. Will fix in the original code.

Can't say why it doesn't work for you. Can you post your url? or send it to us in a private message?

Regards,
Arik.


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Wed Sep 30, 2009 11:34 am 
Offline

Joined: Wed Sep 30, 2009 11:25 am
Posts: 1
I've been unable to get JSP integration working fluidly.

Initially, straight JavaScript integration produced some recordings, with a high recording-error rate. (Page content of the recording was not retrieved successfully.)

Injecting the JSP code from above has allowed recordings to occur, but they are useless - on playback, all pages display as the site's 404, but the clicks and text entry from form fields still come through -- clearly the wrong page. It's as if ClickTale is somehow fetching and caching the wrong pages for playback.

Does anyone have experience with these types of issues?

Support has not responded (I am Bronze).

Please see attachment for current issue.


Attachments:
Screen shot 2009-09-30 at 1.34.12 PM.png
Screen shot 2009-09-30 at 1.34.12 PM.png [ 84.63 KiB | Viewed 11410 times ]
Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Wed Sep 30, 2009 12:19 pm 
Offline
Site Admin

Joined: Fri Jul 21, 2006 2:39 pm
Posts: 1206
Location: Israel
Hey,

Can you post the URL for your site so we will take a look?

Arik.


Top
 Profile  
 
 Post subject: Re: JSP integration code
PostPosted: Thu Oct 01, 2009 2:58 am 
Offline

Joined: Wed Mar 25, 2009 7:17 pm
Posts: 213
In the JSP integration code, the request.getRequestURL() doen’t seem to generate the proper URL on your site.
Do you have url rewriting rules in effect?
You should replace “request.getRequestURL()” with code that returns the actual url that the user has requested and not the one the application perceived.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group