Smart Recent Blog Post List

Sep 20, 2011

How to add adsense to blog using javascript

Untitled Page
Google Adsense can be easily added with the help of javascript in any poart of post.

 Lets look at the simple steps for doing it :- 
1) Go to the edit post of your blog.
2) Select HTML edit mode.
3) Insert following javascript to your HTML.

Below is the example of leader board Adsense :-
-------------------------------------------------------------------------------------------------------------------------
          

<script type="text/javascript"><!--
google_ad_client = "ca-pub-9274462217825187"; //change your pusblisher id
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "E8E7D0"; //change background color from here
google_color_bg = "dcdcdc"; //change back ground coloe from here                  
google_color_link = "B96F17"; //change link color from here
google_color_url = "B96F17"; //change url color from here
google_color_text = "000000"; //change text color from here
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
script>
-------------------------------------------------------------------------------------------------------------------------
4) Save your post and you done with Adsense emebed into your post.
Above adsense javascript code will return some thing like below in your blog post :-



















How to change the Adsense Unit Size ?

Next important point is to change the adsense layout using javascript.
Follow below step to change the :-
1) Go to the adsense javascript.
2) Change the hieght and width field , get the value of hieght and width from the image shown below:-
:
3) After changing the hieght and width, change the "google_ad_format" value in "width_height_as" format, example :-
     google_ad_width = 336;
     google_ad_height = 280;
     google_ad_format = "336x280_as";


4)  Just save it after changing the value, and you are ready with new Adsense unit size. Choose unit size according to your website/blog.









0 comments:

Post a Comment

Smart Recent Blog Post List