React Facebook Pixel
React JS wrapper for Facebook's Pixel
Install
npm install react-facebook-pixel
or
yarn add react-facebook-pixel
How to use
; const advancedMatching = em: 'some@email.com' ; // optional, more info: https://developers.facebook.com/docs/facebook-pixel/pixel-with-ads/conversion-tracking#advanced_matchconst options = autoConfig: true // set pixel's autoConfig debug: false // enable logs;ReactPixel; ReactPixel; // For tracking page viewReactPixel; // For tracking default events, more info about events and data https://developers.facebook.com/docs/ads-for-websites/pixel-events/v2.9ReactPixel; // For tracking default events, more info about events and data https://developers.facebook.com/docs/ads-for-websites/pixel-events/v2.9ReactPixel; // For tracking custom eventsReactPixel; // For tracking custom events
if you're bundling in CI
... { const ReactPixel = ; ReactPixel; } ...
otherwise CI will complain there's no window
.
Dev Server
npm run start
Default dev server runs at localhost:8080 in browser. You can set IP and PORT in webpack.config.dev.js
Production Bundle
npm run bundle