gpt4 book ai didi

javascript - 如何将 reactjs 与 Google DFP/AdSense 一起使用

转载 作者:可可西里 更新时间:2023-11-01 02:22:49 25 4
gpt4 key购买 nike

我想使用 Facebook 的 reactjs 框架 (JSX) 构建一个项目,但考虑到它的呈现方式,我该如何将它与 Doubleclick for publishers 一起使用?

如果我触发了 adsense/urchin,我该如何告诉 React 不要更改/更新这些项目?

我可以使用替代的 adwords 脚本/界面吗?

最佳答案

(当我有一个 jsx 示例时,将用一个 jsx 示例来清理这个答案,现在......)

感谢 freenode #reactjs 中的 rcs:

rcs> tracker1: componentDidMount and make sure 
you're not throwing it away when you don't mean to

tracker1> rcs: so use componentDidMount for adsense/dfp
binding, and simply don't change the render output?

rcs> tracker1: Yeah. Your render should write out the
<ins class="adbygoogle" data-analytics-uacct ..... >
piece, and you should fire off the adsbygoogle.push in
componentDidMount

tracker1> cool... didn't think it would be that easy for
some reason...

rcs> tracker1: Or for dfp, handle the defineAdSlot in CDM,
and googletag.pubads().refresh() on something that fires
after they're all written out.

rcs> The thing that will trip you up is if you're firing
things that make React thing that written node needs to get
removed and replaced, instead of moved, etc.

rcs> But that shouldn't be a primary worry -- just something
to keep in the back of your head if you're seeing more
impressions/ad loads than you should be.

tracker1> they'll only change on a navigation/route change

rcs> Keep in mind that adsense TOS is vague on ajax page loads.
rcs> Or 'client side' page loads.

(修复 apos)

关于javascript - 如何将 reactjs 与 Google DFP/AdSense 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25435066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com