27
Sep 2006
How To Randomize Adsense Colors
Posted in adsense Tips and news by lijogk at 6:03 pm |

Hi hereis how you can randomiza the adsense ad colour format . this is just a simple php function. every coder can code it in under a minute, but i’m writing this for those who can’t I coded it for myself, and thought some may find it useful.

what does it do:
it randomizes any color of your ads for each visitor, each time.

what you will need:
1. a host that supports php

steps
1. add this function to wherever your functions are, or to the page you have adsense ads.

Code:
function randomcolor() { $r = rand(0, 200); $g = rand(0, 200); $b = rand(0, 200); $colorcode = base_convert($r, 10, 16).base_convert($g, 10, 16).base_convert($b, 10, 16); echo($colorcode); }

2. when adding your adsense code, edit it like this:

Code:
google_color_border = “FFFFFF”; google_color_bg = “FFFFFF”; google_color_link = “”; google_color_text = “000000″; google_color_url = “000000″;

you can apply to any other color codes as you wish. but be advised that, currently it is optimized for white background. if you wish to change it, you may need to edit those 3 lines:

Code:
$r = rand(0, 200); $g = rand(0, 200); $b = rand(0, 200);

they generate colors which are not so close to white, so that google will not use default colors instead of yours.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply