homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

    
A vs B testing - Coding Question
steve8383




msg:3033774
 3:09 am on Aug 4, 2006 (gmt 0)

Just got the email from Inside Adsense announcing the A vs B testing. What this means is you can now run 2 different ads side by side, showing one 50% of the time and the other 50% of the time (or whatever frequency you choose)

You can then compare performance and decide which one is the better performer and then test against another style, until you have optimum performance.

I tried to set this up already on my busy forum which has horrendous click thru rate, but having problems with the coding. In accordance with the email instructions this is what I have:

<script type=”text/javascript”>
var random_number = Math.random();
if (random_number < .5){
<!--
google_ad_client = "pub-#*$!#*$!#*$!#*$!xx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7359756599";
google_color_border = "E3F0FB";
google_color_link = "072978";
google_color_bg = "E3F0FB";
google_color_text = "000000";
google_color_url = "000000";
//-->
} else {
<!--
google_ad_client = "pub-#*$!#*$!#*$!#*$!#*$!xx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="1866443525";
google_color_border = "E3F0FB";
google_color_bg = "E3F0FB";
google_color_link = "CC0000";
google_color_text = "CC0000";
google_color_url = "CC0000";
//-->
}
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Can anyone spot the 'deliberate' mistake I've made as no ads at all are showing using the code above?

 

greatstart




msg:3033824
 4:29 am on Aug 4, 2006 (gmt 0)

I found the help on this topic at the AdSense Help Center - [google.com...]

and more info here - [adsense.blogspot.com...]

steve8383




msg:3033830
 4:44 am on Aug 4, 2006 (gmt 0)

Thanks, I read those though and thought I followed the instructions properly. Still can't get it to work though.

I'm pretty simple when it comes to java

jomaxx




msg:3033841
 5:12 am on Aug 4, 2006 (gmt 0)

I'm far from a Javascript guru but I don't think those begin/end comments tags should be within the Javascript code.

jurii




msg:3033950
 8:17 am on Aug 4, 2006 (gmt 0)

Do you have any errors in your Javascript Console?

Open the page with Firefox and type javascript: in the address bar. You will get errors with Adsense anyway, but look for any more errors.

And try this:

<script type=”text/javascript”>
<!--
var random_number = Math.random();
if (random_number < .5){
google_ad_client = "pub-#*$!#*$!#*$!#*$!xx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7359756599";
google_color_border = "E3F0FB";
google_color_link = "072978";
google_color_bg = "E3F0FB";
google_color_text = "000000";
google_color_url = "000000";
} else {
google_ad_client = "pub-#*$!#*$!#*$!#*$!#*$!xx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="1866443525";
google_color_border = "E3F0FB";
google_color_bg = "E3F0FB";
google_color_link = "CC0000";
google_color_text = "CC0000";
google_color_url = "CC0000";
}
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

esllou




msg:3039816
 12:02 pm on Aug 9, 2006 (gmt 0)

I am trying to set this up to and used the code posted by jurii to no avail....still not getting any ads showing and FF reports the following JS error:

"b has no properties"

has anyone got this running?

I've now posted on the Adsense G Group board and will see if I get any help there.

Rodney




msg:3040905
 6:50 am on Aug 10, 2006 (gmt 0)

I tried the code jurii posted (and tried different variations of the code the adsense team recommended), but I can't get it to work either.

Anybody?

esllou




msg:3041110
 12:19 pm on Aug 10, 2006 (gmt 0)

I've cracked it, by jove!

look at the quotation marks in the first line of code..the forum must have mangled them. I put in normal ones and it seems to be working.

Is it possible to do A/B/C testing?

How would I change this:

if (random_number < .5){

CarKnee




msg:3041123
 12:26 pm on Aug 10, 2006 (gmt 0)

A/B/C testing:
The random number is always (slightly) less than 1. Therefore the A/B testing is assuming that 1/2 the time you will get a random number <.5 and the other 1/2 will get you a number >.5

To do A/B/C just split up .9 into thirds.

if (random_number < .33)
{
// A
}
else if (random_number >= .33 && random_number < .66)
{
//B
}
else
{
//C
}

*** This has not been tested.

Bddmed




msg:3041128
 12:29 pm on Aug 10, 2006 (gmt 0)

look at the quotation marks in the first line of code

The adsense blog also has the wrong quotation marks.

Thanks for the solution.

Rodney




msg:3041589
 6:19 pm on Aug 10, 2006 (gmt 0)

Brilliant detective work, esllou! Thanks for posting the fix!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved