by kalseo
1 replies
  • SEO
  • |
Hi Warriors,

I am not sure that this is the right section or topic should go into programming.

I recently faced few problems regarding my AdSense ads over responsive design and viewed on smart phone.

Can anybody share a trick or snipped that with switch ads when website is viewed on mobile phone?

Cheers
Kal
#adsense #responsive
  • Profile picture of the author edanb
    I recently ran into this issue on my website, here's the code I ended up using for defining adsense parameters:

    Code:
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = '728x90_as';
    
    width = document.documentElement.clientWidth;
    
    if (width <= 800) {
    	google_ad_width = 468;
    	google_ad_height = 60;
    	google_ad_format = '468x60_as';
    }
    
    if (width <= 500) {
    	google_ad_width = 320;
    	google_ad_height = 50;
    	google_ad_format = '320x50_as';
    }
    You can see it in action on my website (just resize browser to see different ad sizes), at www.top10zen.com.
    {{ DiscussionBoard.errors[9150113].message }}

Trending Topics