@eliumhq/elium-mixpanel

Mixpanel integration for elium projects

Usage no npm install needed!

<script type="module">
  import eliumhqEliumMixpanel from 'https://cdn.skypack.dev/@eliumhq/elium-mixpanel';
</script>

README

elium-mixpanel

Basic React mixpanel integration using the HTTP API.

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