Contextual advertising without JavaScript

A recent article on Jensense: Monetizing from those with javascript disabled made me ponder a bit on the possibilities of contextual advertising *without* JavaScript. This would be primarily for places where you cannot add JavaScript (e.g. in RSS feeds, in blog posts). And I think I have found a solution.

Minimal Javascript code for Adsense
<script type="text/javascript">
google_ad_client = "(publisher-id)";
google_ad_width = (width);
google_ad_height = (height);
google_ad_format = "(format)";
<script type="text/javascript" src="http:// show_ads.js"> </script>

How does Adsense work?
To use Adsense now, you need to embed a piece of JavaScript code into your HTML pages. The first part sets your personal ID and the look and feel of your ads. The second part is a link to a piece of code that Google constructs on-the-spot. They can take into account:

  • WHERE: what is the content of the page the ad is featured in

  • WHO: who is the end-user: default language of the browser, IP-address (which can be resolved to a country + city location), maybe the time of day
  • WHAT: what keywords do advertisers want to pay for

This is called contextual advertising: it is tailored for the page and the viewer.
Currently Google Adsense uses JavaScript, because it’s the best way to insert full-featured HTML into someone else’s web page.

Adsense without JS
Imagine we don’t need the whistles and bells of HTML, and just work with an image. Could we do contextual (i.e. tailored) advertising? Well, I think we can. Let me present “PicSense”:

  1. a publisher puts the following code into his HTML page:
    <a href=" ID)/" > <img border="0" src=" ID)/(format)"> </a>
    (from those who are not familiar with HTML, this creates a clickable image)
  2. when this HTML page is visited in a browser, the image ID)/(format) is requested from the service.
  3. The server also receives in the request: the URL where the image is showing in (i.e. “WHERE”), and the details on the browser and network location (i.e. “WHO”). The server then selects one of the offers it has from advertisers (“WHAT”), and sends back a ‘302 redirect’ to ID)/(campaign)/(format) (which means: go fetch the image from this other, new location).
    So this is as much contextual as current Adsense advertising!

  4. the visitor sees an image appearing with an ad from advertiser X (maybe a colorful image, or just some lines of text rendered as a GIF file). If the offer interests him, he clicks on the image.
  5. now comes the tricky part: the service must use exactly the same decision algorithm to make sure that the visitor who clicks on the link arrives on the page of the right advertiser. The algorithm must be deterministic, there cannot be a random element in it. If there are e.g. 3 advertisers that offer a blogging service, then the service cannot pick 1 of the 3 images at random to show on a blog-related page, because there would be no way to send the visitor to the correct advertiser afterwards

Why no JavaScript?
Javascript is powerful and (therefore) dangerous. In some browsers it is disabled for security reasons. You cannot include JavaScript in a Blogger post. JavaScript is blocked in webmail (OK, sometimes images are blocked too, but less often than Javascript). It would be handy to have an option for inobtrusive advertising in those cases too.


7 thoughts on “Contextual advertising without JavaScript”

  1. Your point 4: the way Adsense for feeds works now is that not only the client ID is added, but also a (blog)posting ID.

    So a request for the image does contain a pointer to the actual content (it has to, because otherwise it’s impossible to determine for the adsense server what content it applies to when the request comes from a Feedreader!).

    Also note that the target url contains a posting ID for the same reason. There still is some juggling server-side: Google Adsense for RSS feeds varies the pics displayed, so it has to synchronise the target url redirects accordingly – meaning they link the request for the pic and the target url request based on ip and timing (I wouldn’t know any other parameter, even the user agent could be different in case of an RSS feed).

    BTW: there is no reason indeed why Google Adsense for feeds wouldn’t work for email news letters, at least as long as the Google server has a clue of the content of the email to server contextually relevant. And in fact, they do work with some content partners to have Adsense in emailings, with iVillage Inc for example, see,1759,1755444,00.asp .

    I tested it once (faking pregnant womanhood), as far as I can see the mails from iVillage are not sent via a Google smtp, so I assume the put the mail content up somewhere online so the Adsense server can determine relevant pics and redirect url’s. When you think of it, there’s no reason why Adsense for emails wouldn’t work on a larger scale (a mail client is just another RSS feed reader since lots of people get their feeds mailed to them or read them with an Outlook plugin), as long as either there’s a trust relationship (= a contract 😉 ) between Google and the content provider (like iVillage) OR the mail is sent via a Google smtp server. I’ve been wondering for some time why they didn’t roll out a service based on the second option.

  2. @Pascal 1: that was exactly the answer I was going to write. I wonder if they have a kind of web service where you just send the content of the blog post/mail message and get an ad image URL back to use with it. The issue with emails is that most email readers block images for privacy reasons. An external image can ‘phone home’ to confirm that the email was read. Spammers love that.

    @Pascal 2: that’s not Blogger’s fault, it’s me. I started this post before the other two, but kept it in “Draft” until I could finish it. It was then published with the original date.

  3. So how can i take the javascript out of the adsense code and still be able to use it? i have a myspace page and it will let you input html, dhtml and css but not javascript… is this possible? Thanks!

    please email me at

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.