【发布时间】:2021-02-16 13:06:26
【问题描述】:
我已按照 google adsense 网站上的建议,指示我在我的网页标签中添加以下代码。
<script data-ad-client="ca-pub-64xxxxxxxxxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
我已经通过将它添加到我的 application.html.erb 文件来实现这一点。
当我第一次加载页面时将它部署到 Heroku,我收到以下控制台错误:
googleads.g.doubleclick.net/pagead/ads?guci=1.2.0.0.2.2.0.0&client=ca-pub-64xxxxxxxx Failed to load resource: the server responded with a status of 403 ()
我怀疑尽管有一个经过验证的网站,但我可能必须等待广告开始传播,但我还有第二个问题:
然后在导航到我网站上的另一个页面后,我得到:
adsbygoogle.js:72 Uncaught P {message: "adsbygoogle.push() error: Only one AdSense head tag supported per page. The second tag is ignored.", name: "TagError", pbr: true, stack: "TagError: adsbygoogle.push() error: Only one AdSen…lesyndication.com/pagead/js/adsbygoogle.js:238:39"}
我没有复制标签中的代码,但我想知道这是否是 turbolinks 的一个功能。
我的网站已经过验证,并且我启用了自动广告,但我认为我的实施存在问题。有没有人有使用 turbolinks 5 在 Rails 6 应用程序中实现谷歌广告的经验?
【问题讨论】:
标签: ruby-on-rails adsense ruby-on-rails-6