Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-reporter

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-reporter

Redux middleware for reporting actions to third party APIs.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
96
decreased by-41.82%
Maintainers
1
Weekly downloads
 
Created
Source

redux-reporter

Build Status npm version

Redux middleware for reporting actions to third party APIs. Extremely useful for analytics and error handling.

Installation

npm install --save redux-reporter

Usage

// todo

Analytics reporting

Generic Reporting
import reporter from './reporter';

export default reporter(({ type, payload }, getState) => {

    try {
        // report to external API
    } catch (err) {
        console.error(err);
    }

});


// /actions/MyActions.js
export function myAction() {
    let type = 'MY_ACTION';
    return {
        type,
        meta: {
            report: {
                type,
                payload: 'example payload'
            }
        }
    };
}

Adobe DTM (Analytics)
import reporter from './reporter';

const select = ({ meta = {} }) => meta.analytics;

export default reporter(({ type, payload }) => {

    try {
        window._satellite.setVar('payload', payload);
        window._satellite.track(type);
    } catch (err) {
        console.error(err);
    }

}, select);


// /actions/MyActions.js
export function myAction() {
    let type = 'MY_ACTION';
    return {
        type,
        meta: {
            analytics: {
                type,
                payload: 'example payload'
            }
        }
    };
}

Optimizely Goal Tracking
import reporter from './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'
            }
        }
    };
}

Report to Multiple Analytics APIs

// /actions/MyActions.js
export function myAction() {
    let type = 'MY_ACTION';

    let report =

    return {
        type,
        meta: {
            adobedtm: {
                type,
                payload: {
                    userType: 'xyz',
                    region: 'xyz'
                }
            },
            newrelic: {
                type,
                payload: 'example payload'
            }
        }
    };
}

Extending with global state
// todo

Error reporting

// todo
New relic
// todo
Sentry
// todo

Crash reporting

New relic
// todo
Sentry
// todo

Keywords

FAQs

Package last updated on 17 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc