Vue

SaasHound client for Vue applications

Installation

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

Using npm

Terminal window
npm install saashound-vuejs

Using yarn

Terminal window
yarn add saashound-vuejs

Using pnpm

Terminal window
pnpm install saashound-vuejs

Usage

First, install the SaasHound plugin in your Vue application:

main.ts
import './assets/main.css'
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { SaasHound } from 'saashound-vuejs'
const app = createApp(App)
app.use(router)
app.use(SaasHound, {
token: 'API_TOKEN',
project: 'PROJECT_NAME',
trackPageViews: false,
})
app.mount('#app')

Then, import the functions you need from the package:

import { logEvent, sendMetric, identify } from 'saashound-vuejs'
// Set the user id for the current user
setUserId('user-123')
// Track an event
logEvent({
channel: 'payments',
title: 'New Customer',
userId: 'user-123',
icon: '💰',
notify: true,
tags: {
plan: 'premium',
cycle: 'onetime',
trial: false,
},
})
// Send a metric
sendMetric({
title: 'Users',
value: 1254,
icon: '👥',
increment: false,
})
// Identify a user
identify({
userId: 'user-123',
properties: {
name: 'John Doe',
email: 'john@doe.com',
plan: 'premium',
},
})