@wildberries/wb-front-analytics-tracker
v1.2.0
Published
analytics tracker for js and react
Downloads
5,789
Keywords
Readme
@wildberries/wb-front-analytics-tracker
This package designed for wildberries analytics and contains:
- analyticsEventEmitter - sender function for analytics
- withAnalytics - HOC for React components
- SHARED_EVENTS - shared event constants
analyticsEventEmitter contains methods:
- init - method to initialize analyticsEventEmitter, params:
- prefix (string, non requred) - will be added to all events if in the events will be custom
- getIsInitialized - method to check if analyticsEventEmitter was initialized
- sendEvent - method to send events, params:
- name (string, required) - event name
- params (any, required) - event params
- customEvent (boolean) - need to add prefix or not
withAnalytics injects method:
- sendAnalytics, params:
- name (string, required)
- params (any, required)
- customEvent (boolean)
SHARED_EVENTS:
export const SHARED_EVENTS = {
PAGE_VIEW: 'pageview',
PERFORMANCE: 'suppliers-portal-front-performance',
};