redux-reporter
Advanced tools
Comparing version 0.1.1 to 0.1.2
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.reduxReporter = global.reduxReporter || {}))); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.reduxReporter = global.reduxReporter || {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "redux-reporter", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Redux middleware for reporting actions to third party APIs.", | ||
@@ -31,7 +31,7 @@ "main": "dist/bundle.umd.js", | ||
"devDependencies": { | ||
"rollup": "0.36.4", | ||
"rollup-plugin-buble": "0.14.0", | ||
"standard": "8.6.0", | ||
"rollup": "0.42.0", | ||
"rollup-plugin-buble": "0.15.0", | ||
"standard": "10.0.2", | ||
"tape": "4.6.3" | ||
} | ||
} |
@@ -89,3 +89,3 @@ # redux-reporter | ||
## [New Relic](https://newrelic.com/) | ||
## Example w/ [New Relic](https://newrelic.com/) | ||
@@ -144,69 +144,1 @@ ### error reporting | ||
``` | ||
## Optimizely | ||
redux-reporter can be used for goal tracking with optimizely | ||
```js | ||
// /middleware/optimizely.js | ||
import reporter from 'redux-reporter'; | ||
export default reporter(({ type, payload }) => { | ||
window.optimizely = window.optimizely || []; | ||
window.optimizely.push(['trackEvent', type, payload]); | ||
}, ({ meta = {} }) => meta.experiments); | ||
// /actions/MyActions.js | ||
export function myAction() { | ||
let type = 'MY_ACTION'; | ||
return { | ||
type, | ||
meta: { | ||
experiments: { | ||
type, | ||
payload: 'example payload' | ||
} | ||
} | ||
}; | ||
} | ||
``` | ||
## Adobe DTM (direct call rules) | ||
You can also report to an Analytics provider. This example uses Adobe DTM, but this pattern will work for other APIs (keen, segment, etc.) | ||
```js | ||
// /actions/MyActions.js | ||
export function myAction() { | ||
let type = 'MY_ACTION'; | ||
return { | ||
type, | ||
meta: { | ||
analytics: { | ||
type, | ||
payload: { | ||
userType: 'example', | ||
someOtherData: '1234' | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
// /middleware/adobedtm.js | ||
import reporter from 'redux-reporter'; | ||
// create custom select function to select desired slice of your action | ||
const select = ({ meta = {} }) => meta.analytics; | ||
export default reporter(({ type, payload }) => { | ||
try { | ||
window._satellite.setVar('payload', payload); | ||
window._satellite.track(type); | ||
} catch (err) {} | ||
}, select); | ||
// inside Adobe DTM we create a direct call rule with the same name/condition as our action type | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52466
11
143