Make google adsense responsive

responsive-adsense

Make google adsense responsive in your responsive design.

Here is an excerpt from google support:

Google adsense policies do not permit any alteration to AdSense code which artificially inflates ad performance or harms advertiser conversions. Any publisher account offers a number of options when generating the ad code, that google adsense hope will allow you to create an ad layout that fits in with your site. In general, google adsense recommend copying and pasting the ad code. In situations though, google adsense understand modifications are crucial to a clean user experience.

Here the snippet from google support:

[prettify]

<script type=”text/javascript”>
google_ad_client = “ca-publisher-id”;
width = document.documentElement.clientWidth;
google_ad_slot = “xxxxxxxxxxxx”;
google_ad_width = 320;
google_ad_height = 50;
if (width > 500) {
google_ad_slot = “3456789012”;
google_ad_width = 468;
google_ad_height = 60;
}
if (width > 800) {
google_ad_slot = “xxxxxxxxxxxxxx”;
google_ad_width = 728;
google_ad_height = 90;
}

</script>
<script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

[/prettify]

What mean that code??

if (width > 500) { is mean If the screen size on your browser more than 500 it will display adsense-sized 468×60

if (width > 800) { is mean If the screen size on your browser more than 800 it will display adsense-sized 728×90

You can try use another size for optimized your website in all device browser size. If your confused with that code you can try use plugin for wordpress.

Here plugin google adsense for responsive design:

Google AdSense for Responsive Design – GARD

Source: https://support.google.com/adsense/answer/1354736?hl=en