Loplin
Apr 19th 2005, 10:26 pm
I have recently added AdSense Adlinks to a website I host.
In order to see which combination of colors/ad types would be most profitable, I wanted to make a script that would automatically rotate one adblock between the following...
1)AdLink Block with colors that match the site
2)Adlink Block with colors that Stand Out
3)AdSense Button block with colors that match the site
4)AdSense button block with colors that stand out.
I was going to make a channel for each and have the script randomly serve one of these 4. At the end of the month, which ever ad type made the most money was going to get that spot.
Why not use php? The server I host on is not what you might call High End and the scripts that I run are server intensive. As a result, I use a squid proxy to caching. This way a page is only generated once, until it is updated, then cached and served from memory, which means a php randomizer wouldn't work.
I tried to do something like this....
<script language="JavaScript" type="text/javascript">
var whichad = 0;
var currentdate = 0;
currentdate = new Date();
whichad = currentdate.getTime();
whichad = (whichad/10) % 3;
if (whichad==1) {
document.write('
<script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxxxxxxxxxx";
google_ad_width = 120;
google_ad_height = 90;
google_ad_format = "120x90_0ads_al_s";
google_ad_channel ="7187255059";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "3333FF";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>');
} else {
document.write('<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as";
google_ad_type = "text";
google_ad_channel ="1135773472";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "3333FF";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>');
}
</script>
This would work great, the AdSense code IS put in without modification: Problem... the "< /script >" in the AdSense code stops the script prematurely and ends up writing the rest of the script to the page, not executing it.
Would anyone know of a way around this without violating the TOS?
Thank you
In order to see which combination of colors/ad types would be most profitable, I wanted to make a script that would automatically rotate one adblock between the following...
1)AdLink Block with colors that match the site
2)Adlink Block with colors that Stand Out
3)AdSense Button block with colors that match the site
4)AdSense button block with colors that stand out.
I was going to make a channel for each and have the script randomly serve one of these 4. At the end of the month, which ever ad type made the most money was going to get that spot.
Why not use php? The server I host on is not what you might call High End and the scripts that I run are server intensive. As a result, I use a squid proxy to caching. This way a page is only generated once, until it is updated, then cached and served from memory, which means a php randomizer wouldn't work.
I tried to do something like this....
<script language="JavaScript" type="text/javascript">
var whichad = 0;
var currentdate = 0;
currentdate = new Date();
whichad = currentdate.getTime();
whichad = (whichad/10) % 3;
if (whichad==1) {
document.write('
<script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxxxxxxxxxx";
google_ad_width = 120;
google_ad_height = 90;
google_ad_format = "120x90_0ads_al_s";
google_ad_channel ="7187255059";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "3333FF";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>');
} else {
document.write('<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as";
google_ad_type = "text";
google_ad_channel ="1135773472";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_url = "3333FF";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>');
}
</script>
This would work great, the AdSense code IS put in without modification: Problem... the "< /script >" in the AdSense code stops the script prematurely and ends up writing the rest of the script to the page, not executing it.
Would anyone know of a way around this without violating the TOS?
Thank you