6. Floater Deployment

The deployment of the floater client involves adding a tag to the XHTML of the tracked system. The required tag is a script tag, which refers to an external source. The system relies on the referrer data given by the browser, so the JavaScript code cannot be placed inside the script tags. The placement of the tag is not crucial, but it would be good practice to always place it to the same place, for example before the closing body tag.

To avoid browser caching problems with multiple projects a random parameter should be added by appending the following characters to the source parameter: “?rand=XXXXXX” (the Xs represent random characters). The random parameter should be same for each page of the project. If a random number is generated, the floater code is loaded each time. This results in increased server load.

An example of the required script tag and its placement in the XHTML file is shown in Example 19.

script language="JavaScript" src="http://silvia.local/marmalade/public/index.php?rand=880734116"> /script> /body>

Example 19 – Script tag for loading the floater

The code should be on each individual XHTML-page the browser receives. For template-based systems, it should be added to each template or possibly to the commonly included footer file.

For tracking static XHTML-files, the process requires additional tools or tedious handwork. It is possible to make the changes by hand to each file, but it is ideal to use a search and replace function of a text editor. This function searches a mass of files for a certain pattern and replaces it with another. This feature is common in popular editor tools (such as Macromedia Homesite and Dreamweaver) and makes it effortless to make the required changes. The search and replace interface of Macromedia Dreamweaver is shown in Image 7.

Macromedia Dreamweaver search and replace interface

Image 7 - Macromedia Dreamweaver search and replace interface

It is recommended that the script tags be removed from the system when it enters the production stage. In theory with the floater visibility property set to hidden the floater should not be displayed to the users. In practice, the XHTML can be examined by the users of a web site (or a web application) and this could present a security risk. In addition not removing the tag would create unnecessary load for the server running the Marmalade 1.0 system.