multicat-react
v0.0.18
Published
React context for the Multicat analytics API
Downloads
10
Readme
Multicat React integration
React context provider for Multicat, the unified analytics API.
🚧 WIP 🏗 UNDER CONSTRUCTION 🚧
Providers:
- Mixpanel
- Google Analytics
- Google Remarketing Tag
- Facebook pixel
- Reddit pixel
- Twitter pixel
- Hotjar
Install
npm install --save multicat-react
or
yarn add multicat-react
Usage
Wrap your App in a Provider
, and receive multicatEvent
or multicatView
as props with the help of withMulticat
wrapper, or receive them from the context through contextTypes
.
Check the example project in this package.
- In multicat.config.js we read the values from the process environment. Set these at deploy time, or overwrite here.
- In index.js we import a
Provider
frommulticat
, give it a configuration, and have it wrap the<App>
component. - In App.js we obtain
multicatView
andmulticatEvent
from the providedcontext
. - In Cart.js we obtain
multicatEvent
fromprops
with the help ofwithMulticat
consumer.
Upcoming API changes
❓📦🤷♀️
We're exploring how to implement the context provider with the new React Context API. Please check the draft proposal and state your preferences in the issues section. Thank you.
License & Contributors
MIT © Cofab