作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想使用 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/
我是一名优秀的程序员,十分优秀!