Aller au contenu | Aller au menu | Aller à la recherche

Thursday 11 May 2006

How is an adsense made ? How can I affect their display ?

Let's observe the beast. The usefull tools are Firefox; equiped with the webdev toolbar. Adding addsenses in a page is inserting a call to the http://pagead2.googlesyndication.com/pagead/show_ads.js script. This script is obfuscted, so normal humans have difficulites to understand its behaviour. What we can see is the result of this script, executed upon the loading of the page. Select the Adsense without clicking it, right click->view selected source. You should see something like that:

<script type="text/javascript"><!--
google_ad_client = "pub-8315147201128023";
...
google_color_url = "54724A";
google_color_text = "2F2005";
//--></script>

This javascript snipet prepositions variables used by the show_ads.js script

<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

This is the call to the script acting onload. You actually pasted these few lines in your HTML code, so it is normal to see those here.

<iframe name="google_ads_frame" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-8315147201128023&amp;dt=1147..." marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="125" scrolling="no" width="125"></iframe>

This iframe was inserted by the javascript and sources a page on the googlesyndication.com server. The long list of parameters are used by the server to display a targeted add.

The content of an iframe does not uses the CSS from the source page. But it isaccessible via the DOM: details are on QuirksMode

The first way we can try to modify the way its displayed is playing with the iframe itself, provided you do not have other iframes on your page; e.g. to have a fixed add in the top right left add the following statements in your CSS file:

iframe { position:fixed; top:0; right:0; }

If you have several adds on the same page, they'll pile up, and that's bad.

Friday 5 May 2006

Adsenses ? Why ?

I just added adsenses to this blog. Not that I am willing to make money from it, with 6K visits a month, I highly doubt I will hit the 100$ required to receive the first check.

The reason is twofold:

  • In my professional life, I am an anouncer, using Adwords to reach visitors searching about DO-178B and IEC 61508 code generators. I just wanted to know how the other side of the system was working. My first impression is: wow, how easy it is !
  • I want ot experiment of what it is possible to do with Adsenses and CSS, and maybe a bit of javascript.

As a user, I am a bit disapointed, having always thought Ads are bad, I find myself clicking on adds, not for earning money (I'm sure google has the means to remove my clicks), but because the adds actually interest me. Their algorythm to find targetted Ads seems pretty good, so lets play a bit and see the results.

NB: should I ever receive a check from google, the first one will be for regne.net which hosts me freely.