Implementing Analytics using HTML image tags

Implement Analytics using an HTML image tag (hardcoded image request).

The browser then requests the image. Data moves with this image request via variables in the query string of the image request. The JavaScript combines browser-level variables with page-level variables for a comprehensive data collection solution. In some cases, a fully server-created image tag is appropriate. The standard elements of a JavaScript-based implementation are listed as follows:

HTML Code This portion consists of JavaScript code that is placed in HTML pages (or templates) that set the value of JavaScript variables.
JavaScript Library

This file contains common code that:

  • Queries the browser about various properties, such as JavaScript version, OS version, the size and resolution of monitor being used, and other variables
  • Encodes and concatenates all the variables into an image request (<img>) that transports these variables to the data collection servers. It then references a JavaScript library file which is loaded and executed.
<noscript> tag A simplified version of the image request is placed within a <noscript> tag that executes if the user has disabled JavaScript, or does not have JavaScript capabilities. This part of the implementation is optional and generally applies to approximately 2% of the Internet population.

JavaScript can detect browser settings that are not available to a server, such as browser window height/width, monitor resolution, and Netscape plug-ins. By using a server-side method to create an image tag, these variables cannot be captured. The JavaScript sets a random number in the image request to overcome browser and proxy server caching. This allows all page views to be accurately tracked. In certain situations, server-side code has advantages over the JavaScript-based code, including the following:

Note: The use of server-generated image tags requires additional time to implement, and is more difficult to debug, deploy, and maintain. Adobe strongly encourages clients to use JavaScript-based data collection on every page where possible. Various reports and features, including visitor click map, download links, exit links, and browser-based variables (browser width/height, etc.) cannot be collected or supported using this implementation method.