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

redux-beacon

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-beacon

Analytics integration for Redux and ngrx/store

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
increased by3.06%
Maintainers
1
Weekly downloads
 
Created
Source

Redux Beacon

Analytics integration for Redux and ngrx/store

Features

  • Integrate with any analytics service, including:
    • Google Analytics
    • Google Tag Manager
    • Segment.io
  • Track analytics offline
  • Decouple analytics logic from app logic

Installation

npm install --save redux-beacon

Demo

Quick Start

How it works

Redux Beacon maps redux/ngrx actions to analytics events then sends them to a target (e.g. Google Analytics).

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

// This is an event definition
const pageView = (action, prevState) => ({
  hitType: 'pageview',
  page: action.payload,
  referrer: prevState.route,
});

// This is another event definition
const buttonClick = action => ({
  hitType: 'event',
  eventCategory: 'button-click',
  eventAction: action.type,
});

// This is how you map event definitions to redux/ngrx actions
const eventsMap = {
  LOCATION_CHANGED: pageView,
  BUTTON_CLICKED: buttonClick,
}

With the set up above Redux Beacon will create pageView, and buttonClick events whenever redux/ngrx dispatches LOCATION_CHANGED or BUTTON_CLICKED, then it'll push the generated analytics events to a target (e.g. Google Analytics).

Offline Event Collection

Redux Beacon provides extensions to help handle intermittent outages in connectivity. These extensions place events in a persistent store when offline (e.g indexedDB). When back online, the extensions purge the store and pass the events off to a target. Read more about offline event collection in the docs.

Built-In Targets

Docs

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

Keywords

FAQs

Package last updated on 26 Oct 2017

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