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> Code (markup): 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
There is an option to use up to 3 color combinations when you create your code in yourt account, check it out, very cool feature. But I don't think you'll be able to track each combination, it is just for rotating colors.
Yeah, I knew about the color rotating, but I wanted them to be completely seperate so I could track them seperatly. At least in the beginning. Thanks though. BTW: The code above is only for 2 of the 4 ads.
I think I would use php over javascript for something like this. The rand() function works nicely for things like that.
pchere I don't mean to rotate ads in the middle of a page view, I mean, each refresh should display a different type of ad, be it a Button ad or AdLinks ad. This is basicly the same changing the colors between page views, which is what php scripts have done already. I'm not sure why this would be against TOS, but, please point me to where it is. I definately do not want to violate the rules. bnaze13 I can't use php because the server I host on is not what you might call High End and the php scripts that I DO 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 every reload. Why not use channels to see which would work best? This is what I -want- to do. I want to set each different ad type on a different channel to see which would do best. But, instead of displaying one for a week, then another for a week, and another for another week, etc, which could take months; instead, I want to make a random type of ad appear on each page load so that this four week process can be cut down to one or two weeks. So if I had an adlink block appear the first time I see the page, when I hit reload, it might be a AdButton the next time. I currently do not see a built in way to do this with the ad creator page. There is a way to rotate colors built in, but unfortunatly, you can't track each color seperatly, which is something else I would like to do. Thanks for all of your input, I am currently exploring other ways of doing this. /Loplin
Perhaps 'rotating' was the wrong word to use. 'Randomizing' would have been more appropriate. I would change the title of the topic if it hadn't been more than 480 minutes already /Loplin