≡ Menu

Add Adsense code manually or use a plugin is better?

This article is writen from my personal experience in adding Adsense codes, as you would invariably see the my following sites:

And some other sites that I planned in the pipeline. For all these sites, I’ve chosen to manually insert the codes.

If you are using a free hosting from WordPress (that is your website ends with www.website-name.wordpress.com), you will not be allowed to put in any advsertisement. But if you are like me, paying for your own domain name and hosting but using WordPress template for your blog, then you can put advertisement.

My Experience with Adsense plugin

Like most html challenged individual out there, I do my best to avoid dealing with codes unless I have to. So I was happy when I discovered that there are Adsense plugins available at http://wordpress.org/extend/plugins/– you can search using “Adsense” as the search word.

Initially, I have downloaded the All in One Adsense and YPN Plugin for this blog and my Health Blog which had thought will simplify the process. All I have to do is to download the plugin to my PC, then upload via domains> wp-content> plugins folder in my hosting.

After downloading and activating this plugin for all my 3 blogs above, I noticed something was not right. So I googled “All in One Adsense and YPN Plugin” and came up with this post: All in One Adsense and YPN Is NOT Free. Now, appearently the developer of the plugin had programmed the plugin to channel some earnings into his own Adsense account. Some were not happy, since it is implied that the plugin is free and it is not mentioned that the developer will earn anything from the plugin.

Still, the plugin is really good because you need not insert any codes- you can manage the way your Ads are displayed- at the center, bottom right, how many ads, what size, etc. The developer had spent a considerable amount of time working on the plugin but most would rather just pay an upfront fee instead of having some percentage of earning going to the developer.

That’s why before you download anything, it is advisable to google on the program/software/plugin that you intend to use/download to check on reviews by others. Many others who have used it before you will be posting their experience or asking questions. Imagine if you have 10 sites or more and happily download a plugin for each of the site just to realise that it does not work- it will be a waste of time.

Next, I’ve tried to download the “Adsense Manager” but could not really figure out how it works- or maybe I was too tried from this download/upload/reading instruction thing.

Manually Inserting Code

What you see in this blog is the result of me manually inserting the codes in the following: Designs> Theme Editor under:

  • Single Post (single.php) – this will be where individual post shows up
  • Footer (footer.php)

Caution: Always backup your default template- either copy paste the entire html script into a word or a notepad document. This is to ensure that if you accidentally delete any default codes while experimenting with different Adsense sizes, you will not lose the original format or risk having your website looking funny.


Getting your Adsense Code

You need to get the Adsense code from your Adsense account> Manage Ads. Basically you select the type of ads according to the size, type (text and whether combined with image or not) and colour- for each type you select, an identifying code will be generated. The script looks something like below:

<script type=”text/javascript”><!–
google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
/* 336×280, created MM/DD/YY */
google_ad_slot = “99999999999”;
google_ad_width = 336;
google_ad_height = 280;
<script type=”text/javascript”

Then at your blog account, at the Theme Editor under Single.php tab, you need to insert the ads for it to appear on individual blog pages. If you would like your Ads to appear right after the title, at the single.php, find the line that has something like ‘php the_title’, then insert your Adsense code (the code is something like the code in grey font above) below as shown below:

<div class=”post” id=”post-<?php the_ID(); ?>”>



                   <h2><?php the_title(); ?></h2>

<your Adsense code here>

                <div class=”entry”>

                                                <?php the_content(‘<p class=”serif”>Read the rest of this entry &raquo;</p>’); ?>

If you like your ads to appear below the post, then insert after the ‘php the_content’ sentence:

<div class=”post” id=”post-<?php the_ID(); ?>”>



                   <h2><?php the_title(); ?></h2>

                <div class=”entry”>

                                                <?php the_content(‘<p class=”serif”>Read the rest of this entry &raquo;</p>’); ?>

<your Adsense code here>


Play around with different ad sizes- after you save your updates, go to your website/blog and view the changes. Sometimes the ads does not display correctly- you need to experiment till you find the correct combination. I noticed the “Text and Image ads” gives an error message on some posts.

The same Adsense codes can be used for different blogs.

Disadvantage of manually inserting code via the Theme Editor:

  • if you are not familar with html and want to keep things simple- you can only either make the ads appear before or after your blog post and not in-between post sentences. If you want the ads to appear in between your post sentences, you need to google for sites that offer this tip- usually you insert a standard code at a Theme Editor and manually inserting the ad at certain locations in your post via the HTML editor on your blog post editor (do not use the visual editor).
  • when you change the theme, ie the look of your website, you have to manually insert your codes again via the Theme Editor. But if you use an Adsense Plugin, you need not manually insert the codes- but if you change your theme, you may also need to adjust the size/colour of the ad to suit the new theme.

And after you add the ads into your site, remember to go to your Adsense Account to add in the url of your site.

1. Adsense Account> Overview

2. Click on  Adsense for Content> Top Channels> Click on ‘View Adsense for Content channels’

3. Under ‘Channel Data’ on your right, click on “manage channels”. Then under ‘url channel’, click on ‘+ Add new custom channels’.

Hope this helps.

If you like this post, say thanks by sharing it:
  • acnecare September 26, 2009, 12:10 am

    i am a beginner in monetizing my blog with Adsense. i still need to learn more about the tips and tricks on Adsense. hopefully i might be able to earn a decent amount of cash on Adsense.

    • Yin Teing September 26, 2009, 9:48 am

      Hi Acnecare,
      I am sure if you invest in a site or blog that helps people to solve their problems and if you have genuine interest in the long run, it will be possible.

  • kevin Lim October 2, 2009, 9:48 pm

    Thank you very much for your help. You explanations are simply great. Luv Ya !!!

  • Yin Teing October 2, 2009, 10:10 pm

    Thanks for dropping by and glad the article has helped you. Have a great weekend.

  • Joint88 October 13, 2009, 10:49 pm

    Adsense is my main source of income when making money online. nothing beats adsense when it comes to making money online.

Leave a Comment

+ 8 = 10