Unified Webbug
Managing multiple webbugs is no fun. The following is an attempt to unify disparate webbugs into a single, extensible, solution.
How it works
The unified webbug snippet below replaces the need to include a separate webbug for each of analytics services you are using. Simply add the snippet below to your pages, configure your specific account settings, and you're done. This webbug will make (asynchronous) requests to each of the analytics services, without affecting page performance and simplifying the maintanance of your analytics webbug sprawl.
How to use the Unified Webbug
Step 1: Select the analytics services you are using:
Google Analytics
Omniture
Chartbeat
Quantcast

Step 2: Copy and paste the following code inside your <head> tag:

<script type="text/javascript">
    function trackerSetup() {
        var tracker = new Tracker();
        tracker.addTracker(new QuantcastTracker("account")); 
        tracker.addTracker(new GoogleAnalyticsTracker("name", "UA-XXXXXXX-X")); 
        tracker.addTracker(new ChartbeatTracker(1234, "domain")); 
        var s_vars = {
            s_pageName : "pageName",
            s_server : "www.test.com",
            s_channel : "IndexPage"
        }
        tracker.addTracker(new OmnitureTracker(s_vars, "s_code.js")); 
        tracker.trackPageview();
    }
 
    (function loadJs(url, callback) {
        setTimeout(function() {
            var script = document.createElement("script")
            script.type = "text/javascript";
 
            if (script.readyState){  
                script.onreadystatechange = function(){
                    if (script.readyState == "loaded" ||
                        script.readyState == "complete"){
                        script.onreadystatechange = null;
                        callback();
                    }
                };
            } else {  
                script.onload = function(){
                    callback();
                };
            }
 
            script.src = url;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(script, s);
        },0);
    })("http://labs.webmetrics.com/webbug/tracker.js", trackerSetup);
</script>

Step 3: Replace the green values with the ID's and domains specific to your site.

Step 4: Remove your existing webbugs.
More information

The system uses a generic tracking object, called "Tracker", for coordinating all the specific trackers used in a page. Each specific tracker has a method, "trackPageview", that takes no arguments and runs the code to send the data to the tracking server. The generic Tracker object has a list of the specific trackers that you're using and a method, also called "trackPageview", that runs the “trackPageview” method for each tracker in the list.

The trackers are contained in a separate JavaScript file that is loaded asynchronous so it doesn't interfere with the rest of the page loading. Once the JavaScript is loaded and ready to be used, a callback function, "trackerSetup", is run to setup and run the trackers.

The section that needs to be configured is the “trackerSetup” function. The default code example above includes a Google Analytics tracker to the page and registers the pageview with it. The first line creates a new generic Tracker object. The second line creates a GoogleAnalyticsTracker and adds it to the generic tracker. We then run the “trackPageview” method of the generic tracker which then runs the tracking code of the GoogleAnalyticsTracker.

NOTE: This code is considered alpha, so please do not put it in production just yet.


Disclaimer: This is a test and development site which is not officially supported by Neustar Webmetrics.