'Fix React-facebook-pixel
I have a little problem with the Facebook pixel package. I need it only for page view. I consulted the official documentation here and it seems to be pretty easy to use. However, it still doesn't work. I wrote the following code:
import ReactPixel from 'react-facebook-pixel'
const advancedMatching = { em: '[email protected]' }
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*/}</>)
}
It looks like it reaches the console.log() statement, but it still doesn't work. Did I do something wrong?
Thank you very much!
Solution 1:[1]
Worked for me !!!
We get the error ERR_BLOCKED_BY_CLIENT on chrome if ad blocker is active. Just disable the ad blocker and it will do the work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Udit |
