J2EE integration code

From ClickTale Wiki
Jump to: navigation, search

This page is outdated. Please see instead J2EE integration module.

ClickTale Wiki
The instructions on this page are intended for self service accounts.
Enterprise customers should contact their account managers for integration support.
If possible, use the J2EE integration module instead. It provides better integration with our service.
The only reason to use this code is if you are unable to install a binary module on your site.

The J2EE integration code below allows you to record dynamic pages and pages behind a login using the FetchFromWithCookies method.

Replace the bottom part of your tracking code with the one of the following to allow ClickTale to better cache the pages of your session based website:

Standard J2EE integration code

This code cannot record HTTPS/SSL pages.

<!-- ClickTale Bottom part -->
<div id="ClickTaleDiv" style="display: none;"></div>
<script type="text/javascript">
if(document.location.protocol!='https:')
  document.write(unescape("%3Cscript%20src='http://s.clicktale.net/WRd.js'%20type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
ClickTaleFetchFromWithCookies.setFromCookie("JSESSIONID");
// add a similar line for each additional cookie variable
 
ClickTaleFetchFrom = ClickTaleFetchFromWithCookies.constructFetchFromUrl();
 
if(typeof ClickTale=='function') ClickTale([!YOUR PARAMETERS!]);
</script>
<!-- ClickTale end of Bottom part -->

HTTPS-compliant J2EE integration code

This code will record HTTPS/SSL pages as well as standard pages. This functionality is not available for all plans and will not work unless supported by your current plan.

<!-- ClickTale Bottom part -->
<div id="ClickTaleDiv" style="display: none;"></div>
<script type='text/javascript'>
document.write(unescape("%3Cscript%20src='"+
 (document.location.protocol=='https:'?
  'https://clicktalecdn.sslcs.cdngc.net/www/':
  'http://s.clicktale.net/')+
 "WRd.js'%20type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
ClickTaleFetchFromWithCookies.setFromCookie("JSESSIONID");
// add a similar line for each additional cookie variable
 
ClickTaleFetchFrom = ClickTaleFetchFromWithCookies.constructFetchFromUrl();
var ClickTaleSSL=1;
if(typeof ClickTale=='function') ClickTale([!YOUR PARAMETERS!]);
</script>
<!-- ClickTale end of Bottom part -->

Adding more cookies

Please note: After

ClickTaleFetchFromWithCookies.setFromCookie("JSESSIONID");
more lines in the form of:
ClickTaleFetchFromWithCookies.setFromCookie("[!COOKIENAME!]");
may be needed, where [!COOKIENAME!] is the name of other session cookies required to properly identify your website visitors.