Contact: Web / Voice / Email / Tips
Simple Thoughts Blog - Java and Web Technologies

Simple solutions for complex problems.

 

How To Display AdSense & Yahoo Publisher Ads Using AdRotator Plugin for WordPress

August 30th, 2006 by Angsuman Chakraborty

AdRotator is a WordPress plugin which you can used to randomly rotate your ads (including but not limited to AdSense, Yahoo Publisher Network, Clicksor, Chitika etc.) on WordPress blogs. It allows you to display an advertisement (which is randomly selected from a group of advertisements specified in a text file) at your chosen location. The most frequent question I get is how you can use it to display AdSense ads, with an example.

AdRotator plugin can be used to easily rotate between AdSense, Yahoo Publisher Network ads and any other javascript based ad codes in combination and in a single file. There is however a small trick to it. You need to compress the ad code in a single line. Let me illustrate with an AdSense example.

Suppose your adsense ad is as follows:
<script type="text/javascript"><!–
google_ad_client = "pub-xxxx";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728×15_0ads_al_s";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "9C0000";
google_color_url = "9C0000";
google_color_text = "000000";
//–></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Then you need to reformat it as below:
<script type="text/javascript">google_ad_client = "pub-xxxx";google_ad_width = 728;google_ad_height = 15;google_ad_format = "728×15_0ads_al_s";google_ad_channel ="";google_color_border = "FFFFFF";google_color_bg = "FFFFFF";google_color_link = "9C0000";google_color_url = "9C0000";google_color_text = "000000";</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Note: The above code is in a single line. Place as many as such ad codes in a single file and you can rotate between them.

This idea can be used with Yahoo ads and any other javascript based ad codes. If you face problems then you have most likely messed up your ad code somewhere.

Here is another example for other types of ads. You can refer to the AdRotator user manual for further details.

BTW: I am planning to release AdRotator Pro version in about a couple of weeks. It will make it much much simpler to manage your ad-strips, no tricks like above and no need to change your ad code, will allow placing multiple ads from the same file on the same page, without duplication, allow rotating between say Google & Yahoo ads without conflict and tons of advanced options for beginners and pro alike and lots more.


Filed under CMS Software, Headline News, How To, Pro Blogging, Tech Note, Web, Web Services, WordPress | | RSS 2.0 | Trackback this Article | Email this Article

You may also like to read

»Adding Quotations to Blog
»How To Use AdRotator Within Your WordPress Post / Page
»Get Insulted - Menu: Biblical or North Korean
»Google AdSense versus Yahoo Publisher Network: Review
»WordPress Plugin: AdRotator - Ad Rotating Solution for your Ads (including AdSense, Clicksor, Chitika etc.)
»My 5 AdSense Resolutions For 2008
»Google AdSense Wants Your AdSense Feel Good Story As Publisher
»When Google Gets Cute
»Google AdSense Silently Opts-in Publishers To Online Advertiser Sign-up Program
»Killer Features for Context Sensitive Advertising Systems like Google AdSense, Yahoo Publisher, Chitika etc.
»Google Ventures in Online Video Ads for AdSense
»Congratulations WordPress Plugin Contest Winners & Translator Pro Winner
»How To Reset Google AdSense Password
»Is Google AdSense Losing Its Relevance?
»Google Analytics Increases Default Profiles to 10

6 Responses to “How To Display AdSense & Yahoo Publisher Ads Using AdRotator Plugin for WordPress”

  1. Simone Says:

    Hello Angsuman, I am trying to use your ad rotator
    but I am getting this error.
    Parse error: unexpected T_STRING, expecting ‘,’ or ‘;’ in

    I even tried it like this: with no luck.

    Do you know what it is asking me to adjust?
    Thanks, Simone

  2. Simone Says:

    Hmmmm it wouldn’t include my php include I’ll try it without the brackets.
    These are the two I tried but with php brackets.
    php echo getad ’test1’;
    php echo getad ’test1,test2’;

  3. sakib Says:

    i think this could work on my image hosting site photosharingworld.com

  4. lol Says:

    >then you need to reformat it as below, >

    well it is against google ad terms , what u think abt that ?

  5. Bill Vick Says:

    Can this work in RSS feeds?

  6. Angsuman Chakraborty Says:

    Yes, but you have to modify it. Or you can contact us for developing it for you.

  7. xytheme Says:

    Hey, thanks for this awesome plugin.
    I managed to get it work on my blog.
    The thing is, it doesn’t properly show adsense. Hmm..doesn’t show at all. maybe because of lining up the code in 1 line breaks it.

    Does this work with the new adsense code?

Looking forward to hear your thoughts.



Please enter the code shown below ( to verify that you are human ) before you click Submit Comment.

No. 1 method to ethically increase your blog traffic and reach.

Translate

Translate to EnglishÜbersetzen Sie zum Deutsch/GermanPřeložit do Čech/CzechOversætte hen til Dansk/DanishKääntää jotta Finnish/FinnishLefordít -hoz Magyar/HungarianÞýða til Íslenska/IcelandicTraducir a Latinoamericano Español/Latin American Spanishtagapagsalin sa Filipino/FilipinoTłumaczyć wobec Polski/PolishA traduce la spre Român/RomanianPrevesti za Srpski/Serbiantolmačiti v slovenski/SlovenianÖversätta till Svensk/SwedishChyfieitha at Cymraeg/Welshtercüme etmek -e doğru Türk/TurkishPrevesti to Hrvatski/CroatianПревеждам към Българин/BulgarianTraduzca al Español/SpanishTraduisez au Français/FrenchTraduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese한국어에게 번역하십시오/Korean中文翻译/Chinese Simplifiedترجمة الى العربية/ArabicVertaal aan het Nederlands/DutchΜεταφράστε στα ελληνικά/GreekПереведите к русскому/RussianOversetter til Norsk/Norwegian中文翻译/Chinese TraditionalTraduzir a Língua portuguesa brasileira/Brazilian PortugueseReddo ut Latin/Latin

Taragana Network

»Ctrl-S
»Enterprise Blog
»Free Book on Eye Care by Natural Therapy
»Health Care Blog
»Hot Computer Jobs Blog
»Pet Care & Grooming News and Tips
»Phil Law Blog
»Taragana - Software Outsourcing
»The Angsuman Chakraborty Blog
»The Diabetes Cure Blog
»The Eye Treatment Blog
»The Stem Cell Blog
»Weblog Hosting Blog
"Everything should be made as simple as possible, but not simpler." - Albert Einstein