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 type="text/javascript"
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.


the javascript block on the top of your page scrolls with the content and is very extremely annoying. Enough so that i couldn't keep reading

Great Post, I love to read articles that are informative and actually have good content. Thank you for sharing your experiences and I look forward to reading more.
website design

This Site is very essential for me. Because I have got many information from here.Thank You ..........for more info

Thanks for sharing such a nice article. i love your writing. your idea is mind blowing that's why i would like to appreciate your work.for more info

very good post, I will be reading because I really liked your blog



Many interesting information

Post a Comment