Summary
Installing the Javascript Code

There are several reports in Summary that require the use of client side Javascript to gather information about the client's browser. Getting these reports to work requires minor changes to your web pages. You should pick one page, or a small number of pages, to modify, preferably the page(s) that are the primary entry point(s) for your site.

The reports that depend on the Javascript being installed include:

  • Language
  • Window Width
  • Window Height
  • Java Enabled
  • Cookies Enabled
  • Plugins Installed
  • Screen Size
  • Color Depth

The Javascript code gathers information about the clients browser and passes that information back to the server as a request for the image "/log____image.gif", with additional information in the query string. Summary then uses this information to create the various browser reports. For this to work you must modify your HTML to include the Javascript code, below, and make sure your server is logging the query string.

It is often a good idea to put a "/log____image.gif" file on your server. Having a file with that name is not critical; everything still works even if the file is not found. Many servers are faster serving a small file than an error. Also, it is nice to not have to see that request always showing up in the error reports. A small file with that name is provided with Summary in the extras folder.

Apache, and other servers using NCSA Common or NCSA Combined log format, will always log the needed information. Microsoft IIS will always log the needed information when using Microsoft or NCSA log formats. Microsoft IIS using W3C format must be configured to include the "URI Query" log field. To log the needed information in WebSTAR you must include either the SEARCH_ARGS or CS-URI-QUERY log tokens (they are identical).

There are three versions of the Javascript. The first is very simple and is placed in the <HEAD> section of your HTML. It logs the screen size, Java enabled state, and cookie enabled state. The second script also logs the window size. It is more complex because the window size is not always known until the page has been rendered. The third script adds logging of the installed plug-ins, which takes a small amount of extra time.

The first script is the simplest to install. The second is slightly more complex to install but tells you the client's browser window size. The third script gives you the most information, but it also sends back very large requests that take a small amount of extra time to process and takes up more space in the log file.

These scripts are safe on any browser, but they will only gather and report information in newer browsers. Netscape Navigator/Communicator 4.x or newer, Microsoft Internet Explorer 4.x or newer, or the equivalent are required for the scripts to work. Since these browsers are by far the most common, the results are meaningful, but keep in mind that there is a slight bias against older machines.

Browser plug-in information can only be gathered from Internet Explorer running on the Macintosh, Netscape Navigator/Communicator 4.x or newer on all platforms, and a few of the other browsers. Unfortunately, plug-in information is not available in the Windows version of Internet Explorer.

Simple Script

The simple script only requires one addition to the HTML. It is the simplest to install but it does not log the window size or installed plug-ins.

Put this in the <HEAD> section of your HTML:

<script language="javascript1.2"> <!-- ls="/log____image.gif?summarylog&je="+navigator.javaEnabled()+ "&sw="+screen.width+"&sh="+screen.height; if (screen.pixelDepth) ls+="&sd="+screen.pixelDepth; else if (screen.colorDepth) ls+="&sd="+screen.colorDepth; if (navigator.language) ls+="&la="+navigator.language; else if (navigator.userLanguage) ls+="&la="+navigator.userLanguage; if (!document.all) { document.cookie=1; ls+="&co="+(document.cookie?true:false); } else ls+="&co="+navigator.cookieEnabled; li=new Image(); li.src=ls; //--> </script>

Medium Script

The medium script adds window size, but still doesn't log plug-ins installed. This script provides more information than the simple script but it is more complex to install. Installation requires three separate additions to the HTML, including an "onload" item in the BODY tag.

Put this in the <HEAD> section of your HTML:

<script language="javascript"> <!-- function whenReady() {} //--> </script>

Add this to the BODY tag:

onload="whenReady()"

It should look like this if you don't have any other options on the <BODY> tag:

<BODY onload="whenReady()">

If you already have an onload function specified in your BODY tag, you will need to modify your existing onload function to call ours, or set onload to "whenReady()" and modify ours to call your existing one.

Add this after the </BODY> tag but before the </HTML> tag:

<script language="javascript1.2"> <!-- function whenReady() { ls="/log____image.gif?summarylog&je="+navigator.javaEnabled()+ "&sw="+screen.width+"&sh="+screen.height; if (screen.pixelDepth) ls+="&sd="+screen.pixelDepth; else if (screen.colorDepth) ls+="&sd="+screen.colorDepth; if (navigator.language) ls+="&la="+navigator.language; else if (navigator.userLanguage) ls+="&la="+navigator.userLanguage; if (!document.all) { document.cookie=1; ls+="&co="+(document.cookie?true:false); } else ls+="&co="+navigator.cookieEnabled; if (window.innerWidth) { ls+="&ww="+window.innerWidth; ls+="&wh="+window.innerHeight; } else if (document.documentElement && document.documentElement.clientWidth) { ls+="&ww="+document.documentElement.clientWidth; ls+="&wh="+document.documentElement.clientHeight; } else if (document.body && document.body.clientWidth) { ls+="&ww="+document.body.clientWidth; ls+="&wh="+document.body.clientHeight; } li=new Image(); li.src=ls; } //--> </script>

Full Script

The full script logs the browser window size and plug-ins installed for Internet Explorer running on the Macintosh, Netscape Navigator/Communicator 4.x or newer on all platforms, and a few of the other browsers. This script provides the most information but it is more complex to install than the simple script. It also takes very slightly more time to execute on the client browser, and it results in larger log files. Installation requires three separate additions to the HTML, including an "onload" item in the BODY tag.

Put this in the HEAD section of your HTML code:

<script language="javascript"> <!-- function whenReady() {} //--> </script>

Add this to the BODY tag:

onload="whenReady()"

It should look like this if you don't have any other options on the <BODY> tag:

<BODY onload="whenReady()">

If you already have an onload function specified in your BODY tag, you will need to modify your existing onload function to call ours, or set onload to "whenReady()" and modify ours to call your existing one.

Add this after the </BODY> tag but before the </HTML> tag.

<script language="javascript1.2"> <!-- function whenReady() { ls="/log____image.gif?summarylog&je="+navigator.javaEnabled()+ "&sw="+screen.width+"&sh="+screen.height; if (screen.pixelDepth) ls+="&sd="+screen.pixelDepth; else if (screen.colorDepth) ls+="&sd="+screen.colorDepth; if (navigator.language) ls+="&la="+navigator.language; else if (navigator.userLanguage) ls+="&la="+navigator.userLanguage; if (!document.all) { document.cookie=1; ls+="&co="+(document.cookie?true:false); } else ls+="&co="+navigator.cookieEnabled; if (window.innerWidth) { ls+="&ww="+window.innerWidth; ls+="&wh="+window.innerHeight; } else if (document.documentElement && document.documentElement.clientWidth) { ls+="&ww="+document.documentElement.clientWidth; ls+="&wh="+document.documentElement.clientHeight; } else if (document.body && document.body.clientWidth) { ls+="&ww="+document.body.clientWidth; ls+="&wh="+document.body.clientHeight; } np=navigator.plugins; if (np) { for (i=np.length-1;i>=0;--i) ls+="&p="+escape(np[i].name); } li=new Image(); li.src=ls; } //--> </script>
 

Quick Start | Overview | Tutorial | How To | Configuration
Javascript Code | Virtual Domains | Log Formats | Custom Overviews
Questions | Reports | Purchasing | FAQ | Glossary

Copyright 1998-2004 by Summary.Net - Updated 3/3/04