HTTPS 経由で広告タグを読み込む

概要

広告タグ ライブラリ スクリプトが安全にリクエストされるようにします。これにより、ユーザーのセキュリティだけでなく、掲載結果も向上します。GPT によって発行される広告リクエストでは、常に HTTPS が使用されます。そのため、推奨ホストから HTTPS 経由でライブラリを読み込むと、ブラウザでは広告配信に関連するすべてのリクエストに対して 1 つの接続を開くだけで済みます。

おすすめ

広告タグのスクリプトは常に HTTPS URL から読み込みます。

<script>
  var el = document.createElement('script');
  // Incorrect: potentially loading the ad tag over HTTP.
  var useSSL = 'https:' == document.location.protocol;
  el.src = (useSSL ? 'https:' : 'http:') + '//securepubads.g.doubleclick.net/tag/js/gpt.js';
  var node = document.getElementsByTagName('script')[0];
  node.parentNode.insertBefore(el, node);
</script>
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>

詳細

次の広告タグ ライブラリ スクリプトがサポートされています。

ライブラリ スクリプト
AdSense

pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

pagead2.googlesyndication.com/pagead/show_ads.js

Google パブリッシャー タグ

googletagservices.com/tag/js/gpt.js

securepubads.g.doubleclick.net/tag/js/gpt.js

Google パブリッシャー タグを使ってみる