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

redux-gtm

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-gtm

Google Tag Manager integration for Redux and ngrx/store

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
93
decreased by-11.43%
Maintainers
1
Weekly downloads
 
Created
Source

ReduxGTM

Google Tag Manager integration for Redux and ngrx/store

license npm version CircleCI

Getting Started

Prerequisites

Installation

With npm:

npm install --save redux-gtm

With yarn:

yarn add redux-gtm

How it Works

import reducer from './reducer';
import { createStore, applyMiddleware } from 'redux';

// 1. Import ReduxGTM
import { createMiddleware } from 'redux-gtm';

// 2. Create a mapping between you Redux actions and you Google Tag Manager events
const eventDefinitions = {
  'SOME_REDUX_ACTION_TYPE': { eventName: 'some-gtm-custom-event' },
};

// 3. Create the middleware using createMiddleware from ReduxGTM
const analyticsMiddleware = createMiddleware(eventDefinitions);

// 4. Apply the middleware when creating your Redux store
const store = createStore(reducer, applyMiddleware(analyticsMiddleware));

Now, whenever your application dispatches SOME_REDUX_ACTION_TYPE, ReduxGTM will emit some-gtm-custom-event to Google Tag Manager.

Notes
  • When mapping actions to events, each action type must be mapped to a valid eventDefinition.

Examples

API

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Package last updated on 09 Nov 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