0.0.3 • Published 9 years ago

fluxible-plugin-amplitude v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Amplitude SDK with Fluxible

Plug & play Amplitude SDK for your fluxible application.

Shamelessly adapted from fluxible-facebook-plugin, thanks for the hard work Hairfie!

Features

  • Works with webpack / browserify
  • Loads amplitude SDK asynchronously (thanks to es6 Promises)
  • Shares configuration between server / client (means you can use environment variables)
  • Comes with a "do whatever you want" (MIT) license
  • Doesn't load SDK on server side

Install

Add the module to your fluxible project :

npm install --save fluxible-plugin-amplitude

Add it to your fluxible context :

import amplitudePlugin from 'fluxible-plugin-amplitude';

app.plug(amplitudePlugin({
    apiKey: 'xxx',
    version: '2.2.0' // this is default
}));

Usage

Add getAmplitudeSdk to the react's context :

Application = provideContext(Application, {

    // ...
    
    getAmplitudeSdk: React.PropTypes.func
    
});

From a component :

class FooComponent {

    static contextTypes = {
        getAmplitudeSdk: React.PropTypes.func
    };

    // ...

    plop() {
        this.context.getAmplitudeSdk().then(sdk => /* do whatever */);
    }

}
0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago