javascript - 修复 React-facebook-pixel
问题描述
我对 Facebook 像素包有一点问题。我只需要它来查看页面。我在这里查阅了官方文档,它似乎很容易使用。但是,它仍然不起作用。我写了以下代码:
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()
声明,但它仍然不起作用。我做错什么了吗?非常感谢!
解决方案
推荐阅读
- html - safari 上缺少单选按钮 css
- python - 在熊猫数据框中匹配/合并行
- windows - 检测 Windows 中的堆损坏
- javascript - 输入字段中的索引不递增
- php - 在类别系统的 2 个表中插入数据
- jquery - jQuery UI Datepicker - 禁用假期和星期六 - 添加星期五
- python - 找到素数,我写了一个不正确的函数和一个正确的函数。但我不确定为什么一个是正确的,一个是不正确的
- macos - GraphDB 工作台不会从 Mac 加载 .gz 压缩的 .brf 文件
- javascript - 调用字符串中的变量(超链接)- Discord.js
- python - 尝试将变量附加到 json 会在 python 中返回错误