Guest User

JavaScript Responsive Google Ads

a guest
Mar 28th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.     var width = window.innerWidth
  3.         || document.documentElement.clientWidth
  4.         || document.body.clientWidth;
  5.     google_ad_client = "ca-pub-вашето-ID-тук";
  6.     if (width > 800) {
  7.         // Load the Leaderboard 728x90 Unit for wide screen
  8.         google_ad_slot = "вашият-Идент.№";
  9.         google_ad_width = 728;
  10.         google_ad_height = 90;
  11.     } else if ((width < 800) && (width > 400)) {
  12.         // For small screens, load the 468x60 banner
  13.         google_ad_slot = "вашият-Идент.№";
  14.         google_ad_width = 468;
  15.         google_ad_height = 60;
  16.     } else {
  17.         // Load the 234x60 half banner
  18.         google_ad_slot = "вашият-Идент.№";
  19.         google_ad_width = 234;
  20.         google_ad_height = 60;
  21.     }
  22. </script>
  23. <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  24. </script>
Add Comment
Please, Sign In to add comment