ClickTale Support Forums

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jun 28, 2007 6:30 pm 
Site Admin

Joined: Fri Jul 21, 2006 2:39 pm
Posts: 1206
Location: Israel
This method is depreciated. See reply to this post below for more details.

If your ASP.NET web site uses sessions (storing data in the Session[] object) or .NET's built-in Forms Authentication then ClickTale may not be able to record your pages correctly by default.
In a sec, I will provide you with an ASP.NET "Web User Control" that will not only allow you to add ClickTale easily to your pages, but will also allow ClickTale to do correct caching of "session" dependent and "Forms Authentication" protected pages.
This sample was developed and tested for ASP.NET 2.0 . It won't work with ASP.NET 1.x because the cookieless="AutoDetect" attribute is not supported prior to ASP.NET 2.0.

Step 1:
Modify your web.config file to allow cookieless session and authentication modes.
Find your system.web/authentication/forms tag and add an attribute that looks like this: cookieless="AutoDetect" .
Find your system.web/sessionState tag and add cookieless="AutoDetect" attribute too.
If you don't have one of those tags then you might be not using session or Forms Authentication or you may be using the default values. Add the tags when needed.
Here is an example of an XML snippet:
      <authentication mode="Forms">
      <forms loginUrl="Login.aspx" protection="All" timeout="30"
            <credentials passwordFormat="Clear">
               <user name="Arik" password="Password"/>
      <compilation debug="true"/>
     timeout="30" />

Step 2:
Save the following block to the root of your website as ClickTale.ascx file
<%@ Control Language="C#" ClassName="ClickTale" %>

<script runat="server">
   // Copyright 2007 ClickTale Ltd.
   private string FullUrl;
   protected void Page_Load(object sender, EventArgs e)
      string FullPath = Page.Request.Url.GetLeftPart(UriPartial.Path);
      int ScriptNamePos = FullPath.LastIndexOf("/");
      string VirtualPath = FullPath.Substring(0, ScriptNamePos + 1);
      string ScriptName = FullPath.Substring(ScriptNamePos + 1) + Page.Request.Url.Query;

      StringBuilder s = new StringBuilder(VirtualPath);
      if (Page.Session.SessionID != null)
         s.AppendFormat("S({0})", Page.Session.SessionID);
      if (Page.Request.Cookies[FormsAuthentication.FormsCookieName] != null
         && Page.Request.Cookies[FormsAuthentication.FormsCookieName].Value != null
         && Page.Request.Cookies[FormsAuthentication.FormsCookieName].Value != "")
         s.AppendFormat("F({0})", Page.Request.Cookies[FormsAuthentication.FormsCookieName].Value);

      FullUrl = s.ToString();

<!-- ClickTale Bottom part -->
<div id="ClickTale" style="display: none;"></div>
<script src="" type="text/javascript"></script>
<script type="text/javascript">
ClickTaleFetchFrom='<%= FullUrl%>';
if(typeof ClickTale=='function') ClickTale([!YOUR PROJECT ID!],[!YOUR RATIO!]); // set your values here
<!-- ClickTale Bottom part end -->

You will need to insert your IDs and parameters in the bottom of the file. You should compare the code in the sample to the code you regularly use. Your code may be newer or better so you might want to edit the file to match. Make sure you keep the "ClickTaleFetchFrom=.." line. It is the one that does the magic.

Step 3:
Add the "ClickTale Web User Control" to your pages. You can do that individually for each file or you can add the control to your master template (recommended).
To do that, add the line
<%@ Register Src="~/ClickTale.ascx" TagName="ClickTale" TagPrefix="CT" %>

at the top of your ASP file and
<CT:ClickTale ID="ClickTale" runat="server" />
right before your </body> tag.

This add-on will allow ClickTale to impersonate the original visitor when caching the content. Implementing this process might have side effects on your site if you perform actions on GET requests. For example, if you keep a counter in your Session object which you raise for every page visit then you will now be getting an additional visit for every page that ClickTale is going to record. Generally you shouldn't have any such cases, but if you do you should check if ClickTale is making the request or a real person and handle properly. You can check that by looking for "ClickTale" in the UserAgent of the request.

Post questions and comments here.


 Post subject:
PostPosted: Thu Jan 31, 2008 6:47 pm 
Site Admin

Joined: Fri Jul 21, 2006 2:39 pm
Posts: 1206
Location: Israel
If possible, use the "ASP.NET Integration Module" instead. It provides better integration with our service.
The only reason, IMO, to use this technique is if you are unable to install a binary module on your site.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 2 guests

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:  
Powered by phpBB® Forum Software © phpBB Group