• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

How to limit the size of Google AdSense ads

Admin

Well-Known Member
Staff member
Administrator
This code is directly from Google support. Please note that this will not work for AutoAds.
If you find that our responsive ad code doesn't do everything you need, you may modify your ad code to better meet the requirements of your responsive site. The following examples show you how to corr
support.google.com
If you find that our responsive ad code doesn't do everything you need, you may modify your ad code to better meet the requirements of your responsive site. The following examples show you how to correctly make these modifications.

Note: The examples described in this article are acceptable modifications of the AdSense ad code. You won't violate the AdSense Program policies by modifying your responsive ad code in these approved ways.

Exact ad unit size per screen width example​

This example shows you how to modify your responsive code to set specific ad unit sizes for three ranges of screen widths, i.e., mobile, tablet and desktop. You don't need to have any previous experience of CSS media queries or modifying AdSense ad code to follow this example.

Here's some modified responsive ad code that sets the following exact ad unit sizes per screen width:
  • For screen widths up to 500px: a 320x100 ad unit.
  • For screen widths between 500px and 799px: a 468x60 ad unit.
  • For screen widths of 800px and wider: a 728x90 ad unit.
HTML:
<style>
.example_responsive_1 { width: 320px; height: 100px; }
@media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 60px; } }
@media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 90px; } }
</style>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- example_responsive_1 -->
<ins class="adsbygoogle example_responsive_1"
style="display:inline-block"
data-ad-client="ca-pub-XXXXXXX11XXX9"
data-ad-slot="8XXXXX1"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
To adapt this sample code for your own site:
  1. Create a display ad unit in your AdSense account, making sure you leave Responsiveselected in the "Ad size" section. Note down the following information from your responsive ad code:
    • Your publisher ID, for example, ca-pub-1234567891234567
    • Your ad unit's ID (data-ad-slot), for example, 1234567890.
  2. In the sample code:
    • Replace all instances of example_responsive_1 with a unique name, e.g., Home_Page, front_page_123, etc.
      Notes:
      • Your unique name must only contain English letters (A-Z), numbers, and underscores, and the first character must be an English letter.
      • You must use a different unique name each time that you adapt this sample code.
    • Replace ca-pub-XXXXXXX11XXX9 with your own publisher ID.
    • Replace 8XXXXX1 with your own ad unit's ID.
  3. Decide on the sizes you want your ad unit to take per screen width:
    • If you're happy with the existing ad unit sizes in the sample code, then you don't need to make any additional changes.
    • If you want to set different ad unit sizes per screen width, then, in the sample code:
      • Replace 320px and 100px with the width and height of the ad unit you want to use for screen widths up to 500px.
      • Replace 468px and 60px with the width and height of the ad unit you want to use for screen widths between 500px and 799px.
      • Replace 728px and 90px with the width and height of the ad unit you want to use for screen widths of 800px and wider.
  4. Copy and paste your modified ad code into the HTML source code of the page where you'd like the ads to appear.
    Note: After you’ve placed your ad code, we recommend that you test your ads on different devices and screens to make sure that the responsive behavior is working correctly.

Specify an expandable width and a fixed height​

You may modify your responsive ad code to specify an expandable width and a fixed height for your ad unit via CSS. The following example shows you how to make these modifications:

Expandable width with fixed height example

This example shows you how to modify your responsive ad code to specify a fixed height of 90px and a variable width from min-width 400px to max-width 970px:
HTML:
<ins class="adsbygoogle"
style="display:inline-block;min-width:400px;max-width:970px;width:100%;height:90px"
data-ad-client="ca-pub-1234"
data-ad-slot="5678"></ins>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

Specify an exact size per screen width​

You may modify your responsive ad code to specify the exact size for your ad unit via CSS. The following example shows you how to make these modifications:

Exact size per screen width example

If you know the exact ad unit sizes per device that best fit your responsive site, then you can use CSS3 media queries to set the size of your responsive ad unit. The following example shows you how to modify your ad code to use CSS3 media queries:
HTML:
<style type="text/css">
.adslot_1 { width: 320px; height: 100px; }
@media (min-width:500px) { .adslot_1 { width: 468px; height: 60px; } }
@media (min-width:800px) { .adslot_1 { width: 728px; height: 90px; } }
</style>
<ins class="adsbygoogle adslot_1"
style="display:inline-block;"
data-ad-client="ca-pub-1234"
data-ad-slot="5678"></ins>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
 

Facebook Comments

Similar threads
Thread starter Title Forum Replies Date
Admin How to limit the size of Google AutoAds on your forum xenforo 2 Xenforo 0
Admin [J] XFRM Extras xenforo 2, limit and react to download resources xenforo, restrict to download Xenforo 2.x Premium 0
Admin [XenMax] - Limit Post Link 2.0.0 Xenforo 0
P Hỏi PHP Post ID cần thêm chức năng limit time PHP 2
Admin Post Quote Length Limit (vB5) Vbb tutorial 0
Yeukodamnoi Help Anh Thắng vào gấp, wap em bị Resource Limit rồi Hỏi đáp về domain & hosting 0
Lee_Jin Help CPU Limit Exceeded fix thế nào đây? All Shared Scripts 1
Admin vBH-Post limit for link Add-ons 6
Admin [VINAVB]Limit New Thread - Giới hạn thành viên post chủ đề mới (hạn chế spam) Add-ons 0
Admin Limit signature height via CSS Add-ons 0
Admin Limit Meta Description Add-ons 0
Admin vt.Lai VBB Limit New Thread/Reply 2.0 for vBB 3 - Giới hạn số bài viết mới, số reply Add-ons 0
Admin vt.Lai VBB Limit New Thread/Reply 4.1 for vBB 4 - Giới hạn số bài viết mới, số reply Add-ons 0
C usps scampage 2023 Size 515Kb Tut, tool, mmo 0
C USPS Scampage New 2023 Size 77kb Tut, tool, mmo 0
Admin [OzzModz] XFRM File Extension And Size Display xenforo 2 Xenforo 0
Admin Site Logo Image re-size Vbb tutorial 0
Admin Yilmaz - Postbit Font Size Add-ons 0
Admin [Tut] cách chọn size để ship đồ Tut, tool, mmo 0
Admin [Wordpress] Fix lỗi Fatal error: Allowed memory size of 33554432 bytes exhausted Wordpress 0
B Áo somi nữ BIG SIZE - Quần jean nữ dành cho người mập - Áo somi công sở nữ từ 50-90kg Trò chuyện linh tinh 0
N [Update] Ninja school hack mod Full Size !!! PRO S40 0
C Hỏi Cách chỉnh lại size ảnh trong forum Johncms 6
K Share - Đổi màu và size chữ cho chuyên mục vbb. Vbulletin 0
S Ongame Mini x2 đã được size màn hình cho máy có màn hình 128 S40 1
C AVIX GOOGLE PROXYLESS PARSER Tut, tool, mmo 0
C GOOGLE PROXYLESS PARSER Tut, tool, mmo 0
C ParserCIO - GOOGLE DORKS PROXYLESS & PROXY PARSER - DORK TOOL Tut, tool, mmo 0
C Google Bing Extractor 8.0.0 Tut, tool, mmo 0
katy Android Cơ hội trúng 10 triệu khi thanh toán trên Google Play bằng tài khoản di động MobiFone Điện thoại di động 16
C Google URL Parser v4.0 Tut, tool, mmo 0
olalavui Hướng dẫn Enable User-ID tracking in Google Analytics for Xenforo Xenforo 3
Admin Hướng dẫn nhận miễn phí Google Drive không giới hạn Tut, tool, mmo 8
Admin Nhận không giới hạn dung lượng từ Google Drive - Get Free Unlimited Google Storage Tut, tool, mmo 0
Admin Share tool get dữ liệu tài khoản Google - Tìm kênh Youtube từ tài khoản Google Tut, tool, mmo 9
Admin Cách kiếm 1000$ / tháng từ Google Adsense - AdSense Major - From ZERO to $1K Monthly Tut, tool, mmo 14
Admin [VNXF 2x] Google Trans - Add auto Google translate bar into your forum Xenforo 0
M Share Google Camera là gì? Làm thế nào để tải Google Camera cho điện thoại của bạn? Thủ thuật ĐTDĐ 0
tunglamed Đăng ký mua vật phẩm trên Google Play - Nhận ngàn quà tặng Điện thoại di động 0
W Cần giúp đỡ về vấn đề index lên google. Blogger 2
Admin Hướng dẫn nhận tiền Western Union từ Google về Vietinbank đơn giản và mới nhất 2020 Tut, tool, mmo 0
M Share Dowload Google Camera cho các dòng máy Xiaomi - update liên tục Thủ thuật ĐTDĐ 0
cuongpro9x Share Nhận ngay 100$ Google Cloud Credit Thảo luận wap việt 0
Admin Ads.txt là gì và quan trọng như thế nào? Tại sao tạo xong ads.txt thì không thấy hiện quảng cáo Google Thảo luận SEO 0
Admin Hướng dẫn xây dựng ứng dụng với Google Assistant trên Windows 10 đơn giản và chi tiết Sử dụng, chia sẻ, hỏi đáp 0
Admin Share plugin Google Structured Data v4.1.0 Pro cho Joomla Joomla 0
Admin Hướng dẫn xác nhận Google Webmaster bằng plugin seo by Yoast - Verify Google Webmaster with plugin seo by Yoast Wordpress 0
Admin Hướng dẫn đăng ký Google Adsense Content mới nhất tháng 5 năm 2019 - Register Google Adsense Content 2019 simple Tut, tool, mmo 0
T Google tạo ra công cụ để phân tích blockchain của Ethereum Tin tức CNTT 0
T Google Bãi Bỏ Lệnh Cấm Quảng Cáo Tiền Điện Tử Tin tức CNTT 0

Similar threads

New posts New threads New resources

Back
Top