SDK

Node SDK

Use Logspot in Node applications.

npm version

Logspot SDK for browser applications built with React, Next.js, Angular, etc.

Installation

npm install @logspot/node

or

yarn add @logspot/node

Usage

Init

import Logspot from '@logspot/node';

Logspot.init({ secretKey: 'YOUR_SECRET_KEY' });

Track

Logspot.track({
  event: 'UserSubscribed',
  userId: 'john@doe.com',
  metadata: { additionalData: '123' },
});

Parameters:

  • name - event name e.g. GroupCreated
  • userId (optional) - unique user id which will link the event to a specific user. It can be integer, UUID or even an email.
  • metadata (optional) - you can attach a JSON object to your event.
  • notify (optional) - triggers mobile notifcation.
  • message (optional | max 255 chars) - messaged displayed in the app and in the notification.

Maximum size of the payload is 3kB.