Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  state
  index.js
  setupTests.js
  package.json
  README.md
Size: Mime:
  README.md

amplitude-connector

A redux/redux-saga connector that provides actions and sagas as a wrapper for the Amplitude SDK.

For more information on the SDK see Amplitude SDK documentation.

For debugging have a look a this chrome extension.

Our amplitude platform to checkout events and analytics can be found here: Amplitude Doodle

Installation

Add the private registry:

echo "registry=https://npm-proxy.fury.io/mfsTqYdDz3bsKFQJuMAR/tmf/" >> .npmrc

Add the package to your package.json:

yarn add --save --exact @doodle/amplitude-connector

Documentation

For local develoment add the amplitude api Key to your environment variables. (Vault will be added for handling the various other environments).

We also need to provide the amplitude api key and the redux dispatch function to the options object that is passed to store.runRootsaga.

store.runRootSaga({
  amplitude: {
    amplitudeApiKey: process.env.AMPLITUDE_API_KEY,
    dispatch: store.dispatch,
  },
})

And pass the amplitude property inside of the rootSaga call.

import { amplitudeSaga } from '@doodle/amplitude-connector';

export default function* rootSaga(options = {}) {
  yield all([
    call(amplitudeSaga, options.amplitude),
    // ... add other sagas here
  ]);

Before tracking any events we need to initialize amplitude. This can be done by calling this action creator in various ways. Calling it in componetDidMount or at the beginning of a specific saga for example.

import { initAmplitude } from '@doodle/amplitude-connector';

export default function* amplitudeTrackingSaga(options = {}) {
  yield all([
    put(initAmplitude()),
    /...
  ]);

To get more info on the actual tracking. Have a look at the actions file. Or visist the above mentioned documentation for deeper knowladge.

Development

Login to private npm registry:

npm login
#Username: tmf
#Password:
#Email: (this IS public) tmf@doodle.com

After bumping version in package.json, publish new version:

npm publish