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]]',
s_code: {
visitorNamespace: '[[YOUR VISITOR NAMESPACE]]',
trackingServer: '[[YOUR TRACKING SERVER]]',
...,
},
}
const enhancer = applyMiddleware(...,
analyticsMiddleware({
reducerName: 'analytics',
...
}),
siteCatalystMiddlware({
s_gi: (s_account) => window.s_gi(s_account),
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
API
siteCatalystMiddleware