@automattic/node-tracks

Tracks wrapper for NodeJS

Usage no npm install needed!

<script type="module">
  import automatticNodeTracks from 'https://cdn.skypack.dev/@automattic/node-tracks';
</script>

README

Node Tracks

npm

A Tracks wrapper for NodeJS

⚠️⚠️⚠️⚠️ This library is for internal use at Automattic only. Join us! ⚠️⚠️⚠️⚠️

How to use

import tracker from '@automattic/node-tracks';

const trackEvent = tracker( '<valid_event_prefix>', { _ut: '<valid_event_user_type>' } ).trackEvent;
// tracker takes 2 arguments
// prefix (string): all your events will be prefixed with this
// globalParams (object): this is a global object that will be sent with all requests. `_ut` is required

trackEvent( 'eventName', extraParams, logger );
// trackEvent takes 3 arguments
// eventName (string) : Your event name
// extraParams (object): Any extra params
// logger (optional): will log to the console otherwise

Please refer to this table for a list of all extraParams