Make google adsense responsive

0 9880


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:

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

What mean that code??

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

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

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:


banner 468x60
Category: WordpressTags:
Hello world! My name gian, im from blogging from indonesian. Im interest with webdesign, php coding and wordpress. Why i choose wordpress? Because its simple and easy to use for my blog. And thanks to read my article.