Skip to content

Instantly share code, notes, and snippets.

@ivankristianto
Created August 8, 2013 02:07
Show Gist options
  • Save ivankristianto/6180852 to your computer and use it in GitHub Desktop.
Save ivankristianto/6180852 to your computer and use it in GitHub Desktop.
Responsive Adsense Code
<script type="text/javascript"><!--
adUnit = document.getElementById("menuads");
adWidth = adUnit.offsetWidth;
google_ad_client = "ca-pub-5132818893953017";
google_ad_slot = "8312107528";
if ( adWidth >= 768 ) {
/* 728x15 New Submenu */
google_ad_width = 728;
google_ad_height = 15;
} else if ( adWidth >= 468 ) {
/* Banner (468 x 60)
google_ad_slot = "BBB";*/
google_ad_width = 468;
google_ad_height = 15;
} else if ( adWidth >= 336 ) {
/* Large Rectangle (336 x 280)
google_ad_slot = "CCC";*/
google_ad_width = 336;
google_ad_height = 15;
} else if ( adWidth >= 300 ) {
/* Medium Rectangle (300 x 250)
google_ad_slot = "DDD";*/
google_ad_width = 300;
google_ad_height = 15;
} else if ( adWidth >= 250 ) {
/* Square (250 x 250)
google_ad_slot = "EEE";*/
google_ad_width = 250;
google_ad_height = 15;
} else {
/* Ad Link Unit (200 x 90)
google_ad_slot = "FFF";*/
google_ad_width = 200;
google_ad_height = 15;
}
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment