Monday, June 25, 2007

HowTo Display Different Adsense Randomly

i got this after reading Digital Inspiration. See the example codes below :

this example from adsense blog >>

<script type="text/javascript">
    var random_number = Math.random();
    if (random_number < .5){
        //your first ad unit code goes here
    } else {
        //your second ad unit code goes here
    }
</script>
<script type="text/javascript"     src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

You can see the implementation code by Digital Inpiration here. I think this method will make us easier to exprementing which Adsense format will perform better.

Other sources :

2 comments:

papajoneh said...

Pretty Neat adsense coding here. Keep it up. :)

LAi said...

hehe..i've to parse the adsense code to fit it into the post body..with the new blogger, i must parsed the adsense code to make sure it acceptable to put the code within the post-body. If you are intersted..you can check it at blogcrowds.com