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.

Random Color AdSense Script

Discussion in 'Placement / Reviews / Examples' started by emil2k, Dec 28, 2005.

  1. #1
    Can somebody please give me a script where I can control the probability that a certain background and border color is chosen for the adsense ad kind of like DP...

    The background and border should match each other meaning when randomly chosen it would be both a predetermined background color and background...

    Thanks
     
    emil2k, Dec 28, 2005 IP
  2. andriusk

    andriusk Well-Known Member

    Messages:
    367
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    140
    #2
    phpAdsNew would be able to help you in this, but maybe someone will suggest any other smaller script
     
    andriusk, Dec 28, 2005 IP
  3. samsam

    samsam Peon

    Messages:
    647
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That is free from Google. Just select UPTO four ad color layouts by pressing alt, and use the generated code. You are all set.
     
    samsam, Dec 28, 2005 IP
  4. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #4
    I dont know what you are talking about but I doubght it comes with adsense...

    The alternative color is completely different from what im asking...:confused:
     
    emil2k, Dec 28, 2005 IP
  5. Friend

    Friend Peon

    Messages:
    474
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #5
    no script needed....

    in the adsense code section....
    Press shift and select multiple color pallets...
    it works for me
     
    Friend, Dec 28, 2005 IP
  6. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #6
    What and then it randomly chooses which one comes up?
     
    emil2k, Dec 28, 2005 IP
  7. Friend

    Friend Peon

    Messages:
    474
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #7
    for every page load...
    the colors are randomly changed...
     
    Friend, Dec 28, 2005 IP
  8. Indian

    Indian Peon

    Messages:
    1,572
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I can help u with this but I will have to consult my frnd Imran for that.....its better u directly PM him here on his id 'Imran' & get ur stuff ASAP ...Good
    Luck!!!!


    P.N: I am saying this cos I hv seen him do it...also if u search some threads here u can find his post. :)
     
    Indian, Dec 28, 2005 IP
  9. samsam

    samsam Peon

    Messages:
    647
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #9
    exactly. That is what I said.
     
    samsam, Dec 29, 2005 IP
  10. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #10
    ok well i got it working with that the only problem is i want to control the probabillity of the styles for example...

    green 7/10
    red 3/10
     
    emil2k, Dec 29, 2005 IP
  11. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #11
    Could you post the sample of generated adsense code please. Offcourse, don't post your pub id and channel info

    tia
     
    dshah, Jan 1, 2006 IP
  12. Nokia999

    Nokia999 Guest

    Messages:
    1,488
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    0
    #12
    are you using PhP ?
     
    Nokia999, Jan 1, 2006 IP
  13. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #13
    Yes, I was thinking maybe some sort of switch statement with a number generated randomly and then used to make a decision...
     
    emil2k, Jan 2, 2006 IP
  14. Friend

    Friend Peon

    Messages:
    474
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #14
    <script type="text/javascript"><!--
    google_ad_client = "xxxxxxxxxxxxxx";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text_image";
    google_ad_channel ="";
    google_color_border = ["336699","000000","B4D0DC","A8DDA0"];
    google_color_bg = ["FFFFFF","F0F0F0","ECF8FF","EBFFED"];
    google_color_link = ["0000FF","0000FF","0000CC","0000CC"];
    google_color_url = "008000";
    google_color_text = ["000000","000000","6F6F6F","6F6F6F"];
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    Code (markup):
     
    Friend, Jan 2, 2006 IP
    dshah likes this.
  15. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #15
    Thanks a lot!
     
    dshah, Jan 2, 2006 IP
  16. Friend

    Friend Peon

    Messages:
    474
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #16
    No prob...
    Above i posted are standared color pallets of Adsense
    If you need custom color pallets...
    make more custom color pallets on adsense 'Ad Color'
    then multi select them in "Ad layout code ---> Color palettes "
     
    Friend, Jan 2, 2006 IP
  17. eKstreme

    eKstreme Guest

    Messages:
    131
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I do this in PHP to test different ad formats. The "framework" code I use is this:

    
    <?php
    mt_srand();
    $r = mt_rand(1,100);
    
    if($r<=70){
    ?>
    //red advert
    <?php
    }
    elseif($r<=90){
    ?>
    //green advert
    <?php
    }
    else{
    ?>
    //blue advert
    <?php
    }
    
    Code (markup):
    Of course, track each advert type with a channel :)

    Hope this helps.
     
    eKstreme, Jan 4, 2006 IP
  18. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #18
    Hey ekstreme, this is what i was looking for...so I just paste the full code for each color were you put //advert and thats it...
     
    emil2k, Jan 4, 2006 IP
  19. eKstreme

    eKstreme Guest

    Messages:
    131
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Yep, exactly: paste in the Javascript as it comes from AdSense. Also, you can change the numbers in the if/elseif statements to change the likelihood each advert is displayed.

    I'm writing a tutorial about this as we speak! I'll post the URL later if anyone's interested :)
     
    eKstreme, Jan 4, 2006 IP
    emil2k likes this.
  20. play

    play Peon

    Messages:
    73
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Dont know any script .. but i think 7/10 its almost 2/3 so you are alowed to use 4 diffrent Color palettes with Adsense then make 2 palette with green and one with red and will rotate randomly on your web page.
     
    play, Jan 4, 2006 IP