程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误?

开发过程中遇到使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误的问题如何解决?下面主要结合日常开发的经验,给出你关于使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误的解决方法建议,希望对你解决使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误有所启发或帮助;

我遵循了 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 ()

我怀疑尽管有经过验证的网站,@R_127_8743@得不等待广告开始传播,但我还有第二个问题

然后在导航到我网站上的不同页面后,我得到:

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 的功能。

我的网站已通过验证并且我启用了自动广告,但我认为我的实施存在问题。有没有人有在 Rails 6 应用程序中使用 turbolinks 5 实现谷歌广告的经验?

解决方法

403 问题

我认为你是对的。传播需要时间。如果它持续几天 - 那么还有别的东西。您仍然收到此错误吗?

Only one AdSense head tag supported per page 错误

这可能与某些框架功能有关,是的。但是这个错误总体上是无害的,它不会影响广告的投放。当您说“导航到其他页面”时-您知道它是重新加载页面还是仅更新 html 而不重新加载?如果是后者,那么当框架获取第二个页面并呈现它时 - 该页面很可能也有一个 adsbygoogle.js 标签。鉴于该页面未重新加载 - 旧的 adsbygoogle.js 标记仍在加载,并且您会收到此错误。

大佬总结

以上是大佬教程为你收集整理的使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误全部内容,希望文章能够帮你解决使用 Rails 6 实现 Google Adsense 403 问题Only one AdSense head tag supported per page 错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。