Welcome to WebmasterWorld Guest from 54.162.205.151

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

A vs B testing - Coding Question

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

New User

10+ Year Member

joined:May 14, 2006
posts:34
votes: 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?

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 11, 2005
posts:668
votes: 0


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

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

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

New User

10+ Year Member

joined:May 14, 2006
posts:34
votes: 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

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

Senior Member

WebmasterWorld Senior Member jomaxx is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 6, 2002
posts:4768
votes: 0


I'm far from a Javascript guru but I don't think those begin/end comments tags should be within the Javascript code.
8:17 am on Aug 4, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 19, 2002
posts:134
votes: 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>

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 27, 2003
posts:835
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 24, 2002
posts:1209
votes: 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?

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 27, 2003
posts:835
votes: 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){

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

New User

10+ Year Member

joined:Aug 16, 2005
posts:6
votes: 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.

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

Preferred Member

10+ Year Member

joined:Jan 24, 2005
posts:528
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 24, 2002
posts:1209
votes: 0


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