Elliott C. Back: In Aere Aedificare

Google Adsense Javascript Unobfuscated?

Posted in Google by Elliott Back on April 3rd, 2005.

I just noticed that the javascript which drives AdSense is unobfuscated and be viewed directly: http://pagead2.googlesyndication.com/pagead/show_ads.js. If you wonder how AdSense ads are served, look no further than the source itself.

This made me curious–can I reduce the filesize? Renaming the variables and manually removing whitespace squished the 9,261 byte script to 6,376 bytes. That’s a 2,885 byte or 31% reduction over the original size. And, if you think that’s not that much, it’s a savings of 2.82 MB per 1000 visits. If you’re hosting a site with a 1,000,000 visitors a day, Google could save 2.8 GB of bandwidth! And, your site will load just that much faster for end users. Even if you’re not hosting the javascript, it really should be optimized.

This entry was posted on Sunday, April 3rd, 2005 at 12:53 am and is tagged with filesize, end users, google, variables, bandwidth, gb. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

4 Responses to 'Google Adsense Javascript Unobfuscated?'

  1. Dave said:

    on April 3rd, 2005 at 9:32 am

    I don’t think the guys at the Googleplex are that worried about a few gigabytes - they probably throw a few GB around every minute. :)

  2. Elliott Bäck said:

    on April 3rd, 2005 at 10:09 pm

    What about the people visiting your site? It’s 2.5kb extra per page for your visitors to load!

  3. Dave said:

    on April 5th, 2005 at 7:31 am

    Well, I usually have at least 20-50kb of images… 2.5kb/page on 56k dialup = about 1/3 of a second… :P

  4. Zen said:

    on May 27th, 2005 at 7:13 am

    I was just looking at that. There’s no file dependencies so you could probably run the code locally.. although that’s a no no. It’s interesting none the less.

    It would definately alter them tracking the amount of impressions you create and would probably flag you real good when clicked.

    It seems each click is routed via the google syndicate with your Client ID the advertised site and an encoded bit called “ai” which contains the time, date and location info (among other stuff?)

    That’s how they track who’s clicking from where and when (and what you had for dinner).

    Other than this or that the codes pretty easy to understand and it’d be easy to make scripts that hook the variables, I think there’s already a few developers doing this.

    I wonder where the line is with that, since you’re not modifing the code directly is it still against the TOS?

Your Thoughts Go Here:

Powered by WP Hashcash