google_ad_client = "(publisher-id)";
google_ad_width = (width);
google_ad_height = (height);
google_ad_format = "(format)";
How does Adsense work?
- 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.
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”:
- a publisher puts the following code into his HTML page:
<a href="http://picsense.example.com/fwd/(client ID)/" > <img border="0" src="http://picsense.example.com/img/(client ID)/(format)"> </a>
(from those who are not familiar with HTML, this creates a clickable image)
- when this HTML page is visited in a browser, the image
http://picsense.example.com/img/(client ID)/(format)is requested from the example.com service.
- 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.
- now comes the tricky part: the picsense.example.com 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
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
http://picsense.example.com/adv/(advertiser ID)/(campaign)/(format) (which means: go fetch the image from this other, new location).
So this is as much contextual as current Adsense advertising!