# elium-mixpanel

Basic React mixpanel integration using the [HTTP API](https://mixpanel.com/help/reference/http).

## API

### MixpanelProvider

MixpanelProvider will provide the `mixpanelEvent` and `mixpanelSetOnce` API methods in the context.
Data passed to the `globalProperties` will be sent with every mixpanelEvent call.

### withMixpanel

HoC to receive the API as props.

### Event

The Event component will send a mixpanel event in componentDidMount. Requires the context from MixpanelProvider.

    <Event name="my-event" type="view" data={{ extra: 'cool' }} />

### RegisterUser

RegisterUser calls setOnce on componentDidMount to initialize the mixpanel user with the given data. Requires the context from MixpanelProvider.

    <RegisterUser data={{ color: 'red', food: '🍔' }} />

## Development

Run tests:

    yarn test

Release:

    yarn release  # Update changelog and create release commit
    npm publish
