Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Adjust Google Ad Color To Match Template

    What I am trying to do is make my google ads adjust the background color, link color, text color, etc based on the template selected on my blog.

    Unfortunatly I don't know a lot of Javascript, which is probably the best language for this. I would think the easiest way would be to grab the color from the CSS then store it to a variable and throw it back into the ad code.

    Any help is greatly appreciated, thank you.

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Actually PHP might be the best code to use. BUT:

    You can not change the Google ad code at all without violating the TOS. No custom PHP or Javascript code is to go into the adsense code.

    I did a similiar thing using PHP to change the adsense code to suit my site and Google notified me to change the code back.
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts
    I though maybe there would be a way for JS to take the colors, then insert them as the google variables, and then output the google code. It will still be the same code google puts out, just with the hex colors generated by JS not Google.

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by Riboflavin
    I though maybe there would be a way for JS to take the colors, then insert them as the google variables, and then output the google code. It will still be the same code google puts out, just with the hex colors generated by JS not Google.
    Below is a sample of Google adsense code. You can not replace the hex colors with PHP or JS. The only thing you can do is to switch the entire Google adsense code, OK if you only have a few versions. But if you have 100s of combos then you are out of luck. What google should add to their code is a "no-color" option, which then would match the background color of your site.

    google_color_border = "DDDDDD";
    google_color_bg = "DDDDDD";
    google_color_link = "0000FF";
    google_color_url = "666666";
    Leonard Whistler

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Ok I understand now.


    Just curious how come something like proboards.com does this on all there forums?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •