1.1.1 • Published 4 years ago

react-snapchat-pixel v1.1.1

Weekly downloads
711
License
MIT
Repository
github
Last release
4 years ago

React Snapchat Pixel

npm

React JS wrapper for Snapchat's Pixel

Its more or less a copy of react-facebook-pixel by Zain Sajjad but adapted for Snapchat's pixel.

Install

npm install react-snapchat-pixel

or

yarn add react-snapchat-pixel

How to use

import ReactPixel from 'react-snapchat-pixel';


const userIdentification = { user_email: 'some@email.com' }; // optional
const options = {
    debug: false, 		// enable logs
};
ReactPixel.init('yourPixelIdGoesHere', userIdentification, options);

ReactPixel.pageView(); 					// For tracking page view
ReactPixel.track( event, data ) 		// For tracking default events, more info about events and data https://businesshelp.snapchat.com/en-US/article/purchase-event

if you're bundling in CI

  ...
  componentDidMount() {
    const ReactPixel =  require('react-snapchat-pixel');
    ReactPixel.init('yourPixelIdGoesHere');
  }
  ...

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