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 }