Displaying Google Adsense in Blogs

Written by surender, under Adsense
64 Comments

affiliate_dollarsGoogle® Adsense® can be a great tool for making money. Blogs are also becoming a great tool for making money. Many people know that the most profitable position to place Google® Adsense® ads is inline with your article text. The dilemna many of us face is that the Google® Adsense® Terms of Service only allow 3 ad blocks per page. The reason this is a problem for bloggers is that most blogs show more than three posts on the main page or in the archives section of the site. When this is the case you can’t post an article Google® Adsense® in the article.

While setting up my wife and her friend’s new site (www.naturalfamilynews.com), I came up with a trick using JavaScript to fix that problem. The code I wrote works perfectly in WordPress, but you should be able to adapt it to any blog that uses templates.

Step 1. In the head section of the template (between the and tags), you insert the following JavaScript code:

Step 2. Go to the template used to display your post (in WordPress the main template). Then insert the following code inside the display area for the post:

Step 3 Insert your Google® Adsense® code directly following the tag that you inserted in Step 2 above.

Step 4 Insert the following code after the tag from the Google® Adsense® code you inserted in step 3 :

Step 5. Save your changes and test it out.

What this does is create a new DIV section in your code that is hidden if it appears more than three times on the page. So only three ads will appear on any page. If you use Google® Adsense® in other places in your blog, then you will need to adjust the number “temp” in the first step up to display less inline ads. For instance, only two inline ads will appear if you change the code to:

Only one inline ad will appear if you change it to:

Leave a Reply

64 Responses to “Displaying Google Adsense in Blogs”

  1. Comment by surender

    टेस्त्

  2. Comment by surender

    test comments

  3. Comment by WADE


    CheapTabletsOnline.Com. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. High quality pills. Buy drugs online

    Buy:Prednisolone.100% Pure Okinawan Coral Calcium.Human Growth Hormone.Nexium.Lumigan.Zyban.Synthroid.Petcam (Metacam) Oral Suspension.Accutane.Arimidex.Valtrex.Zovirax.Prevacid.Actos.Mega Hoodia.Retin-A….

  4. Comment by CHARLIE

    ████████►BUY CIALIS◀████████…

    ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲…

  5. Comment by LONNIE

    abilify side effects in children

    Buydrugs without prescription…

  6. Comment by JEFFREY

    cephalexin dosage for dogs

    Buygeneric drugs…

  7. Comment by RICARDO

    fosamax@actonel.now” rel=”nofollow”>.

    Buynow…

  8. Comment by EUGENE

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  9. Comment by SERGIO

    allopurinol@and.coumadin” rel=”nofollow”>…

    Buygeneric drugs…

  10. Comment by KELLY

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  11. Comment by CHRISTIAN

    Avelox@official.site” rel=”nofollow”>…

    Buyno prescription…

  12. Comment by LARRY

    ..

    Buygeneric drugs…

  13. Comment by JEROME

    ashwagandha@supplement.now” rel=”nofollow”>…

    Buygeneric meds…

  14. Comment by SIDNEY

    atarax@and.hives” rel=”nofollow”>.

    Buygeneric drugs…

  15. Comment by ALBERTO

    Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  16. Comment by RICK

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  17. Comment by CECIL

    Chantix@official.site” rel=”nofollow”>.

    Buydrugs without prescription…

  18. Comment by LUKE

    Abana@official.site” rel=”nofollow”>.

    Buynow it…

  19. Comment by KIRK

    Depakote@official.site” rel=”nofollow”>…

    Buyit now…

  20. Comment by DENNIS

    Depakote@official.site” rel=”nofollow”>.

    Buygeneric drugs…

  21. Comment by PHILIP

    side effects zyprexa overdose breathing autonomic

    Buyno prescription…

  22. Comment by CLINTON

    Zocor

    Buygeneric meds…

  23. Comment by ARTHUR

    other names for trazodone

    Buyno prescription…

  24. Comment by LONNIE

    quinapril

    Buyit now…

  25. Comment by REGINALD

    dog zyrtec

    Buygeneric drugs…

  26. Comment by DANIEL

    xopenex coupon

    Buyno prescription…

  27. Comment by RONNIE

    zyprexa increase eps complaints

    Buyno prescription…

  28. Comment by NEIL

    Zocor

    Buygeneric drugs…

  29. Comment by STUART

    Vytorin

    Buynow…

  30. Comment by KARL

    Vitamin B

    Buydrugs without prescription…

  31. Comment by ALFONSO

    Zyvox

    Buydrugs without prescription…

  32. Comment by CHRIS

    Rogaine

    Buygeneric meds…

  33. Comment by FERNANDO

    Rogaine

    Buyno prescription…

  34. Comment by KELLY

    Retin A

    Buygeneric drugs…

  35. Comment by RAFAEL

    Eye Drops

    Buynow…

  36. Comment by STEVEN

    Risperdal

    Buygeneric meds…

  37. Comment by ANDRE

    Seroquel

    Buywithout prescription…

  38. Comment by TERRANCE

    howard county purim carnival 2010

    Buyno prescription…

  39. Comment by VIRGIL

    Synthroid

    Buywithout prescription…

  40. Comment by OTIS

    how much benadryl to take with zyrtec

    Buydrugs without prescription…

  41. Comment by TYRONE

    Zyprexa

    Buyno prescription…

  42. Comment by JULIO

    savella cheap canada

    Buyno prescription…

  43. Comment by ROBERTO

    low dose haldol and paxil

    Buygeneric drugs…

  44. Comment by ADRIAN

    Pyridium@Pyridium.Pyridium” rel=”nofollow”>…

    Buygeneric meds…

  45. Comment by JULIO

    Synthroid@Synthroid.Synthroid” rel=”nofollow”>.

    Buynow it…

  46. Comment by JIMMIE

    Prozac@Prozac.Prozac” rel=”nofollow”>…

    Buynow…

  47. Comment by CLAUDE

    Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  48. Comment by EARL

    Pulmicort@Pulmicort.Pulmicort” rel=”nofollow”>..

    Buyit now…

  49. Comment by GEORGE

    Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  50. Comment by ERIK

    Sleep@Tea.now” rel=”nofollow”>..

    Buyno prescription…

  51. Comment by JIMMY

    Prozac@Prozac.Prozac” rel=”nofollow”>…

    Buygeneric drugs…

  52. Comment by SAM

    Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  53. Comment by WILLIE

    Strattera@Strattera.Strattera” rel=”nofollow”>…

    Buynow it…

  54. Comment by EDGAR

    Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  55. Comment by TYRONE

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  56. Comment by LUKE

    Cialis@Cialis.Cialis” rel=”nofollow”>..

    Buyno prescription…

  57. Comment by DONALD

    Buywithout prescription…

  58. Comment by MANUEL

    allegra@print.colorado.springs” rel=”nofollow”>…

    Buygeneric drugs…

  59. Comment by GEORGE

    .

    Buyno prescription…

  60. Comment by WARREN

    .

    Buywithout prescription…

  61. Comment by KIRK

    alternatives@to.premarin” rel=”nofollow”>…

    Buygeneric pills…

  62. Comment by ADRIAN

    altace@generic.name” rel=”nofollow”>.

    Buynow it…

  63. Comment by JAIME

    Buygeneric drugs…

  64. Comment by JIMMY

    wholesale@ginseng.root” rel=”nofollow”>…

    Buyno prescription…