Skip to content

Matomo (formerly Piwik) tag manager integration for redux-beacon.

License

Notifications You must be signed in to change notification settings

dbartholomae/redux-beacon-matomo-tag-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-beacon-matomo-tag-manager

npm version downloads open issues FOSSA Status Build codecov dependency status devDependency status Greenkeeper semantic release

Matomo (formerly Piwik) tag manager integration for redux-beacon.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install redux-beacon-matomo-tag-manager --save

Usage

  1. Sign up for or install Matomo Tag Manager and create a new web container.
  2. Add the Matomo Tag Manager container snippet to your site.
  3. Install redux-beacon in your app
  4. Use this library to connect redux-beacon to the tag manager
import { applyMiddleware, createStore } from 'redux'
import { createMiddleware } from 'redux-beacon'
import MatomoTagManager from 'redux-beacon-matomo-tag-manager'

const ACTION_TYPE = 'ACTION_TYPE'

// Set up which actions should trigger which events or variables
const eventsMap = {
  [ACTION_TYPE]: () => ({
    event: 'integrationTestEvent'
  })
}

// Create the middleware
const matomoTagManager = MatomoTagManager()
const matomoTagManagerMiddleware = createMiddleware(eventsMap, matomoTagManager)

const store = createStore((state = {}) => state, applyMiddleware(matomoTagManagerMiddleware))

// When you dispatch an action, the middleware will trigger the event
store.dispatch({
  type: ACTION_TYPE
})

Thanks

Thanks to Matomo for supporting this project by providing an analytics property for integration testing this library.

About

Matomo (formerly Piwik) tag manager integration for redux-beacon.

Resources

License

Stars

Watchers

Forks

Packages

No packages published