Adsense 仅适用于index.html 的主体,但不适用于任何React 组件
尽管网上有很多文章,但我一直在努力了解 React js 等 SPA 应用程序的 adsense 行为,我们在这里利用组件的优势,并将 adsense 代码段放置在通常的 和
adsbygoogle = window.adsbygoogle || []).push({});
Inside index.html 标记可以工作,但相同的代码片段不会在任何 React 组件(在 jsx 内部)上显示任何展示次数。与传统的 jquery/vanilla Javascript 相比,Adsense 与 React 和其他 SPA 存在许多兼容性问题。
我尝试安装第三方 npm React 库,例如 react-adsense 等。不起作用,并且仅当代码直接位于 body 标记下但不在任何子 jsx 组件中时才起作用。
有人在使用 adsense 时遇到过此类问题吗?我也在他们的社区论坛上发过帖子,但没有多大帮助。
希望有人解释得更好。谢谢
Regardless of multiple articles available online I have been suffering to understand adsense behavior with SPA applications like React js, we use the advantage of components here and when placing the adsense snippet the usual <ins>
and
adsbygoogle = window.adsbygoogle || []).push({});
Inside the index.html <body>
tag it works but the same snippet does n't display any impressions on any of the react components(inside jsx). Adsense has many compatability issues with react and other SPA than traditional jquery/vanilla Javascript.
I have tried installing third party npm react libraries like react-adsense etc.. But that doesn't work and it only works when the code is directly under body tag but not in any child jsx components.
Did anyone ever face this kind of problems with adsense. I have also posted in their community forum but it did n't help much.
Hope someone explain better. Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论