Skip to content

realAlexBarge/react-tracking-snapchat

Repository files navigation

React Tracking Snapchat

Build Status dependencies Status devDependencies Status License: MIT

Un-official module to easily add Snapchat pageview tracking to react apps. It functions as a tiny wrapper for the native script tag and window api. After initialization the Snapchat script is injected into the document.

Installation

With npm:

npm install react-tracking-snapchat --save

Usage

Before tracking any page views or events the tracker needs to be imported and initialized with the custom tracking id:

import SnapchatTracking from 'react-tracking-snapchat';
SnapchatTracking.initialize('TRACKING_ID');

After initializing page views can be tracked like this:

SnapchatTracking.trackPageview();

There is also the option to track custom events with event action:

SnapchatTracking.trackEvent(eventAction);

How this works

This modules takes care of injecting the provider specific tracking script into the document and provides a tiny wrapper for the tracking api. It also exposes the tracker object api for direct access.

Documentation for the raw tracker api can be found here and here.

About

Un-official module to easily add Snapchat pageview tracking to react apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published