SaasHound
Saas Hound Docs

Angular

The official saashound Angular client library.

Installation

To install the ngx-saashound library, run the following command:

Using npm

Terminal window
npm install ngx-saashound

Using yarn

Terminal window
yarn add ngx-saashound

Using pnpm

Terminal window
pnpm install ngx-saashound

Usage

app.component.ts
import { SaasHound } from 'ngx-saashound';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
standalone: true,
imports: [],
})
export class AppComponent {
saasHoundService = inject(SaashoundService);
constructor(){
this.saasHoundService.init({
project: 'my-project',
apiKey: environment.saashoundToken,
// trackPageViews: false,
});
}
// Track an event
public sendEvent {
await saashound.logEvent({
channel: "payments",
title: "New Customer",
userId: "user-123",
icon: "💰",
notify: true,
tags: {
plan: "premium",
cycle: "onetime",
trial: false
}
});
}
// Identify user Properties (e.g. name, age, email, plan, etc.)
identifyUser() {
await saashound.identify({
userId: "user-123",
properties: {
name: "John Doe",
email: "john@doe.com",
plan: "premium",
}
});
}
// Track a metric
public sendMetric {
await saashound.sendMetric({
title: "Users",
value: 1254,
icon: "👥",
increment: false,
});
}
}