Adsense inline with WordPress blog posts

I was reading this book about optimizing Google’s Adsense (What Google Never Told You About Making Money with AdSense!). In it, Joel Comm describes how he went from $900/month in Adsense revenue to $15,000+/month! Oh, man! It was too juicy to pass up! One of the many things he talks about is integrating your ads into your site. You’ll have to read the book for all the details, but this plug-in should help.

So, I knew I wanted to put Adsense ad blocks in the middle of WordPress posts. I knew I could do it with some simple hacks to WP, but I thought it should be a plugin. It turned out to be remarkably easy to do, and it turned into my first WP plugin. Of course, I “sampled” lots of code from pioneers who went before me.

Adsense — in case you don’t know, is Google’s little advertising engine for non-Google sites. You know when you see Google ads on a site somewhere, and it says “Ads by Gooooogle” or somesuch? That’s it.

Google has some rules about how you place Adsense code on your site, though, and how many Adsense blocks can appear on a page (two?). I haven’t tried to accomodate these rules in this plugin yet. I probably will have to do that down the road. Caveat emptor.

The plugin [download] is pretty straightforward. Put it in your wp-content/plugins directory, then go to your Plugins configuration page and click Activate.

You’ll need to customize the Adsense code in the plugin itself. Look in the adsense.php file. In the first function there’s a block that says “Begin Google Adsense code”. You want to replace the lines between that line and the one that says “End Google Adsense code” with your actual adsense code provided to you by Google. Otherwise, you’ll be showing ads for me. :-)

Once you activate the plugin, you should notice a new button on your Quicktags toolbar. The new button is “Adsense”, and it works like “more”. Click it to insert the Adsense tag, and enjoy the newfound wealth. :-)

Here’s an example:

[Edit: sometimes I see the ads, and sometimes I don't. It's just Google's peskiness. You can view the source and see the ad code is there.]

Because of Google’s policy on multiple ad blocks per page, I recommend that you always place a “more” tag before the “adsense” tag. This way, users will only see the ad if they click the blog entry to see the full thing. Otherwise, you may have several uncontrolled entries on a page all showing the ads. And Google may frown mightily upon you.

919 Responses to “Adsense inline with WordPress blog posts”

  1. [...] Adsense Inline – inserts Google adsense in blog posts. [...]

  2. [...] Adsense Inline: This plugin can display AdSense ads inline with your blog posts. A new Quicklinks button is created. When pressed within a new entry your AdSense ads will be inserted. Remember, Google only allows three ads per page so don’t get too carried away. [...]

  3. [...] Adsense Inline – Plugin Google Adsense ini memungkinkan untuk menampilkan iklan Google Adsense di dalam Posting. [...]

  4. Very nice article, thanks

  5. [...] Adsense Inline – inserts Google adsense in blog posts. [...]

  6. Imran Yousaf says:

    every time i need to insert code

    for ad formation. is there any way to integrate this formation in the code and i just need to press the button?

  7. [...] Adsense Inline – Otro plugin que te permite insertar publicidad dentro de los post de forma rápida. [...]

  8. [...] Inline adsense – adsense vložit do blogu [...]

  9. [...] Adsense Inline – This plugin can display AdSense ads inline with your blog posts. A new Quicklinks button is created. When pressed within a new entry your AdSense ads will be inserted. Remember, Google only allows three ads per page so don’t get too carried away. [...]

  10. Very nice article, thanks

  11. [...] Adsense Inline : Otro plugin para Wordpress muy interesante que nos permitirá insertar anuncios de Adsense en Widgets en el sidebar o en el footer de nuestro blog. [...]

  12. First, I am pleased to have the information pentind here. A person who does not understand the HTML code like me, read a serious review, makes my head became dizzy, or may be broken two split. Philhord explained with humor, how to tell with humor, making me keep at his writing with a little careful there is no article that passed through. Thank you for Philhord

  13. i must say, it was interesting to browse trough so many great plugins on your blog. I must bookmark your site now as the stuff here on your site looks to be very helpful.

  14. It is not working on the latest WP version. Do you have an update?

  15. [...] Adsense Inline – 又一个让你轻松在文章插入Adsense的工具. [...]

  16. [...] Adsense Inline – inserts Google adsense in blog posts. [...]

Leave a Reply