Skip to main content

AdSense changes behavior of responsive ad units - check your ad code!

AdSense has changed the way responsive ad units work to improve performance on desktop. They have also enabled more ad size combinations. These changes may require you to modify the ad code or the HTML of your site.
Responsive ad units automatically adapt the size of the ads to fit your page layout. It can adapt to different browser window sizes, from a large desktop window, to a tiny browser window on a mobile phone. And it can adjust the ad size when a phone's orientation is changed from portrait to landscape.

Now a responsive ad unit can resize the HTML container that it is within. That means you may need to modify either the ad code or your site to make sure AdSense can calculate the ad size correctly.
  • The ad code should not be in a container with a fixed or limited height
  • The ad code should to be a container with a width set (or the ad code must be modified).
  • Third party scripts executed before the responsive ad code may require you to specify the ad size
Read on for more details about the requirements. The AdSense help center has instructions for modifying your AdSense responsive ad code.

Technical requirements to make the responsive ad units work correctly 

The changes to the way responsive ad units work may require modifications to your site or ad code. There are full details in the AdSense help center.

* Responsive ad units should not be placed in a parent container with fixed or limited height.

If you do place the ad unit with in a fixed-height <div> the ads may appear too tall.

If you have noticed your ads appear to be too tall, check the responsive ad code placed on your website to make sure it's not in a fixed-height container.

You can limit the height of responsive ads by modifying the ad code. This example shows how to limit the height of the ad unit to a fixed height of 90 pixels, with a variable width.
More details on how to edit the ad code.

* Responsive ad units do need to be in a parent container with a width set

The ad code needs to know the width of the container to calculate the size of the ad unit.  If your ad code is in a parent container without a set width, you will need to edit the ad code.

An example would be an ad placed within a floating element in your site's layout.

More details on how to edit the ad code.

* Third-party Javascript executed before the ad code can prevent the required size from being calculated correctly

If you have JavaScript that executes before the ad code script - for example, code to hide the ads until the page fully loads - you may need to modify the ad code to set the size of the parent container.

More details on how to edit the ad code.

Help! This is confusing! 

Unless you are comfortable with CSS and HTML, all of this may is probably overwhelming. The good news is that odds are you don't need to make any changes.

If you are using responsive ads on your site, and the layout looks OK, then you probably do not need to make any changes.

And if you have a Blogger blog, with one of Blogger's templates, and you placed your ads using an AdSense gadget, you shouldn't have to make any changes.

Otherwise read on to learn more and get assistance:

Comments

  1. I noticed this when the "auto ads" code started putting ads in my blog that ended up warping the sizes of sidebars and screwing up the layout. I temporarily reverted to manually placed ads to solve it. I didn't think about manually resizing the ads in the auto-ad code. Good tip.

    ReplyDelete

Post a Comment

Spam and personal attacks are not allowed. Any comment may be removed at my own discretion ~ Peggy