1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google Analytics JavaScript code is embarrassing

Discussion in 'Google Analytics' started by korzon, Apr 9, 2006.

  1. #1
    Google bought Urchin, a web tracking service, and are branding it as "Google Analytics". The service works by having you embed a code on your website which loads a JavaScript file from the Google servers (the JavaScript then sends Google data about each hit). The code they are using is located at:

    And I find it quite embarrassing for Google. Where do I start:

    • If they are going to rebrand it, they should at least name the file "Analytics.js"
    • The file is 17KB. That means that any visitor to a page being tracked by Analytics has to download an extra 17KB unless it's cached. To compare - Google.com is 12KB. If it was being tracked by analytics - it would take more than twice as long to load.
    • About 3KB of the JavaScript file is comments. They can be removed without hurting functionality. The comments are of no use to webmasters as they can't change the code - it sits on the Google servers!
    • What's even more embarassing about the comments is that they were actually written by the Urchin team and are used to help configure the Urchin Tracker. An especially funny comment is //-- **** Don't modify below this point ***
    • I wont go into this, but close examination of the code shows that about 25% of it can be shaved off with no effect. That's in addition to the comments. They could shrink it to 8KB without changing any of the backend.
    • Also, the script puts a lot of parsing work on the client - which is actually a good idea, but hurts user experience due to the prolonged download speeds of the parsing functions. I don't know about you, but I don't like adding 17KB to each of my pages.

    All that said, it's a good service, and it's free. I use it, and will probably continue to use it. But I expected more from Google. After all, Matt and Brin are rumoured to still count the amount of words on Google.com to make sure it doesn't become a cumbersome "Portal".
    korzon, Apr 9, 2006 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Likes Received:
    Best Answers:
    Trophy Points:
    Digital Goods:
    • Urchin is still the "product" Google uses for it's analytics (they still sell Urchin http://www.google.com/analytics/urchin_software.html)
    • Any modern web browser is HTTP/1.1 compliant and is going to get that file with zlib compression automatically (which means it's actually going to be about 3k)
    • If you want to get technical, the comments take up 1086 bytes (roughly 1k) pre-compression... abut 200 bytes after compression.
    • Urchin is still the product that Google Analytics uses. Actually, if you want to get advanced, you can take the urchin.js file remove comments (or even modify parameters in it) and host the file on your server locally. Then you can make it as "small" as you want. The main reason the comments are in there is just for that reason (so advanced users can do just that).
    • 17k isn't being added to all your pages. Considering it's transmitted in compressed form, you are adding a ONE TIME download of 3k (the user's browser does not download the JavaScript file for each request, it keeps it cached).
    digitalpoint, Apr 9, 2006 IP