@recruit-tech/react-redux-analytics-sitecatalyst
v0.0.7
Published
SiteCatalyst plugin for react-redux-analytics
Downloads
7
Readme
SiteCatalyst plugin for react-redux-analytics
Features
- Track PageView by s.t() with custom variables
- Track Custom Event by s.tl() tracking with custom variables
- Set analytics variables to s object on PageView and Custom event tracking
Installation
npm install --save react-redux-analytics
Getting Started
1. Register Middleware
place SiteCatalystMiddlware just after AnalyticsMiddleware
import { applyMiddleware } from 'redux'
import { analyticsMiddleware } from 'react-redux-analytics'
import { siteCatalystMiddlware } from 'react-redux-analytics-sitecatalyst'
const sConfig = {
s_account: '[[YOUR S_ACCOUNT]]', //required
s_code: {
visitorNamespace: '[[YOUR VISITOR NAMESPACE]]', //required
trackingServer: '[[YOUR TRACKING SERVER]]', //required
..., //other s_code options
},
}
const enhancer = applyMiddleware(...,
analyticsMiddleware({
reducerName: 'analytics',
...
}),
siteCatalystMiddlware({
s_gi: (s_account) => window.s_gi(s_account), // or import s_code.js as a node module
config: sConfig,
...
})
)
2. Register Reducer
https://www.npmjs.com/package/react-redux-analytics
3. Track Page View on componentDidMount
https://www.npmjs.com/package/react-redux-analytics
4. Track Custom Event on Click
https://www.npmjs.com/package/react-redux-analytics