FetchFromWithCookies
From ClickTale Wiki
Contents |
FetchFromWithCookies is an extension to the regular ClickTale tracking code that allows correct caching of pages that depend on cookie values. The cookies could contain session identifiers (session cookies) or simple values. The values collected during recording time will be passed to your server during the caching (AKA fetching) stage. Your server would then recognize a visitor's session on your website and render the page content accordingly (e.g. display a shopping cart's contents). This script is used in several integrations, including those for Classic ASP and JSP.
[edit] Using FetchFromWithCookies
- Below the script line referencing the WRb JavaScript file, add the following:
<script type="text/javascript" src="http://s.clicktale.net/FetchFromWithCookies.js"></script>
Please note: If you are using HTTPS/SSL compliant code download and save FetchFromWithCookies.js in an https location, and change the script tag source to that location.
-
For each cookie you would like to simulate, add the following line:
FetchFromWithCookies.setFromCookie("[!COOKIENAME!]");Where [!COOKIENAME!] is replaced with the name of the cookie.
Please note: The parameter setFromCookie can be either a String or a RegExp (Regular Expression), in order to accommodate cookies with a varying name. For example:FetchFromWithCookies.setFromCookie(/^ASPSESSIONID.*/);
Can be user for recording cookies which are named "ASPSESSIONID" + an alphanumeric code, unique for each visitor.
-
Finally, after the last cookie name (and before the line that starts with "if(typeof ClickTale=='function')"), add the code line:
ClickTaleFetchFrom = FetchFromWithCookies.constructFetchFromUrl();
[edit] Specifying a URL
Much like the ClickTaleFetchFrom variable, the FetchFromWithCookies also enables you to define where to fetch the page html from (a different source than the page the code is located on). This is done by entering the URL as a parameter in the constructFetchFromUrl function:
ClickTaleFetchFrom = FetchFromWithCookies.constructFetchFromUrl([URL FOR HTML SOURCE]);
This can come in handy for instance when employing the ClickTaleFetchFrom solution for POST pages (noted here).

