ClickTaleFetchFromWithCookies

From ClickTale Wiki
(Redirected from FetchFromWithCookies)
Jump to: navigation, search
ClickTale Wiki
The instructions on this page are intended for self service and online accounts.
Enterprise customers should contact their account managers for integration support.

Contents

ClickTaleFetchFromWithCookies 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.

If you are hosting an older version of the recorder file (before WRc3.js) and for some reason unable to update it please use Old FetchFromWithCookies.

Using ClickTaleFetchFromWithCookies

  1. For each cookie you would like to simulate, add the following line:
    ClickTaleFetchFromWithCookies.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:

    ClickTaleFetchFromWithCookies.setFromCookie(/^ASPSESSIONID.*/);

    Can be used for recording cookies which are named "ASPSESSIONID" + an alphanumeric code, unique for each visitor.

  2. Finally, after the last cookie name (and before the line that starts with "if(typeof ClickTale=='function')"), add the code line:
    ClickTaleFetchFrom = ClickTaleFetchFromWithCookies.constructFetchFromUrl();

See here for Code_Examples

Specifying a URL

Much like the ClickTaleFetchFrom variable, the ClickTaleFetchFromWithCookies 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 = ClickTaleFetchFromWithCookies.constructFetchFromUrl([URL FOR HTML SOURCE]);

This can come in handy for instance when employing the ClickTaleFetchFrom solution for POST pages (noted here).

Using in conjunction with an integration module

Since integration modules have an xml file which is used as a centralized source for the tracking code, the ClickTaleFetchFromWithCookies should be implemented there. The addition of ClickTaleFetchFromWithCookies is done similarly to the way it's added to regular tracking code, with one exception. Since the code in the xml already includes a ClickTaleFetchFrom line, the URL in it should be used in the constructFetchFromUrl command instead. For example, The code in the ClickTaleScripts.xml file for the ASP.NET integration module contains the line:

ClickTaleFetchFrom="http://%RootPath%/ClickTaleCache.ashx?t=%CacheToken%";

When adding the ClickTaleFetchFromWithCookies code the list of cookies added using setFromCookie is placed normally, while the ClickTaleFetchFrom line is changed to:

ClickTaleFetchFrom=ClickTaleFetchFromWithCookies.constructFetchFromUrl("http://%RootPath%/ClickTaleCache.ashx?t=%CacheToken%");
Personal tools