Skip to main content

emaLogger

The emaLogger function is used to initialize logging within EMA. This function returns a logging function that can be provided directly to an analytics Provider component's onTrack prop.

Note: Actions to Mixpanel can also be debounced to prevent too many actions, such as Change, from getting tracked. By default, the debounce timeout is 500 milliseconds and set only for the Change event.

import { Provider as AnalyticsProvider, emaLogger } from '@emoney/kyber-analytics';

const logger = emaLogger();

function App() {
return (
<AnalyticsProvider onTrack={logger}>
<>App Contents</>
</AnalyticsProvider>
);
}

Excluding Default Actions

The emaLogger initialization function can take an object with a key of excludedActions. This list of actions can be used to exclude certain actions from being tracked. The key is checked against the value action's type. The following example excludes all BUTTON_CLICK actions from being tracked.

Result
Loading...
Live Editor

API

Configuration

Type: Object

Properties

  • debounceWait The amount of time to debounce successive actions.
  • debouncedActions A list of action names to debounce.
  • excludedActions A list of actions to be excluded from tracking.

emaLogger

Initialize a logger function within ema.

Parameters

  • config Configuration

Returns Track