小编Aim*_*han的帖子

Facebook像素在Gatsby js/React js

我最近使用gatsbyjs开发了网站,我想在网站上使用facebook转换像素(以及Google分析).我需要想法或帮助让它们发挥作用,以便我可以投放转换类型的广告.如果你像一个5岁的孩子那样对我说话,那将会非常有帮助.

呈现的代码<head>是:

module.exports = React.createClass({
  propTypes () {
    return {
      body: React.PropTypes.string,
    }
},

render () {
  const head = Helmet.rewind()
  let css
  if (process.env.NODE_ENV === 'production') {
  css = <style dangerouslySetInnerHTML={{ __html: require('!raw!./public/styles.css') }} />
    }

return (
  <html lang="en">
    <head>
      <meta charSet="utf-8" />
      <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1.0"
      />
      {head.title.toComponent()}
      {head.meta.toComponent()}
      <TypographyStyle typography={typography} />
      <GoogleFont typography={typography} />
      {css}
    </head>
    <body>
      <div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
        <script src={prefixLink(`/bundle.js?t=${BUILD_TIME}`)} />
      </body>
    </html>
      ) …
Run Code Online (Sandbox Code Playgroud)

facebook google-analytics reactjs gatsby

2
推荐指数
2
解决办法
5800
查看次数

标签 统计

facebook ×1

gatsby ×1

google-analytics ×1

reactjs ×1