HomeGoogle

Google Adsense ad code on SSL https secure website Internet

Tuesday, September 17 2013
Google Adsense ad code on SSL https secure website

Google Adsense supports ad display on SSL https website

Google adsense has enabled it's ad display on SSL secure website which use https protocol. Google adsense displayes ads on secure pages after recent update to it's ad delivery policy on secure content pages on web.

Ecommerce, social network and website publisher with SSL https protocol can now take benefit from Google adsense adoptation for SSL. 

How to display Google adsense ad on SSL https secure website?

Google adsense ad code comes with Asynchronous and Synchronous formats. Google adsense publishers can select either of two options for using SSL ad code for their websites. As first option publisher can recreate ad code in their adsense account for their SSL websites and use it in their SSL secure web pages.

Second option is to modify protocoal of existing adsense code for the javascript file that was served over a http protocoal. Publisher can remove http: from show_ads.js javascript file path in syncronous adsense code to make it accessible for SSL secure websites. These codes are still valid for non-SSL websites too.

Example of a Synchronous Google adsense code for SSL secure website:

[lt]script[gt]
  google_ad_client="ca-pub-xxxxxxxxxx";
  google_ad_slot="yyyyyyyy";
  google_ad_width=728;
  google_ad_height=90;
[lt]/script[gt]
[lt]script src="//pagead2.googlesyndication.com/pagead/show_ads.js"[gt][lt]/script[gt]

Example of a Asynchronous Google adsense code SSL secure website:

For asynchronous adsense code publisher can remove http: from adsbygoogle.js file path to make this accessible on SSL secure webpages.

[lt]script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"[gt][lt]/script[gt]
[lt]ins  class="adsbygoogle"    
  data-ad-client="ca-pub-xxxxxxxxxxx"
  data-ad-slot="yyyyyyyy"[gt][lt]/ins[gt]
[lt]script[gt]
  (adsbygoogle=window.adsbygoogle || []).push({});
[lt]/script[gt]