Web analytics Hacks select series JavaScript document object model

This article is an excerpt from the site analysis of

T.Peterson Site master Eric "Web Measurement Hacks"

– HACK#30 " Hack, the, JavaScript, Document, Object, Model",

web analytics solutions generally use tags to understand how they use the JavaScript document object model (DOM).

most web analytics providers are using the JavaScript document object model (DOM) extensively, and you might worry about whether the provider’s code will interfere with your own JavaScript code. More importantly, you should also worry that the service provider uses all the data that DOM might provide to collect data.

below are some examples of information provided by DOM:

browser version

operating system time

operating system language

the resolution of the monitor is

the color of the monitor is depth

browser height and width

* form analysis


document object model (DOM) is a data structure for Web browsers and JavaScript to store and retrieve documents (that is, pages) (Figure 2-16). JavaScript and JavaScript developers use DOM to collect data and display data information. From inserting web pages, monitoring tags to collecting web user information, DOM is the core. In Figure 2-16, a fragment of the DOM component is shown, which clearly shows the general structure of the DOM. The window object is the root node, through which all other elements can be accessed. Each object has a function, property, event, or other object. With JavaScript, you can access or control every element of DOM, as described in the following sections.


figure 2-16. JavaScript document object model

insert monitoring tag

, as you suspect, is the most important thing in the data collection approach based on surveillance tags, the monitoring tag (an invisible GIF image, Hack#29). There are two main ways to insert a monitoring tag into a page: the picture tag generator through the server side and the JavaScript through the client. Create through JavaScript >