# react-snapchat-pixel

> Pixel Kit for React

Latest version **1.1.1** (published 2020-04-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-snapchat-pixel
pnpm add react-snapchat-pixel
yarn add react-snapchat-pixel
bun add react-snapchat-pixel
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-04-02 |
| First published | 2019-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jonathan Grimmtjarn |
| Maintainers | alexdh, megastamp |
| Keywords | react, reactjs, react-component, pixel, snapchat-pixel |

## Links

- npm: https://www.npmjs.com/package/react-snapchat-pixel
- Repository: https://github.com/dhab/react-snapchat-pixel
- Issues: https://github.com/dhab/react-snapchat-pixel/issues
- npm.io page: https://npm.io/package/react-snapchat-pixel

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2020-04-02
- 1.1.0 — 2019-07-04
- 1.0.0 — 2019-05-28

## README

# React Snapchat Pixel
[![npm](https://img.shields.io/npm/dm/react-snapchat-pixel.svg)](https://www.npmjs.com/package/react-snapchat-pixel)

> React JS wrapper for [Snapchat's Pixel](https://businesshelp.snapchat.com/en-US/article/snap-pixel-about)

Its more or less a copy of [react-facebook-pixel](https://github.com/zsajjad/react-facebook-pixel) by [Zain Sajjad](https://github.com/zsajjad) but adapted for Snapchat's pixel.

## Install
```
npm install react-snapchat-pixel

```
or
```
yarn add react-snapchat-pixel

```

## How to use
```js
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**
```js
  ...
  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
```

---
_Source: https://npm.io/package/react-snapchat-pixel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
