Created
November 5, 2013 03:01
-
-
Save janily/7313161 to your computer and use it in GitHub Desktop.
If you’re using Adsense on responsive design, this is the code that you can use and it’s NOT against its TOS.
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
| <!-- You can add multiple Adsense Ad units --> | |
| <!-- Just change the ad on Line #4 and Line #7 --> | |
| <div id="google-ads-1"> | |
| <script type="text/javascript"> | |
| adUnit = document.getElementById("google-ads-1"); | |
| adWidth = adUnit.offsetWidth; | |
| /* Replace this with your AdSense Publisher ID */ | |
| google_ad_client = "ca-pub-1234567890"; | |
| if ( adWidth >= 768 ) { | |
| /* Leaderboard 728x90 */ | |
| google_ad_slot = "AAA"; | |
| google_ad_width = 768; | |
| google_ad_height = 90; | |
| } else if ( adWidth >= 468 ) { | |
| /* Banner (468 x 60) */ | |
| google_ad_slot = "BBB"; | |
| google_ad_width = 468; | |
| google_ad_height = 60; | |
| } else if ( adWidth >= 336 ) { | |
| /* Large Rectangle (336 x 280) */ | |
| google_ad_slot = "CCC"; | |
| google_ad_width = 336; | |
| google_ad_height = 280; | |
| } else if ( adWidth >= 300 ) { | |
| /* Medium Rectangle (300 x 250) */ | |
| google_ad_slot = "DDD"; | |
| google_ad_width = 300; | |
| google_ad_height = 250; | |
| } else if ( adWidth >= 250 ) { | |
| /* Square (250 x 250) */ | |
| google_ad_slot = "EEE"; | |
| google_ad_width = 250; | |
| google_ad_height = 250; | |
| } else { | |
| /* Ad Link Unit (200 x 90) */ | |
| google_ad_slot = "FFF"; | |
| google_ad_width = 200; | |
| google_ad_height = 90; | |
| } | |
| </script> | |
| <script type="text/javascript" | |
| src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | |
| </script> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment