【问题标题】:Preload Link found for Google Adsense, but wasn't used by browser为 Google Adsense 找到预加载链接,但浏览器未使用
【发布时间】: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


    【解决方案1】:

    你无能为力,这是谷歌解决的问题,但预加载的资源可能会在渲染后的事件中使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-02
      • 2018-02-23
      • 1970-01-01
      • 2014-08-17
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多