修复 React-facebook-pixel

问题描述

我对 Facebook 像素包有一点问题。我只需要它来查看页面。我查阅了官方文档here,使用起来似乎还算方便。但是,它仍然不起作用。我写了以下代码

import ReactPixel from 'react-facebook-pixel'

const advancedMatching = { em: 'some@email.com' }
const options = {
  autoConfig: true,debug: false,}

function MyPage(){
  // other delarations
    useEffect(() => {
      ReactPixel.init('123456',advancedMatching,options)
      if (hasMarketingPreference) {
        console.log("I've just viewed the page!")
        ReactPixel.pageView()
      } else {
        ReactPixel.revokeConsent()
      }
    },[])

  return (<>{/*the page code*/}</>)
}

看起来好像到达了 console.log() 语句,但仍然不起作用。我做错什么了吗? 非常感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)