Google is supporting the revolutionary responsive web-design technology it was important to allow compatible ads according website need. Till now it was very confusing to adopt the responsive ads due to no clear stand responsive AdSense code modification.
On one hand Google was promoting responsive web design, on another hand there was no easy way to implement AdSense on such site without modifying the code. This is why they allowed to modify AdSense code in certain way (This is a really good news. Isn’t it?)
Now i'll tell you how can you do that
You must read : How to make Responsive web design.
On one hand Google was promoting responsive web design, on another hand there was no easy way to implement AdSense on such site without modifying the code. This is why they allowed to modify AdSense code in certain way (This is a really good news. Isn’t it?)
<script type="text/javascript">Note:
google_ad_client = "ca-publisher-id",
if (window. innerWidth> = 800) {
google_ad_slot = " ad-unit-1 ";
google_ad_width = 728;
google_ad_height = 90;
} Else if (window.innerWidth <400) {
google_ad_slot = " ad-unit-2 ";
google_ad_width = 300;
google_ad_height = 250;
Else {}
google_ad_slot = " ad-unit-3 ";
google_ad_width = 468;
google_ad_height = 60;
}
</ script>
<script type = "text / javascript"
src = " http://pagead2.googlesyndication.com/pagead/show_ads.js ">
</ script>
- If you're using blogger then you need to parsing this code before implementing
- Above code is not work in Internet Explorer 8.