Skip to content

philipptri/redux-beacon

 
 

Repository files navigation

Redux Beacon

Analytics integration for Redux and ngrx/store


  • Works with Angular, React, and React Native
  • Supports every analytics platform, including:
    • Google Analytics
    • Google Tag Manager
    • Segment.io
    • Amplitude
  • Can track analytics offline
  • Supports Typescript

npm install --save redux-beacon

Quick Start

How it works

Redux-Beacon maps your Redux or ngrx actions to analytics events. Once generated, Redux-Beacon sends the generated events to a target (e.g. Google Analytics).

Analytics events are defined in an event definition, and mapped to actions in an event definitions map:

// Event Definition
const pageView = {
  eventFields: action => ({
    hitType: 'pageview',
    page: action.payload,
  }),
};

// Event Definitions Map
const eventsMap = {
  LOCATION_CHANGE: pageView,
}

With the above event definitions map, Redux-Beacon will create a pageView event whenever an action with type LOCATION_CHANGE is fired, then it will push the generated event to a target (e.g. Google Analytics).

Targets

Redux-Beacon provides prebuilt targets for some popular analytics services:

Docs

Check out the project site for API docs, tutorials, examples and more.

About

Analytics integration for Redux and ngrx/store

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.7%
  • TypeScript 5.3%