Christian Strang
Christian Strang

Reputation: 8530

Google Adsense Responsive ads - use two ads for bigger screens?

I'm currently trying out Google Adsense Responsive Ads which work great, but is there a way to show two ads when the screen size passes a specific size?

For example, when the screen size is bigger than 620 pixel, show two "250 x 250" ads next to each other (instead of just one)?

Upvotes: 1

Views: 982

Answers (1)

Aakash
Aakash

Reputation: 226

You may not put two ads (without some server side coding which may cause various problems) but you can increase or decrease the size of the ad to achieve a similar behavior using media queries. For example: You can show -

  1. 300x250 ad on mobiles
  2. 336x280 ad on tablets (with min width of 500)
  3. 728x90 ad on desktop (with min width of 800)
  4. 970x250 ad on large resolution desktops (with min width of 1200)

For this, you need to use advanced code (code modifications required) in the 'responsive ad' as follows -

<style>
.responsive2 { width: 300px; height: 250px; }
@media(min-width: 500px) { .responsive2 { width: 336px; height: 280px; } }
@media(min-width: 800px) { .responsive2 { width: 728px; height: 90px; } }
@media(min-width: 1200px) { .responsive2 { width: 970px; height: 250px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive2 -->
<ins class="adsbygoogle responsive2"
     style="display:inline-block"
     data-ad-client="ca-pub-XXXXX"
     data-ad-slot="YYYYY"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

For more details on advanced responsive adsense ad, refer to https://support.google.com/adsense/answer/3543893#adv

Upvotes: 1

Related Questions