透過 HTTPS 載入廣告代碼

總覽

確保廣告代碼程式庫指令碼的要求安全無虞。這不僅可為使用者提供更完善的安全性,也能提升效能。由於 GPT 發出的廣告請求一律使用 HTTPS,透過 HTTPS 從建議的主機載入程式庫,可確保瀏覽器只需針對所有廣告放送相關請求開啟 1 個連線。

建議

請一律從 HTTPS 網址載入廣告代碼指令碼。

錯誤
<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 發布商廣告代碼