Friday, July 15, 2011

Add Ad Sense Advertisement after your Blog Post Title

First think before taking such step and be careful when doing this because Google doesn't allow customizing ad code. So any change in add code may make your ad-Sense ban.
But it's an easy thing to do. First select ad types and generate your code form your Ad-Sense account. Your Ad-Sense code will be something like as follow:


<script type="text/javascript"><!--
 google_ad_client = "ca-pub-Publisher-ID";
google_ad_host = "ca-pub-Publisher-ID"
/* medium */
 google_ad_slot = "slot number";
 google_ad_width = 300;
 google_ad_height = 250;
 //-->
 </script>
 <script type="text/javascript"
 src="URL of ad js file">
</script>

But to show advertisement right after blog post title you need to edit your Ad-Sense code.Change your ad-sense code as follow:


&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;ca-pub-Publisher-ID&quot;;
google_ad_host = &quot;ca-pub-Publisher-ID&quot;;
/* medium */
google_ad_slot = &quot; slot number&quot;;
google_ad_width = 300;
google_ad_height = 250;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;URL of AD js file&quot;&gt;
&lt;/script&gt;

Change the < sign with &lt; 
Change the > sign with &gt;
Change "" with &quot;&quot;
Your modified code will be shown like above example. Do it carefully. Or you can do it using some simple program. There are some websites which also provide this type of facility.

Now the task is to place this code. 
Go to you code window from Design -> Edit HTML. Now using search pallet ( click ctrl+f ) find the following code <data:post.body/> and paste your modified code just above this code. Before doing this one important thing is don't forget to take backup copy before saving your modified code. 

Save your template and see the page preview. Another thing to remember that don't use more than three ad unit or you may face problem of not seeing ad instead seeing some blank space which can degrade your blog appearance. 

0 comments:

Post a Comment