How to add Google Adsense Link Unit(728×15) in the header

by Himanshu Gupta on July 12, 2010

google_money Increasing Google adsense revenue is the top priority when making money online. Placement of the Google adsense ad unit in the best possible area is required when we want to increase the number of clicks on the advertisements.

The best possible way is to camouflage the Google adsense units in your website in order to make them appear as the content.  But you need to be careful when dealing with Google Adsense units because Google has very strict terms and conditions, failing which Google can cancel your Google account.

The most common ways are placing the advertisements in between, above, below the content. But the most popular and successful way is to place the Google Adsense Link Unit with 728×15 dimension near your navigation bar. Make it look like a navigation bar. For example- You can make the text and the background for the Google Adsense unit same as your default navigation bar. The type of ads keep changing according to the content on that page.

So lets get started:-

First of all please make a backup of the files which are to be used in the following steps, in case you make a mistake.

Since i use wordpress Thesis theme, I’ll tell you according to it.

First place the following code into custom_functions.php file in the custom folder of the thesis theme.

function header_link_ad() { ?>
<div id="header_ad_1">


<?php }
add_action('thesis_hook_after_header', 'header_link_ad');

Now place the following code in custom.css file in the custom folder of the thesis theme. Place it before every code if you have placed any in the css file. If their is some problem with the placement, don’t be afraid of experimenting. And you can adjust the position with the by changing the value of the top attribute in the code below. Change the background code according to your need( search the color hex code on Google).

{padding:6px 0 0px 0px;margin:0em auto 0px auto;
height:20px;position:relative;top:21px; }

I have used this code myself as you can see the ad unit below the title of the blog.

Tell me if you face any difficulties. I’ll be pleased to help.

Subscribe To Get FREE Newsletter about Technology from TechHim

{ 18 comments… read them below or add one }

lipkovich July 15, 2010 at 8:19 AM

I want to quote your post in my blog. It can?
And you et an account on Twitter?


Himanshu Gupta July 15, 2010 at 7:58 PM

ya use the trackback button placed in the end of the post.
you can follow us on


universitysix July 18, 2010 at 8:53 PM

i was searching for this piece of info from so many days…. lastly getting from here… thanks mate…


forex system trading October 10, 2010 at 4:00 PM

finally met also on this blog .. a complete explanation .. thanks ..


Justin Germino December 15, 2010 at 6:36 AM

I recently changed some AdSense around on my blog and found that a banner at the top of posts seems to earn more than a larger ad at the bottom of articles from my own testing over the past three weeks.


Amit December 15, 2010 at 3:33 PM

nice post very helpful


Fiona Ostermayer March 5, 2011 at 12:11 AM

This is perfect – I’ve been looking for a way to get adsense across the top of my page. One little error though – you need to add a tag at the end of the adsense script. :) Thanks again for this!


Techmaker March 16, 2011 at 5:34 PM

Can I do this for blogger as well? Visit my blog, I tried to put just below the NAV bar but it made a gap between NAV bar and ad bar


Himanshu Gupta March 16, 2011 at 5:55 PM

decrease the top margin, top floating value. Play with the values, you’ll get the perfect fit.


Burdell@SharePoint Training April 12, 2011 at 12:02 AM

Worked perfectly, thanks!!!


hailley April 24, 2011 at 10:31 AM

Hi, I’m having problems with placing a 728 x 90 adsense ad in my site. I want it to be below my header ( title and tagline ). After pasting your code, everything becomes black. I have no idea why, any help or suggestions would be very helpful. Thanks a lot, nice blog by the way, very informative.


Himanshu Gupta April 24, 2011 at 11:10 PM

use firebug extensions(firefox) in order to solve these kind of problems.


health and beauty advices June 19, 2011 at 9:46 PM

Thanks for great job


jennystun June 20, 2011 at 1:54 AM

Thanks was looking to do this on one of my websites.


TechGopal June 20, 2011 at 5:27 PM

i have added adds in header & also recommended to everybody because has high ctr….


Rajesh July 25, 2011 at 1:05 PM

pls give tutotial for blogger i badly needed it..thanks ..


sumit shah August 25, 2011 at 4:55 PM

Hey dats great

I included in between my body and header and works 5n thanx


Film Making Advice October 28, 2011 at 8:51 PM

I am using the 2010 theme and it doesn’t have that php file, any suggestions on how i can do it with that one, thanks in advance for any help, Tony


Leave a Comment


{ 10 trackbacks }

Previous post:

Next post: