Created
December 3, 2012 17:34
-
-
Save jonsuh/4196593 to your computer and use it in GitHub Desktop.
Responsive Google AdSense Ads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.js-gads { | |
overflow: hidden; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="js-gads"> | |
<script type="text/javascript"><!-- | |
google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX"; | |
if (window.innerWidth <= 350) { | |
// Small ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 320; | |
google_ad_height = 50; | |
} else if (window.innerWidth >= 750) { | |
// Large ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 728; | |
google_ad_height = 90; | |
} else { | |
// Medium (fallback) ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 468; | |
google_ad_height = 60; | |
} | |
//--></script> | |
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"><!-- | |
google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX"; | |
if (window.innerWidth <= 350) { | |
// Small ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 320; | |
google_ad_height = 50; | |
} else if (window.innerWidth >= 750) { | |
// Large ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 728; | |
google_ad_height = 90; | |
} else { | |
// Medium (fallback) ad | |
google_ad_slot = "XXXXXXXXXX"; | |
google_ad_width = 468; | |
google_ad_height = 60; | |
} | |
//--></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment