Skip to main content

Add Banner Adsense Above Blogger Header

One of my readers asked me how to add a Google Adsense ad unit above the header of a Blogger Blogspot blog. Rather than post a long reply I decided to write an article about it so that others looking for help to place an affiliate banner or Google Adsense banner at the top of their blog will find the solution more easily.

To set up Blogger so that ad units can be placed above the header requires the addition of a snippet of code to your Blogger Template. I have aimed this tutorial at beginners and newbies to Blogger. The tweak can be performed in less than 5 minutes.

How to Add Google Adsense or an Affiliate Banner Above Blogger Blogspot Header
How to Add a Google Adsense Ad Unit or an Affiliate Banner Above the Blogger Header

1. Login to Blogger if not already logged in

2. Navigate to Layout > Edit HTML

3. As a precaution back up your template by downloading the full template to your computer

4. Tick the Expand Widget Templates box

5. Using CTRL + F to bring up the search box find this line which in most templates will be directly after <body> tag

<div id='outer-wrapper'>

6. Paste this block of code after this line to create a new section

<div id='topads-wrapper'>
<b:section class='topads' id='topads' preferred='yes'/>
</div>

7. Next we need to add some CSS styling to the new section. Please note that the banner will be centered by default. If you want to change the alignment for some reason you just need to change the CSS styling.

Place the following code in the head section of your template before these lines:
]]></b:skin>
</head>


/* Top Ads
----------------------------------------------- */
#topads-wrapper {
margin: 0;
padding: 0;
position: relative;
text-align: center;
width: 100%;
}

#topads {margin: 0; padding: 0;}

#topads .widget {margin: 0; padding: 5px 0;}

8. Click the Save Template button

9. Go to Layout > Page Elements

10. You will now see that you can add a gadget to a new section above your header and directly below the navbar.

11. To Add a Google Adsense Ad Unit
Click on Add a Gadget and choose your desired Google Adsense ad unit. If you are uncertain how to add a Google Adsense ad unit to Blogger read my article Google Adsense Tips for Blogger Blogs

To Add an Affiliate Banner
Or if you want to add an affiliate banner then you would click on Add a Gadget and choose a HTML/Javascript widget from the list of gadgets available in the menu. You would then paste the affiliate banner code into the content box in the popup window and save your changes. Click on View Blog and you will see your new banner displayed above your blog's header. For more detailed instructions about adding affiliate banners to a Blogger Blogspot blog please refer to my article Add an Affiliate Banner to the Blogger Sidebar


Tips and Troubleshooting
  • If you wish to add more than one widget to the section you will need to change the template code:

    from
    <b:section class='topads' id='topads' preferred='yes'/>

    to:
    <b:section class='topads' id='topads' maxwidgets='3'>

    This change to the template will allow you to add up to 3 widgets above the Blogger header.


  • If you wish to display your Google Adsense ad unit only on the post page and not the home page then you need to add an if statement. For instance go to Layout > Edit HTML after you have created your ad unit and you will see that the code you inserted is now different. That is because the Adsense widget code has been added. You are likely to have something that looks like this:

    <b:section class='topads' id='topads' preferred='yes'/>
    <b:widget id='AdSense7' locked='false' title='' type='AdSense'>
    <b:includable id='main'>
    <div class='widget-content'>
    <data:adCode/>
    </div>
    </b:includable>
    </b:widget>
    </b:section>

    By inserting the code within an if statement we can control where it appears. To have the Google Adsense ad unit only display on the post page add these lines of code:

    <b:section class='topads' id='topads' preferred='yes'/>
    <b:widget id='AdSense7' locked='false' title='' type='AdSense'>
    <b:includable id='main'>
    <div class='widget-content'>
    <b:if cond='data:blog.pageType == "item"'>
    <data:adCode/>
    </b:if>
    </div>
    </b:includable>
    </b:widget>
    </b:section>

In today's tutorial you have learned how to create a new section above the Blogger Blogspot header and how to add a Google Adsense ad unit to that spot or an affiliate banner. You have also learned how to place that Google Adsense unit or banner only on the post page rather than on every page on your blog. Any questions please ask.


Related Articles
List of Blog Know How Tutorials for Blogger Blogs
Blogspot Blogger Guide to Google Adsense Placement
Google Adsense Tips for Blogger Blog
Add an Affiliate Banner to the Blogger Sidebar

Comments

Popular posts from this blog

Panjang Maksimum Deskripsi Video Youtube dan Pesan Kesalahan

Ada banyak diskusi di sekitar tentang menambahkan Caption teks ke deskripsi video YouTube Anda. YouTube secara otomatis akan mengkonversi konten audio dari streaming video Anda ke teks biasa - sehingga dapat digunakan untuk teks tertutup. Anda tentu saja harus cek dan edit ini sebagai hasil yang sedikit aneh dari waktu ke waktu! Anda kemudian dapat menambahkan teks keterangan ini untuk deskripsi video YouTube Anda. Sehingga akan diindeks juga oleh mesin pencari. Masalahnya adalah bahwa itu sangat mudah untuk menemukan kesalahan pada YouTube di mana dikatakan bahwa pengaturan video Anda tidak bisa diselamatkan alasan adalah bahwa baik deskripsi terlalu panjang atau berisi karakter ILLEGAL.  Ini adalah pesan kesalahan yang sangat tidak membantu. Oke. YouTube Anda memberitahu bahwa deskripsi terlalu panjang? Atau apakah itu mengandung karakter ilegal? Atau keduanya? Setelah mengalami masalah ini beberapa kali, saya mengatur tentang bereksperimen dan melihat apa yang sejauh des...

How to Add Internal Links Within Blogger Posts

In the Blogger tutorial I discuss how to add internal links within your Blogger posts (Blogspot posts) to point to either another section within the same post or to another post. There are lots of times when you may want to direct a reader to a different part of your Blogger post depending on what their needs and interests are. Or you might want to alert the visitor to something significant in a related post. In this article I will show how to make use of internal links both within posts and in Blogger generally. Why bother with internal linking you may be wondering? Well the answer is to improve SEO. Blogs with a good internal linking structure will fare better than blogs that don't link posts. Plus you will be creating an aid to navigation for your reader. On longer posts jumps links to different sections within your post or to other posts mean readers can quickly find the information they are looking for. How to Create Internal Links To Sections Within the Same Blogger Posts How...

How to Add a Subtitle to Blogger Posts

This Blogger tutorial shows you how to easily and quickly add a subtitle to your Blogger posts (Blogspot posts) so that both search engines and readers will have more information about your post. I also discuss the benefits of adding subtitles to Blogger articles. This is an easy tweak to your Blogger blog that anyone can carry out in a couple of minutes. Benefits of Using Subtitles in Posts Adding a subtitle which appears below the title of your post can be both eye catching and informative. For instance a titling schema for this post could be: Title: Add a Subtitle to a Blogger Blog Subtitle: Make Your Posts More Search Engine Friendly and User Friendly If you craft your titles and subtitles carefully you will encourage more targeted readers of your blog as they will be able to see at a glance what your post is about rather than reading the whole article. Your traffic therefore might be slightly less but they will be far more targeted to the content of your site resulting in a...