Node

SaasHound client for Node applications.

Installation

To install the saashound node.js library, run the following command:

Using npm

Terminal window
npm install saashound-node

Using yarn

Terminal window
yarn add saashound-node

Using pnpm

Terminal window
pnpm install saashound-node

Usage

index.ts
import { SaasHound } from 'saashound-node'
const saashound = new SaasHound({
token: 'API_TOKEN',
project: 'PROJECT_NAME',
})
// Track an event
await saashound.logEvent({
channel: 'analytics',
title: 'Daily Metrics Report',
message: 'Your daily metrics report is ready for review.',
icon: '📊',
notify: false,
userId: 'user-1000',
tags: {
reportDate: '2023-09-26',
},
})
await saashound.sendMetric({
title: 'Total Revenue',
value: 18320,
icon: '💵',
increment: false,
})
// Identify user Properties (e.g. name, age, email, plan, level, etc.)
await saashound.identify({
userId: 'user-1000',
properties: {
name: 'Holden Tudix',
email: 'holden@tudix.com',
plan: 'premium',
referrals: 17,
},
})