When AdSense launched a decade ago, people mostly accessed websites on their desktop or laptop computers. Fast forward today and all sorts of devices – mobile phones, gaming consoles, ebook readers and even televisions – are being used to connect to the Internet.

Web designers are therefore increasingly relying on a technique called Responsive Web Design where a single layout works across all devices, irrespective of the screen size or the resolution of the visitor’s device.

Google AdSense ads are fixed-width but there’s a little workaround that can  make your Google ads responsive. The idea is that if a visitor is reading your web page on a large desktop screen, they are served the large 728×60 or 336×280 units while if another visitor is viewing the same page on a smaller mobile screen, you can dynamically serve the 200×200 (or similar) ad unit.

I shared a JavaScript snippet last year and, since then, its been a topic of debate in several online forum threads. The primary concern among web publishers was (and still is) that Responsive Google Ads could be against Google AdSense policies since they require modification in the default JavaScript code.

Michel Wester of WebSonic.nl, an AdSense publisher from Netherlands, contacted the Google AdSense team for a confirmation and here’s the official response (in Dutch):

Responsive Google Ads

“De voorbeeld website die u stuurt geeft al de juiste javascript code die u kunt gebruiken.” Google AdSense support has confirmed that Responsive Ads are allowed.

The rough Dutch to English translation is:

AdSense Ads can be adapted to different screen sizes using a simple JavaScript snippet. To take advantage of responsive design, create multiple ad formats, such as 728×90, 468×60 and 300×250. Then you implement an “if-else’ fragment so that the right ad format is displayed based on the size of the device of the user.

The example website that you sent has the correct JavaScript code that you can use. Well I would like to emphasize that further change the AdSense code is not allowed. Advertisements may also not be hidden with CSS.

Thus you won’t violate any of the AdSense program policies for using responsive ads on your website. The JavaScript snippet isn’t modifying the AdSense code but is simply requesting a different ad unit based on the viewport width of the current visitor’s screen.