Google Adsense for Responsive website is Approved : How to Implement

Google has approved the use of adsense ad units for the responsive website layouts. This has come in order to a email query by Mr. Michel and its reply by google. 

Credit to this also goes to Mr. Aagarwal of Labnol who first posted this idea on his blog and since then it was a topic of debate on several online forums.

What are Responsive Websites / Web Layouts?
Responsive website are those which are built on templates that can manage to auto-reduce or auto auto enlarge its size in accordance to the computer device they are being seen/used. Like if a website with layout size 1000 pixel width will auto shrink to a 200 pixel size when it will be seen onto a 200*200 size mobile phone explorer. This function of website is being used for last 2 years and becoming largely popular as well.


Google Adsense for Responsive websites.
Google adsense for responsive websites is simple html or java encoding that allows or enables a website layout to make it understand when to use larger ad units like 728*90, 336*250, 300*250, 250*250 and when to use smaller ad units like 180*180 or 100*100. 

How to implement Google Adsense for Responsive Web laouts?
It can easily be understood by reading coding below that with the use of if-else function into javascript code of adsense we can implement Google ads for responsive websites. 
<script type="text/javascript">

    var width = window.innerWidth || document.documentElement.clientWidth;
    google_ad_client = "ca-publisher-id";

    if (width >= 800) { 
       google_ad_slot = "ad-unit-1"; 
       google_ad_width = 728; 
       google_ad_height = 60; 
    } else if ((width < 800) && (width < 400)) { 
      google_ad_slot = "ad-unit-2"; 
      google_ad_width = 300; 
      google_ad_height = 250; 
    } else { 
      google_ad_slot = "ad-unit-3"; 
      google_ad_width = 468; 
      google_ad_height = 60; 
    } 
</script> 
<script type="text/javascript" 
       src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

AdSense publishers routinely perform split A/B testing to determine which colors schemes and banners sizes perform the best on their website - this is a similar technique.

S p o n s o r ed L i n k

Ditulis Oleh : Unknown Hari: 12:50 AM Kategori:

1 comments:

  1. Its hard to communicate with adsense thats why it sounds good when i read that google adsense replied in concern to an indivuals query regarding responsive layouts. well done.

    ReplyDelete

 

Subscribe Newsletter

Enter your email address:

Archive

Subscribe Us

Enter your email address: