概览
确保安全地请求广告代码库脚本。这不仅可以为用户提供更好的安全性,还可以提高性能。由于 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 |
|
Google 发布商代码 |
|