0.2.1 • Published 9 months ago

@xtreamsrl/react-analytics-mixpanel v0.2.1

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

@xtreamsrl/react-analytics-mixpanel

This package exposes an implementation of the analytics manager that uses mixpanel.

Installation

npm install @xtreamsrl/react-analytics-mixpanel

Usage

In order to use Mixpanel as the analytics manager, you need a simple configuration step:

configureAnalytics(
     new Mixpanel(config.mixpanelTrackingToken)
);

Substantially, you need to pass the Mixpanel tracking token to the Mixpanel constructor. Given that usually the tracking token is retrieved from the environment variables, you can use the config object to access it after having added the variable to the .env file. In case you have a pipeline that injects the environment variables, remember to add the variable also there!

Another useful notion to mention is related to conditional tracking. In some cases, you might want to track events only in certain environments. To achieve this, you can use another environment variable to enable or disable the tracking. This scenario would lead to the following configuration:

configureAnalytics(
  config.enableMixpanelTracking
    ? new Mixpanel(config.mixpanelTrackingToken)
    : new DummyAnalyticsManager(),
);

For more details on how to use the library read the react-analytics README.

Who we are

0.2.1

9 months ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago