【发布时间】:2019-11-21 11:23:14
【问题描述】:
我的 Wordpress 网站 [followmyinstagram.de] 运行在头部标签和一些文本区域内实现的 Google Adsense。代码直接写入子主题,所以我没有使用任何 Adsense 插件。
通过分析网站的页面速度,Chrome 抛出:
警告:已找到“https://pagead2.googlesyndication.com/pagead/js/xxxxxxx/xxxxxxx/show_ads_impl.js”的预加载链接,但浏览器未使用该链接。检查您是否正确使用了crossorigin 属性。
浏览器以这种方式请求文档会浪费大量时间。正如它所说,必须有机会在网站显示后预加载链接或延迟加载链接。问题是,提到的链接不会出现在我网站代码的任何地方,因此它必须由 Adsense 块中的原始链接获取。我该如何解决这个错误?
根据 [https://wordpress.org/support/topic/i-am-getting-a-warning-in-during-google-page-speed-test/] 的说法,一些插件可能会干扰 Adsense,但我已经测试了我所有的 8 个插件。
可能干扰的缓存插件:Autooptimize、WP Super Cache
如果我删除 Adsense-code-sn-ps,错误当然会消失。
这是我的 header.php
<head>
<script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" ></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-**************",
enable_page_level_ads: true
});
</script>
</head>
警告:为“https://pagead2.googlesyndication.com/pagead/js/xxxxxxx/xxxxxxx/show_ads_impl.js”找到了预加载,但浏览器未使用该预加载。检查您是否正确使用了crossorigin 属性。
【问题讨论】:
标签: javascript php html wordpress adsense