Integrating Adsense in The Body Of Your Post
When blogging, one of the best spots to place your Adsense Ad is in the body of your post.
CashCook.Info receives 75%+ of it’s clicks from the ads that I integrate in the post.
There’s only one problem with those ads. Google Adsense allows no more then 3 Ads on a single page, and with the standard tools Wordpress supplies, on all pages that have more then one post(front page, search results, archives, etc.), all posts that contain Adsense ads will display those ads. Needless to say, eventually you will get banned.
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 3
Warning: include(http://cashcook.info/adsenseskyscraper.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 3
Warning: include() [function.include]: Failed opening ‘http://cashcook.info/adsenseskyscraper.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 3
After searching around the internet, I haven’t found any plugin that deals with the problem, and decided to create a solution myself.
I can say for sure that this solution is not the most elegant solution there is, and maybe creating a plugin would have been the best idea, but I’m the lazy type of a person, never coded a plugin before, and for now did not know all the syntax one needs to learn so that he can write Wordpress plugins.
Enough ranting, let’s see how is it done:
First of all, you’ll need some plugin that will enable you to run PHP code within posts.
I personally use runPHP. It’s very easy to install and use, only annoying part about it, is that you have to tick the option to run PHP code each and every time you write a new post, and I tend to forget that.
Next, create a file in your blog’s home directory called adsense.php, which will include your Google Adsense code.
Now, go to your theme editor, and add the next line in your header, anywhere after the <body> tag:
<?php $GLOBALS["x"]=1; ?>
That’s it, you are done with preparations, and are ready to insert Adsense code within your posts.
Now wherever you want to ad Adsense in your post, ad one of the next codes, according to the number of such ads you want to display per page.
If you display one ad per page, use this code:
<?php
if($GLOBALS["x"]==1){
include “adsense.php”;
$GLOBALS["x"] = 2;
}
?>
If you display two ads per page, use this code:
<?php
if($GLOBALS["x"]==1){
include “adsense.php”;
$GLOBALS["x"] = 2;
}
else if($GLOBALS["x"]==2){
include “adsense.php”;
$GLOBALS["x"] = 3;
}
?>
If you display three ads per page, use this code:
<?php
if($GLOBALS["x"]==1){
include “adsense.php”;
$GLOBALS["x"] = 2;
}
else if($GLOBALS["x"]==2){
include “adsense.php”;
$GLOBALS["x"] = 3;
}
else if($GLOBALS["x"]==3){
include “adsense.php”;
$GLOBALS["x"] = 4;
}
?>
I suggest you write down the appropriate code in a text file, so you can quickly cut and paste it into your code.
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 7
Warning: include(http://cashcook.info/adsenseskyscraper.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 7
Warning: include() [function.include]: Failed opening ‘http://cashcook.info/adsenseskyscraper.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/svarogg/public_html/wp-content/plugins/runPHP/runPHP.php(383) : eval()’d code on line 7
P.S.
Just don’t forget to tick “run PHP code?” each time you write a new post.
Related Reading:
- Top 10 Usefull Wordpress Plugins I Use
- What To Do If Your Blog is Scraped
- How to Increase Your Blog Traffic Quality
- Google Adsense Placing - How to Achieve High CTR Without Breaking Adsense TOS?
Thank you for reading this post. You can now Read Comments (5) or Leave A Trackback.
Post Info
This entry was posted on Wednesday, June 13th, 2007 and is filed under Blogging, Google Adsense.You can follow any responses to this entry through the Comments Feed. You can Leave A Comment, or A Trackback.
Previous Post: What To Do If Your Blog is Scraped »
Next Post: AuctionAds Ten Day Challenge Report - Day #5 »
- Markov Algorithm - The Theory
- CashCook.Info Gone Pro
- I know I promised it today, but…
- Next eBook Soon To Be Released
- A Few Updates for CookBook #1
- Cash CookBook #1 - Cooking Cash With Automated Blogs, Using Free Tools Only!
- Sorry for the postponing
- First Cash CookBook is Out Very Soon
- Nothing to Share
- How To Monetize Your Feed Through Pheedo, While Keeping FeedBurner Tracking Intact


























thx 4 very usefullll post !
cool blog !
i like this post, but i can understand your code because some characters display wrong, i see this:
what means â€xâ€] ?
Thanks for the comment alex!
Something really weird happened to this post, and some of the characters got distorted.
I can only guess what is the cause of this distortion.
Anyway, now things are, hopefully, fixed, and the code is correct.
kuywcgay http://oawjguml.com fiaskqmh qxemrqgd
The wordpress adsense plug in allows only three ads per post or page. I did not find any problems with more than three ads units. Please note: each ads units could contains more ads, up to four!