@retain-so/sdk
v0.1.1
Published
Official Retain SDK for Node.js
Readme
Retain Node.js SDK
Official Retain SDK for Node.js.
See full documentation: retain.so/docs
Install
npm install @retain-so/sdk
# or
yarn add @retain-so/sdk
# or
pnpm add @retain-so/sdkSetup
Get your project’s write key from the Retain dashboard.
import { Retain } from "@retain-so/sdk";
const retain = new Retain("rk-XXXXX");Usage
Identify a user
retain.identify({
userId: "user_123",
email: "[email protected]",
properties: {
name: "Jane Doe",
avatar: "https://example.com/avatar.png",
},
});Identify a user with an account
Associate the user with a company or organization they belong to:
retain.identify({
userId: "user_123",
email: "[email protected]",
account: {
id: "acc_789",
name: "Acme Inc",
avatar: "https://example.com/avatar.png",
},
});Track an event
retain.track({
userId: "user_123",
event: "Order Completed",
properties: {
amount: 99,
},
});License
MIT License
