1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

adSense color rotator

Discussion in 'C#' started by lonecrow, May 20, 2005.

  1. #1
    I have posted an ASP color rotator that will rotate through all 28 of G's predefined color schemes. Not genius level programming but maybe someone will find it useful.
    SEMrush
    You can easily add new color schemes and convert it to whatever scripting language you use.

    adSense Color Rotator

    Cheers
     
    lonecrow, May 20, 2005 IP
    SEMrush
  2. fryman

    fryman Kiss my rep

    Messages:
    9,605
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #2
    I don't think Google would like to see people playing around with their ads like that.

    They offer to rotate the ads with 3 different colors, anything over that may violate their TOS
     
    fryman, May 20, 2005 IP
  3. Epica

    Epica Peon

    Messages:
    1,007
    Likes Received:
    95
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Funny Digital Point employs some sort of color rotation script.

    Juts refresh your browser a bout 5-6 time...notice you get 4,5,6,7 different color schemes...? I'd saw Shawn already implemented something like this.
     
    Epica, May 20, 2005 IP
  4. Tuning

    Tuning Well-Known Member

    Messages:
    1,005
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    138
    #4
    I think its simple using a php script with full adcode. Note that here fulladcode implies full adsense code that you get from adsense cp.
    <?php
    $code=rand(1,X);
    switch ($code)
    {
    	case 1:
    		print "full adcode1";
    		break;
    
    	case 2:
    		print "full adcode2";
    		break;
    
    	case 3:
    	print "full adcode3";
    		break;
    		.
    	    .
    		.
    		.
    		.
    		.
    		.
    		.
    		.
    		.	
    	case X :
    	print "full adcodeX";
    		break;
    	
    }
    ?>
    Code (markup):
    I think using full adcode won't violate TOS
     
    Tuning, May 20, 2005 IP
  5. Imran

    Imran Notable Member

    Messages:
    2,343
    Likes Received:
    191
    Best Answers:
    0
    Trophy Points:
    230
    #5
    I tried your script, but its not working.
     
    Imran, May 21, 2005 IP
  6. pcdoc

    pcdoc Active Member

    Messages:
    690
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    70
    #6
    But what about

    from here

    seems to make (Ad)sense to me.
     
    pcdoc, May 21, 2005 IP
  7. Imran

    Imran Notable Member

    Messages:
    2,343
    Likes Received:
    191
    Best Answers:
    0
    Trophy Points:
    230
    #7
    In a adsense.txt
    put all the google ads separated by '~' without quotes as a delimiter! Thats it
    and put the below code into your php file, remember the path for adsense.txt must be correct.

    //opening the text file, if this line gives you error when compiling
    //the code then you need to chmod 755 your text file
    $fcontents = join ('', file ('adsense.txt'));

    //Spliting contents of file by looking for ~ mark between codes
    //and storing everything into an array.
    $s_con = split("~",$fcontents);

    //getting a random number which will be within the limit of the
    //contents of the file, means if 5 different banners/ads then the number
    //will be between 0-4 (total 5 )
    $banner_no = (rand()%(count($s_con)-1));

    //simple scho banner
    echo $s_con[$banner_no];

    you can see the example of this @
    http://winkeyfinder.com/imran
     
    Imran, May 21, 2005 IP
  8. FreeFox

    FreeFox Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nice tread!
     
    FreeFox, May 21, 2005 IP
  9. minstrel

    minstrel Illustrious Member

    Messages:
    15,082
    Likes Received:
    1,243
    Best Answers:
    0
    Trophy Points:
    480
    #9
    Thanks, FF... those are new Bridgestones :D
     
    minstrel, May 21, 2005 IP
  10. honey

    honey Prominent Member

    Messages:
    15,556
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #10
    Looks good to me, I will try it. Thanks.
     
    honey, May 21, 2005 IP
  11. tbarr60

    tbarr60 Notable Member

    Messages:
    3,457
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    210
    #11
    I went away from rotating colors to matching the color scheme of my site a while back. I think I got about a 50% improvement in CTR. Rotating the colors seemed to make the ads stand out as ads whereas blending into the site makes the visitor more likely to read the ads like other copy on the site and click on the ad links.

    If you could write a script that reports back which colors work that would be good.
     
    tbarr60, May 21, 2005 IP
  12. Gede

    Gede Peon

    Messages:
    141
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Ok.

    Create an x number of color combinations, and for this same number create so many channels.

    Put all the combinations in an array, sit back for a week or what and see what channel does best.

    And here is your PHP script that displays ads with random different combinations:

    Name your channels something like blue_ad, green_ad, blended_ad etc...

    Here there are just 3 combinations, but it can be much more of course

    <?
    $col_bor[1][1]="1234567890" ; // channel
    $col_bor[1][2]="FFFFFF" ; // color border;
    $col_bor[1][3]="FFFFFF" ; // color background;
    $col_bor[1][4]="000000" ; // color link
    $col_bor[1][5]="333333" ; // color url
    $col_bor[1][6]="555555" ; // color text
    
    $col_bor[2][1]="1234567890" ; 
    $col_bor[2][2]="000000" ; 
    $col_bor[2][3]="000000" ; 
    $col_bor[2][4]="501090" ; 
    $col_bor[2][5]="232323" ; 
    $col_bor[2][6]="808000" ; 
    
    $col_bor[3][1]="1234567890" ; 
    $col_bor[3][2]="602378" ; 
    $col_bor[3][3]="451267" ; 
    $col_bor[3][4]="121212" ; 
    $col_bor[3][5]="008000" ; 
    $col_bor[3][6]="800030" ; 
    
    $the_nr=rand(1,3); //  change the 3 to how many combinations your have created above
    ?>
    
    <script type="text/javascript"><!--
    google_ad_client = "pub-xxxxxxxxxxxxxxxxxx";
    google_alternate_ad_url = "";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text_image";
    google_ad_channel ="<? print $col_bor[$the_nr][1] ; ?>";
    google_color_border = "<? print $col_bor[$the_nr][2] ; ?>";
    google_color_bg = "<? print $col_bor[$the_nr][3] ; ?>";
    google_color_link = "<? print $col_bor[$the_nr][4] ; ?>";
    google_color_url = "<? print $col_bor[$the_nr][5] ; ?>";
    google_color_text = "<? print $col_bor[$the_nr][6] ; ?>";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    Code (markup):
    :)
     
    Gede, May 21, 2005 IP
  13. Tuning

    Tuning Well-Known Member

    Messages:
    1,005
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    138
    #13
    Sorry forgot to tell you that you have to replace all " with \"

    Regards,
    Tuning
     
    Tuning, May 21, 2005 IP
  14. lonecrow

    lonecrow Peon

    Messages:
    99
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I don't think they care about the server side stuff and I am not modifying the client side code at all.
    I'm not doing this: xxx_color="[ffffff,000000,ffffff,000000,ffffff,000000,ffffff];"

    Their script will take a single color or an array of 4 colors. I am only setting a single color but doing it dynamically.

    But thanks, If someone thinks I'm treading the line I wanna hear about it. My AS account is too important to fool around with.
     
    lonecrow, May 22, 2005 IP
  15. Gede

    Gede Peon

    Messages:
    141
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #15
    I don't think there is an objection to dynamicly change colors...

    But :

    Undue attention...

    Suppose my page is kinda greyish, and the google link is purple, or red, would that be a reason to warn me, or cancel my account???

    I just have a color rotation working on my (greyish) forum.

    http://www.vierstra.com/forum/
     
    Gede, May 22, 2005 IP
  16. Imran

    Imran Notable Member

    Messages:
    2,343
    Likes Received:
    191
    Best Answers:
    0
    Trophy Points:
    230
    #16
    I dont think so, what google does'nt wanna see is, webmaster's asking visitors to click on ads. After all we are just using same color codes given by Google, thing is that load a different one each time a page loads.
     
    Imran, May 22, 2005 IP