This is outdated. See
http://forum.clicktale.net/v ... .php?p=927
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 function for overriding the URL that clicktale fetches from so it is sure to include the current session id. It's intended for people using PHP's built-in session functions (e.g. $_SESSION). Thanks to Arik for pointing me in the right direction.
You'll notice that we include the clicktale source locally; you'll probably want to change that to however you've got it configured, and I believe the ClickTale() function also needs to be changed to match your account.
Code:
function get_clicktale_footer() {
$request_url = $_SERVER["REQUEST_URI"] ;
$request_url = ltrim($request_url, "/") ; //get rid of initial slash, since get_base_url always includes a trailing slash
$current_url = get_base_url() . $request_url ; //my function. returns, for example, "http://www.supportourribbons.com/"
$sid = session_id() ;
//if the session id is set, and not included in the current URL,
//append it to the current URL
if( !strstr( $current_url, 'PHPSESSID=' ) && !empty($sid) ) {
if( strstr( $current_url, '?' ) ) {
$current_url .= "&PHPSESSID=" . $sid ;
}
else {
$current_url .= "?PHPSESSID=" . $sid ;
}
}
return "<!-- ClickTale Bottom part -->
<div id='ClickTale' style='display: none;'></div>
<script src='[!YOUR CLICKTALE PATH!]/WRa.js' type='text/javascript'></script>
<script type='text/javascript'>
//This is where everything pays off.
//Update the URL clicktale fetches from:
if(typeof ClickTale=='function') {
ClickTaleFetchFrom='$current_url' ;
ClickTale([!YOUR PROJECT ID!],[!YOUR RATIO!]);
}
</script>
<!-- ClickTale end of Bottom part -->" ;
}
function get_base_url() {
if( $_SERVER['SERVER_PORT'] == "443" ) {
$abs_path = "https://" ;
}
else {
$abs_path = "http://" ;
}
$dirname = dirname($_SERVER['PHP_SELF']) ;
$dirname = str_replace("\\", "/", $dirname) ;
$abs_path .= $_SERVER['HTTP_HOST'] . $dirname ;
if( $abs_path[strlen($abs_path)-1] != '/' )
$abs_path .= '/' ;
return $abs_path ;
}
The get_clicktale_header() function is left as an exercise to the reader

I apologize if there are any errors in the code; I had to make some quick edits to remove some site-specific stuff.