How to limit the size of Google AdSense ads!!

XMAN

Active member
Joined
Jul 12, 2021
Messages
19,648
Reaction score
43
Points
38
Compatible XF Versions 2.0 2.1 2.2

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 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.

Please Login or Register to view content
To adapt this sample code for your own site:
  1. Create a display ad...

Read more

Continue reading...
 
Top