winston-google-analytics-transport
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

winston-google-analytics-transport

Wraps universal-analytics and provides a bare minimum API to track events and pageviews. This implementation is barebones, PRs welcomed and wanted :)

1. Install

npm install winston-google-analytics-transport

2. Configure

import { GoogleAnalytics } from 'winston-google-analytics-transport';

const gaTransport = new GoogleAnalytics({
  level: 'debug',
  accountID: GOOGLE_ANALYTICS_TRACKING_ID,
});

logger.add(gaTransport);

3. Track Analytics

Takes params that are either EventParams or PageviewParams from the universal-analytics lib. Search DefinitelyTyped/universal-analytics for the type definitions.

const message: string = '';
const label: string = '';
const params: EventParams = {
  ec: '',
  ea '',
}
log.info(message, label, params);

Readme

Keywords

none

Package Sidebar

Install

npm i winston-google-analytics-transport

Weekly Downloads

1

Version

1.0.5

License

none

Unpacked Size

14.8 kB

Total Files

13

Last publish

Collaborators

  • kavehsajjadi