Google AdSense Ads for Responsive Website

Posted: February 28, 2013 at 4:39 am

Responsive web design is a simple & powerful technique that makes website look good across all screen sizes; like- desktop, Laptop, Pad, Mobile phones, Tablets etc.
Google also recommends the responsive design approach for improved indexing since :it keeps your desktop and mobile content on a single URL.”

Responsive Google Ads Code with JavaScript

<script type="text/javascript">
var width = window.innerWidth || document.documentElement.clientWidth;     google_ad_client = "ca-publisher-id";     if (width >= 800) {
       google_ad_slot = "Your Ad-unit for 728X60 Ad";
       google_ad_width = 728;
       google_ad_height = 60;
    } 
else if ((width < 800) && (width < 400)) {        
google_ad_slot = "Your Ad-unit for 300X250 Ad";        
google_ad_width = 300;        
google_ad_height = 250;      
} 
else {        
google_ad_slot = "Your Ad-unit for 468X60 Ad";        
google_ad_width = 468;        
google_ad_height = 60;      
}
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Just Replace ca-publisher-id & ad-units.