Tracking code

The Tracking Code initiates the recording process for every page on your site on which it is placed, although not every visitor will actually be recorded. That is determined by your recording ration, quota, visitor type, browser and other parameters.

The Tracking Code (Balkan) allows the user to set the recording ratio for the project without changing the code on the site pages. Setting the ratio is done using a slider control in a convenient manner.

The code uses the ClickTale server to store the unique parameters for your code, while allowing you to run all your custom code using Hook functions.

The ClickTale tracking code shown here is used for all standard HTML webpages, both HTTP and HTTPS, and is generated in a few simple steps on your ClickTale account.

Here is how to generate your code and perform a standard installation.

For non-standard, session-based or dynamic pages, please use the relevant plugin or integration module.

Hooks and Timing
The Hooks in Balkan tracking code are actually functions synchronized with various stages of the ClickTale Recorder loading and operation. Hooks allow you to insert any custom code you want to run for various ClickTale scenarios, using the ClickTale API functions.

The default hook available is ClickTalePreRecordingHook. This Hook is executed after the ClickTale code has loaded, but before recording is started.

This would be the appropriate timing for running most all of the ClickTale API functions that you want to execute before starting to record - like ClickTaleFetchFromWithCookies, ClickTaleUploadPage, ClickTaleGet/SetUID etc.

Here's an example of custom code placed in the Hook:

If you need to use other hooks/timings for ClickTale functions, please contact our support team.

Top Part
The top part of the code is a time stamp and does not load any scripts. While it's not necessary to have the top code, it is recommended. The top code should be placed after the opening  tag.

Example top code and placement:

Bottom Part
The bottom part of the code loads the ClickTale recording script. It is recommended to place it after your page's content (so that the script loading does not affect the loading of other elements on your page) and before the closing tag.

XHTML-Compliant version of the code
If you need to use an XHTML-Compliant version of the Balkan code (for example, to use with a Tag Management service, you need to check a checkbox in Advanced Settings and regenerate the code.

Below is the format of the XHTML-Compliant version, for general knowledge.

If you need it, there is also an XHTML-compliant version of the AJAX-handling XHR wrapper code. See this article.

External file version of the code
If you wish to insert the tracking code onto the pages by fetching the code from an external JavaScript file, just put the Balkan code as-is into the external JS file and reference it.